Generate tackerc from puppet manifest

Try to remove external dependencies.

Change-Id: Ib56f2e1aaeecb85fd2427d91031c4756d39b8305
Signed-off-by: Michal Skalski <mskalski@mirantis.com>
This commit is contained in:
Michal Skalski 2016-09-30 13:38:29 +02:00
parent d445e489e9
commit e49db23fa2
5 changed files with 49 additions and 39 deletions

View File

@ -1,26 +0,0 @@
#!/bin/sh
wget -N http://mirrors.kernel.org/ubuntu/pool/universe/p/python-iniparse/python-iniparse_0.4-2.1build1_all.deb
wget -N http://archive.ubuntu.com/ubuntu/pool/universe/c/crudini/crudini_0.3-1_amd64.deb
dpkg -i python-iniparse_0.4-2.1build1_all.deb crudini_0.3-1_amd64.deb
auth_uri=$(crudini --get '/etc/heat/heat.conf' 'keystone_authtoken' 'auth_uri')
cat > tackerc <<EOFRC
#!/bin/sh
export LC_ALL=C
export OS_NO_CACHE='true'
export OS_TENANT_NAME='services'
export OS_PROJECT_NAME='services'
export OS_USERNAME='tacker'
export OS_PASSWORD='tacker'
export OS_AUTH_URL='${auth_uri}'
export OS_DEFAULT_DOMAIN='default'
export OS_AUTH_STRATEGY='keystone'
export OS_REGION_NAME='RegionOne'
export TACKER_ENDPOINT_TYPE='internalURL'
EOFRC
chmod +x tackerc
mv tackerc /root/

View File

@ -8,7 +8,7 @@ $public_vip = hiera('public_vip')
$public_ssl_hash = hiera_hash('public_ssl') $public_ssl_hash = hiera_hash('public_ssl')
$management_vip = hiera('management_vip') $management_vip = hiera('management_vip')
$region = pick($tacker_hash['region'], hiera('region', 'RegionOne')) $region = pick($tacker_hash['region'], hiera('region', 'RegionOne'))
$password = pick($tacker_hash['auth_name'], 'tacker') $password = $tacker_hash['user_password']
$auth_name = pick($tacker_hash['auth_name'], 'tacker') $auth_name = pick($tacker_hash['auth_name'], 'tacker')
$configure_endpoint = pick($tacker_hash['configure_endpoint'], true) $configure_endpoint = pick($tacker_hash['configure_endpoint'], true)
$configure_user = pick($tacker_hash['configure_user'], true) $configure_user = pick($tacker_hash['configure_user'], true)
@ -44,4 +44,3 @@ class { 'tacker::keystone::auth':
public_url => $public_url, public_url => $public_url,
region => $region, region => $region,
} }

View File

@ -17,11 +17,11 @@ $service_name = pick($tacker_hash['service'], 'tacker-server')
$tacker_tenant = pick($tacker_hash['tenant'], 'services') $tacker_tenant = pick($tacker_hash['tenant'], 'services')
$tacker_user = pick($tacker_hash['user'], 'tacker') $tacker_user = pick($tacker_hash['user'], 'tacker')
$tacker_user_password = pick($tacker_hash['user'], 'tacker') $tacker_user_password = $tacker_hash['user_password']
$ssl_hash = hiera_hash('use_ssl', {}) $ssl_hash = hiera_hash('use_ssl', {})
$public_auth_protocol = get_ssl_property($ssl_hash, {}, 'keystone', 'public', 'protocol', 'http') $public_auth_protocol = get_ssl_property($ssl_hash, {}, 'keystone', 'public', 'protocol', 'http')
$public_auth_address = get_ssl_property($ssl_hash, {}, 'keystone', 'public', 'hostname', $public_vip) $public_auth_address = get_ssl_property($ssl_hash, {}, 'keystone', 'public', 'hostname', $public_vip)
$admin_auth_protocol = get_ssl_property($ssl_hash, {}, 'keystone', 'admin', 'protocol', 'http') $admin_auth_protocol = get_ssl_property($ssl_hash, {}, 'keystone', 'admin', 'protocol', 'http')
$admin_auth_address = get_ssl_property($ssl_hash, {}, 'keystone', 'admin', 'hostname', $management_vip) $admin_auth_address = get_ssl_property($ssl_hash, {}, 'keystone', 'admin', 'hostname', $management_vip)
@ -68,4 +68,3 @@ class { 'tacker':
opendaylight_port => $odl_port, opendaylight_port => $odl_port,
heat_uri => $heat_uri, heat_uri => $heat_uri,
} }

View File

@ -0,0 +1,37 @@
notice('MODULAR: tacker_rc.pp')
$plugin_hash = hiera_hash('tacker', {})
$tacker_hash = $plugin_hash['metadata']
$public_vip = hiera('public_vip')
$tacker_tenant = pick($tacker_hash['tenant'], 'services')
$tacker_user = pick($tacker_hash['user'], 'tacker')
$tacker_user_password = $tacker_hash['user_password']
$ssl_hash = hiera_hash('use_ssl', {})
$public_auth_protocol = get_ssl_property($ssl_hash, {}, 'keystone', 'public', 'protocol', 'http')
$public_auth_address = get_ssl_property($ssl_hash, {}, 'keystone', 'public', 'hostname', $public_vip)
$auth_uri = "${public_auth_protocol}://${public_auth_address}:5000/v2.0/"
$tackerc = inline_template("
#!/bin/sh
export LC_ALL=C
export OS_NO_CACHE='true'
export OS_TENANT_NAME='<%= @tacker_tenant %>'
export OS_PROJECT_NAME='<%= @tacker_tenant %>'
export OS_USERNAME='<%= @tacker_user %>'
export OS_PASSWORD='<%= @tacker_user_password %>'
export OS_AUTH_URL='<%= @auth_uri %>'
export OS_DEFAULT_DOMAIN='default'
export OS_AUTH_STRATEGY='keystone'
export OS_REGION_NAME='RegionOne'
export TACKER_ENDPOINT_TYPE='internalURL'
")
file { '/root/tackerc':
owner => 'root',
group => 'root',
mode => '0700',
ensure => file,
content => "${tackerc}",
}

View File

@ -56,14 +56,15 @@
puppet_manifest: puppet/manifests/haproxy.pp puppet_manifest: puppet/manifests/haproxy.pp
puppet_modules: puppet/modules:/etc/puppet/modules puppet_modules: puppet/modules:/etc/puppet/modules
timeout: 300 timeout: 300
- id: tacker-tackerc - id: tacker-rc
role: [primary-controller] groups: [primary-controller, controller]
required_for: [deploy_end] required_for: [deploy_end]
requires: [primary-database, database,heat] requires: [tacker-install]
type: shell type: puppet
version: 2.0.0
cross-depends: cross-depends:
- name: /(primary-)?database/ - name: tacker-install
parameters: parameters:
cmd: bash create_tackerc.sh puppet_manifest: puppet/manifests/tacker_rc.pp
puppet_modules: puppet/modules:/etc/puppet/modules
timeout: 180 timeout: 180