update hiera override and tasks

This commit is contained in:
Sergey Kulikov 2016-08-04 14:43:54 +00:00
parent c47c18f5ae
commit 9df1a8e298
6 changed files with 66 additions and 64 deletions

View File

@ -1,6 +0,0 @@
file { '/tmp/hello-file':
ensure => 'present',
replace => 'no', # this is the important property
content => "From Puppet\n",
mode => '0644',
}

View File

@ -0,0 +1 @@
include rally

View File

@ -0,0 +1,58 @@
# Copyright 2016 Mirantis, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
$plugin_name = 'fuel-plugin-rally'
$rally_hash = hiera_hash('fuel-plugin-rally', undef)
if $rally_hash {
if ($rally_hash['repository_type'] == 'default') {
$repository_url = 'https://github.com/openstack/rally'
$repository_tag = $rally_hash['repository_tag']
} else {
$repository_url = $rally_hash['repository_custom']
$repository_tag = $rally_hash['repository_custom_tag']
}
$public_ssl = hiera_hash('public_ssl', undef)
$proto = $public_ssl['services'] ? {
true => 'https',
default => 'http',
}
$public_vip = hiera('public_vip', undef)
$auth_url = "${proto}://${public_vip}:5000/v2.0"
$access_hash = hiera_hash('access_hash', undef)
$username = $access_hash['user']
$password = $access_hash['password']
$tenant_name = $access_hash['tenant']
$hiera_file = "/etc/hiera/plugins/${plugin_name}.yaml"
$calculated_content = inline_template('
---
rally::repository_url: <%= @repository_url %>
rally::repository_tag: <%= @repository_tag %>
rally::auth_url: <%= @auth_url %>
rally::username: <%= @username %>
rally::password: <%= @password %>
rally::tenant_name: <%= @tenant_name %>
')
file { "${hiera_file}":
ensure => file,
content => $calculated_content,
}
}

View File

@ -0,0 +1 @@
include rally

View File

@ -1,52 +0,0 @@
# Copyright 2016 Mirantis, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
notice('fuel-plugin-rally: rally_hiera_override.pp')
# maybe fo future use
$network_scheme = hiera_hash('network_scheme')
$network_metadata = hiera_hash('network_metadata')
prepare_network_config($network_scheme)
$rally = hiera_hash('fuel-plugin-rally', undef)
if ($rally['repository_type'] == 'default') {
$repository_url = 'https://github.com/openstack/rally'
$repository_tag = $rally['repository_tag']
} else {
$repository_url = $rally['repository_custom']
$repository_tag = $rally['repository_custom_tag']
}
$management_ip = get_network_role_property('management', 'ipaddr')
$hiera_dir = '/etc/hiera/override'
$plugin_name = 'rally'
$plugin_yaml = "${plugin_name}.yaml"
$calculated_content = inline_template('
---
rally::listen_address: <%= @management_ip %>
rally::repository_url: <%= @repository_url %>
rally::repository_tag: <%= @repository_tag %>
')
###################
file {'/etc/hiera/override':
ensure => directory,
} ->
file { "${hiera_dir}/${plugin_yaml}":
ensure => file,
content => "${calculated_content}\n",
}

View File

@ -14,8 +14,8 @@
- logging
- netconfig
- hosts
- rally-hiera
- puppet-demo
- rally-hiera-override
- rally-deploy
requires: [deploy_start]
required_for: [deploy_end]
parameters:
@ -28,23 +28,23 @@
# This task needs to be reexecuted to adapt the configuration parameters which
# depend on the number of nodes in the cluster
- id: rally-hiera
- id: rally-hiera-override
type: puppet
version: 2.0.0
requires: [netconfig]
required_for: [deploy_end]
parameters:
puppet_manifest: "puppet/manifests/rally_hiera_override.pp"
puppet_manifest: "puppet/manifests/hiera_override.pp"
puppet_modules: puppet/modules:/etc/puppet/modules
timeout: 120
- id: puppet-demo
- id: rally-deploy
type: puppet
version: 2.0.0
role: [rally]
requires: [netconfig]
required_for: [deploy_end]
parameters:
puppet_manifest: puppet/manifests/demo.pp
puppet_manifest: puppet/manifests/deploy.pp
puppet_modules: puppet/modules:/etc/puppet/modules
timeout: 600