From b22ce9214c807f63fdd08b6cc8ed7f9774a26c09 Mon Sep 17 00:00:00 2001 From: Monty Taylor Date: Wed, 25 Nov 2015 12:13:47 -0500 Subject: [PATCH] Manage clouds.yaml on puppetmaster with puppet For launch_node and for ansible-inventory we need a functioning clouds.yaml file. The file should really just contain the entries we actually need, becuase we don't want to be listing all the hosts in nodepool. However, we do want ALL of the entries available, so the all-clouds template has them all there. Not sure where we want that file to go though. Change-Id: Ibee80f9a4d8f159a626e2b4c2e9639134a559ae4 --- manifests/site.pp | 7 +- .../manifests/puppetmaster.pp | 18 ++- .../puppetmaster/all-clouds.yaml.erb | 122 ++++++++++++++++++ .../puppetmaster/ansible-clouds.yaml.erb | 43 ++++++ 4 files changed, 186 insertions(+), 4 deletions(-) create mode 100644 modules/openstack_project/templates/puppetmaster/all-clouds.yaml.erb create mode 100644 modules/openstack_project/templates/puppetmaster/ansible-clouds.yaml.erb diff --git a/manifests/site.pp b/manifests/site.pp index 358323a21b..7d36ed8cac 100644 --- a/manifests/site.pp +++ b/manifests/site.pp @@ -252,9 +252,10 @@ node 'puppetmaster.openstack.org' { pin_puppet => '3.6.', } class { 'openstack_project::puppetmaster': - root_rsa_key => hiera('puppetmaster_root_rsa_key'), - jenkins_api_user => hiera('jenkins_api_user', 'username'), - jenkins_api_key => hiera('jenkins_api_key'), + root_rsa_key => hiera('puppetmaster_root_rsa_key'), + jenkins_api_user => hiera('jenkins_api_user', 'username'), + jenkins_api_key => hiera('jenkins_api_key'), + puppetmaster_clouds => hiera('puppetmaster_clouds'), } } diff --git a/modules/openstack_project/manifests/puppetmaster.pp b/modules/openstack_project/manifests/puppetmaster.pp index 8436645a55..f84d09af68 100644 --- a/modules/openstack_project/manifests/puppetmaster.pp +++ b/modules/openstack_project/manifests/puppetmaster.pp @@ -2,6 +2,7 @@ # class openstack_project::puppetmaster ( $jenkins_api_key, + $puppetmaster_clouds, $jenkins_api_user = 'hudson-openstack', $root_rsa_key = 'xxx', $puppetdb = true, @@ -75,7 +76,22 @@ class openstack_project::puppetmaster ( owner => 'root', group => 'admin', mode => '0750', - } + } + + file { '/etc/openstack': + ensure => directory, + owner => 'root', + group => 'admin', + mode => '0750', + } + + file { '/etc/openstack/clouds.yaml': + ensure => present, + owner => 'root', + group => 'root', + mode => '0600', + content => template('openstack_project/puppetmaster/ansible-clouds.yaml.erb'), + } # For puppet master apache serving. package { 'puppetmaster-passenger': diff --git a/modules/openstack_project/templates/puppetmaster/all-clouds.yaml.erb b/modules/openstack_project/templates/puppetmaster/all-clouds.yaml.erb new file mode 100644 index 0000000000..37cb284953 --- /dev/null +++ b/modules/openstack_project/templates/puppetmaster/all-clouds.yaml.erb @@ -0,0 +1,122 @@ +clouds: + admin-bluebox: + region_name: RegionOne + auth: + auth_url: https://montytaylor-sjc.openstack.blueboxgrid.com:5001/v2.0 + username: <%= @puppetmaster_clouds['admin_bluebox_username'] %> + password: <%= @puppetmaster_clouds['admin_bluebox_password'] %> + project_name: <%= @puppetmaster_clouds['admin_bluebox_project_name'] %> + infra-files-ro: + profile: rackspace + auth: + username: <%= @puppetmaster_clouds['infra_files_ro_username'] %> + password: <%= @puppetmaster_clouds['infra_files_ro_password'] %> + project_name: <%= @puppetmaster_clouds['infra_files_ro_project_name'] %> + region_name: DFW + infra-files-rw: + profile: rackspace + auth: + username: <%= @puppetmaster_clouds['infra_files_rw_username'] %> + password: <%= @puppetmaster_clouds['infra_files_rw_password'] %> + project_name: <%= @puppetmaster_clouds['infra_files_rw_project_name'] %> + region_name: DFW + openstackci2-hpcloud: + profile: hp + auth: + username: <%= @puppetmaster_clouds['openstackci2_hpcloud_username'] %> + password: <%= @puppetmaster_clouds['openstackci2_hpcloud_password'] %> + project_name: <%= @puppetmaster_clouds['openstackci2_hpcloud_project_name'] %> + regions: + - region-a.geo-1 + - region-b.geo-1 + openstackci-bluebox: + region_name: RegionOne + auth: + auth_url: https://montytaylor-sjc.openstack.blueboxgrid.com:5001/v2.0 + username: <%= @puppetmaster_clouds['openstackci_bluebox_username'] %> + password: <%= @puppetmaster_clouds['openstackci_bluebox_password'] %> + project_name: <%= @puppetmaster_clouds['openstackci_bluebox_project_name'] %> + openstackci-internap: + region_name: nyj01 + profile: internap + auth: + username: <%= @puppetmaster_clouds['openstackci_internap_username'] %> + password: <%= @puppetmaster_clouds['openstackci_internap_password'] %> + project_name: <%= @puppetmaster_clouds['openstackci_internap_project_name'] %> + openstackjenkins-internap: + region_name: nyj01 + profile: internap + auth: + username: <%= @puppetmaster_clouds['openstackjenkins_internap_username'] %> + password: <%= @puppetmaster_clouds['openstackjenkins_internap_password'] %> + project_name: <%= @puppetmaster_clouds['openstackjenkins_internap_project_name'] %> + openstackci-ovh: + regions: + - GRA1 + - SBG1 + profile: ovh + auth: + username: <%= @puppetmaster_clouds['openstackci_ovh_username'] %> + password: <%= @puppetmaster_clouds['openstackci_ovh_password'] %> + project_name: <%= @puppetmaster_clouds['openstackci_ovh_project_name'] %> + openstackci-rax: + regions: + - DFW + - ORD + - IAD + profile: rackspace + auth: + username: <%= @puppetmaster_clouds['openstackci_rax_username'] %> + password: <%= @puppetmaster_clouds['openstackci_rax_password'] %> + project_id: <%= @puppetmaster_clouds['openstackci_rax_project_id'] %> + openstackjenkins-hpcloud: + profile: hp + auth: + username: <%= @puppetmaster_clouds['openstackjenkins_hpcloud_username'] %> + password: <%= @puppetmaster_clouds['openstackjenkins_hpcloud_password'] %> + project_name: <%= @puppetmaster_clouds['openstackjenkins_hpcloud_project_name'] %> + regions: + - region-a.geo-1 + - region-b.geo-1 + openstackjenkins-bluebox: + region_name: RegionOne + auth: + auth_url: https://montytaylor-sjc.openstack.blueboxgrid.com:5001/v2.0 + username: <%= @puppetmaster_clouds['openstackjenkins_bluebox_username'] %> + password: <%= @puppetmaster_clouds['openstackjenkins_bluebox_password'] %> + project_name: <%= @puppetmaster_clouds['openstackjenkins_bluebox_project_name'] %> + openstackjenkins-rax: + regions: + - DFW + - ORD + - IAD + profile: rackspace + auth: + username: <%= @puppetmaster_clouds['openstackjenkins_rax_username'] %> + password: <%= @puppetmaster_clouds['openstackjenkins_rax_password'] %> + project_id: <%= @puppetmaster_clouds['openstackjenkins_rax_project_id'] %> + openstackjenkins-ovh: + regions: + - GRA1 + - SBG1 + profile: ovh + auth: + username: <%= @puppetmaster_clouds['openstackjenkins_ovh_username'] %> + password: <%= @puppetmaster_clouds['openstackjenkins_ovh_password'] %> + project_name: <%= @puppetmaster_clouds['openstackjenkins_ovh_project_name'] %> + openstack-rax: + regions: + - DFW + - ORD + - IAD + profile: rackspace + auth: + username: <%= @puppetmaster_clouds['openstack_rax_username'] %> + password: <%= @puppetmaster_clouds['openstack_rax_password'] %> + project_id: <%= @puppetmaster_clouds['openstack_rax_project_id'] %> + openstack-nodepool-tripleo: + auth: + auth_url: https://ci-overcloud.rh1.tripleo.org:13000/v2.0 + username: <%= @puppetmaster_clouds['openstack_nodepool_tripleo_username'] %> + password: <%= @puppetmaster_clouds['openstack_nodepool_tripleo_password'] %> + project_name: <%= @puppetmaster_clouds['openstack_nodepool_tripleo_project_name'] %> diff --git a/modules/openstack_project/templates/puppetmaster/ansible-clouds.yaml.erb b/modules/openstack_project/templates/puppetmaster/ansible-clouds.yaml.erb new file mode 100644 index 0000000000..26ad8dfa17 --- /dev/null +++ b/modules/openstack_project/templates/puppetmaster/ansible-clouds.yaml.erb @@ -0,0 +1,43 @@ +clouds: + openstackci2-hpcloud: + profile: hp + auth: + username: <%= @puppetmaster_clouds['openstackci2_hpcloud_username'] %> + password: <%= @puppetmaster_clouds['openstackci2_hpcloud_password'] %> + project_name: <%= @puppetmaster_clouds['openstackci2_hpcloud_project_name'] %> + regions: + - region-a.geo-1 + - region-b.geo-1 + openstackci-bluebox: + region_name: RegionOne + auth: + auth_url: https://montytaylor-sjc.openstack.blueboxgrid.com:5001/v2.0 + username: <%= @puppetmaster_clouds['openstackci_bluebox_username'] %> + password: <%= @puppetmaster_clouds['openstackci_bluebox_password'] %> + project_name: <%= @puppetmaster_clouds['openstackci_bluebox_project_name'] %> + openstackci-internap: + region_name: nyj01 + profile: internap + auth: + username: <%= @puppetmaster_clouds['openstackci_internap_username'] %> + password: <%= @puppetmaster_clouds['openstackci_internap_password'] %> + project_name: <%= @puppetmaster_clouds['openstackci_internap_project_name'] %> + openstackci-ovh: + regions: + - GRA1 + - SBG1 + profile: ovh + auth: + username: <%= @puppetmaster_clouds['openstackci_ovh_username'] %> + password: <%= @puppetmaster_clouds['openstackci_ovh_password'] %> + project_name: <%= @puppetmaster_clouds['openstackci_ovh_project_name'] %> + openstackci-rax: + regions: + - DFW + - ORD + - IAD + profile: rackspace + auth: + username: <%= @puppetmaster_clouds['openstackci_rax_username'] %> + password: <%= @puppetmaster_clouds['openstackci_rax_password'] %> + project_id: <%= @puppetmaster_clouds['openstackci_rax_project_id'] %>