From 09288c7c37e0379057489f9b0b7494cf13a6ae4f Mon Sep 17 00:00:00 2001 From: Clark Boylan Date: Thu, 30 Aug 2018 12:17:31 -0700 Subject: [PATCH] Manage clouds.yaml files in ansible This manages the clouds.yaml files in ansible so that we can get them updated automatically on bridge.openstack.org (which does not puppet). Co-Authored-By: James E. Blair Depends-On: https://review.openstack.org/598378 Change-Id: I2071f2593f57024bc985e18eaf1ffbf6f3d38140 --- manifests/site.pp | 5 - .../manifests/puppetmaster.pp | 25 ----- playbooks/base.yaml | 14 ++- playbooks/group_vars/nodepool-builder.yaml | 1 + playbooks/group_vars/nodepool-launcher.yaml | 1 + .../roles/configure-openstacksdk/README.rst | 7 +- .../configure-openstacksdk/defaults/main.yaml | 1 + .../configure-openstacksdk/tasks/main.yaml | 8 ++ .../clouds/bridge_all_clouds.yaml.j2 | 92 +++++++++---------- .../templates/clouds/bridge_clouds.yaml.j2 | 46 +++++----- .../templates/clouds/nodepool_clouds.yaml.j2 | 46 +++++----- playbooks/zuul/run-base.yaml | 2 + .../templates/group_vars/nodepool.yaml.j2 | 24 +++++ .../host_vars/bridge.openstack.org.yaml.j2 | 48 ++++++++++ tools/check_clouds_yaml.py | 8 +- 15 files changed, 200 insertions(+), 128 deletions(-) rename modules/openstack_project/templates/puppetmaster/all-clouds.yaml.erb => playbooks/templates/clouds/bridge_all_clouds.yaml.j2 (52%) rename modules/openstack_project/templates/puppetmaster/ansible-clouds.yaml.erb => playbooks/templates/clouds/bridge_clouds.yaml.j2 (55%) rename modules/openstack_project/templates/nodepool/clouds.yaml.erb => playbooks/templates/clouds/nodepool_clouds.yaml.j2 (68%) create mode 100644 playbooks/zuul/templates/group_vars/nodepool.yaml.j2 create mode 100644 playbooks/zuul/templates/host_vars/bridge.openstack.org.yaml.j2 diff --git a/manifests/site.pp b/manifests/site.pp index 7d53a6b472..a8ec944626 100644 --- a/manifests/site.pp +++ b/manifests/site.pp @@ -169,7 +169,6 @@ node 'puppetmaster.openstack.org' { pin_puppet => '3.6.', } class { 'openstack_project::puppetmaster': - puppetmaster_clouds => hiera('puppetmaster_clouds'), } } @@ -818,7 +817,6 @@ node /^nl\d+\.openstack\.org$/ { $packethost_username = hiera('nodepool_packethost_username', 'username') $packethost_password = hiera('nodepool_packethost_password') $packethost_project = hiera('nodepool_packethost_project', 'project') - $clouds_yaml = template("openstack_project/nodepool/clouds.yaml.erb") class { 'openstack_project::server': } @@ -827,7 +825,6 @@ node /^nl\d+\.openstack\.org$/ { class { '::openstackci::nodepool_launcher': nodepool_ssh_private_key => hiera('zuul_worker_ssh_private_key_contents'), project_config_repo => 'https://git.openstack.org/openstack-infra/project-config', - oscc_file_contents => $clouds_yaml, statsd_host => 'graphite.openstack.org', revision => 'master', python_version => 3, @@ -869,7 +866,6 @@ node /^nb\d+\.openstack\.org$/ { $packethost_username = hiera('nodepool_packethost_username', 'username') $packethost_password = hiera('nodepool_packethost_password') $packethost_project = hiera('nodepool_packethost_project', 'project') - $clouds_yaml = template("openstack_project/nodepool/clouds.yaml.erb") class { 'openstack_project::server': } @@ -880,7 +876,6 @@ node /^nb\d+\.openstack\.org$/ { vhost_name => $::fqdn, enable_build_log_via_http => true, project_config_repo => 'https://git.openstack.org/openstack-infra/project-config', - oscc_file_contents => $clouds_yaml, statsd_host => 'graphite.openstack.org', upload_workers => '16', revision => 'master', diff --git a/modules/openstack_project/manifests/puppetmaster.pp b/modules/openstack_project/manifests/puppetmaster.pp index 91da7844dd..1b0fea79c3 100644 --- a/modules/openstack_project/manifests/puppetmaster.pp +++ b/modules/openstack_project/manifests/puppetmaster.pp @@ -1,7 +1,6 @@ # == Class: openstack_project::puppetmaster # class openstack_project::puppetmaster ( - $puppetmaster_clouds, $root_rsa_key = 'xxx', ) { include logrotate @@ -31,30 +30,6 @@ class openstack_project::puppetmaster ( mode => '0750', } - file { '/etc/openstack': - ensure => directory, - owner => 'root', - group => 'admin', - mode => '0750', - } - - file { '/etc/openstack/clouds.yaml': - ensure => present, - owner => 'root', - group => 'admin', - mode => '0660', - content => template('openstack_project/puppetmaster/ansible-clouds.yaml.erb'), - } - - file { '/etc/openstack/all-clouds.yaml': - ensure => present, - owner => 'root', - group => 'admin', - mode => '0660', - content => template('openstack_project/puppetmaster/all-clouds.yaml.erb'), - } - - # For signing key management package { 'gnupg': ensure => present, diff --git a/playbooks/base.yaml b/playbooks/base.yaml index 56351a2f1c..2c9b5d825d 100644 --- a/playbooks/base.yaml +++ b/playbooks/base.yaml @@ -11,7 +11,19 @@ - timezone - unbound -- hosts: nodepool-launcher:nodepool-builder:bridge.openstack.org:!disabled +- hosts: bridge.openstack.org:!disabled + tasks: + - include_role: + name: configure-openstacksdk + vars: + openstacksdk_config_file: '{{ openstacksdk_config_dir }}/all-clouds.yaml' + openstacksdk_config_template: clouds/bridge_all_clouds.yaml.j2 + - include_role: + name: configure-openstacksdk + vars: + openstacksdk_config_template: clouds/bridge_clouds.yaml.j2 + +- hosts: nodepool-launcher:nodepool-builder:!disabled strategy: free roles: - configure-openstacksdk diff --git a/playbooks/group_vars/nodepool-builder.yaml b/playbooks/group_vars/nodepool-builder.yaml index 542ccfec4f..81cac6a1aa 100644 --- a/playbooks/group_vars/nodepool-builder.yaml +++ b/playbooks/group_vars/nodepool-builder.yaml @@ -1,3 +1,4 @@ openstacksdk_config_dir: /home/nodepool/.config/openstack openstacksdk_config_owner: nodepool openstacksdk_config_group: nodepool +openstacksdk_config_template: clouds/nodepool_clouds.yaml.j2 diff --git a/playbooks/group_vars/nodepool-launcher.yaml b/playbooks/group_vars/nodepool-launcher.yaml index 542ccfec4f..81cac6a1aa 100644 --- a/playbooks/group_vars/nodepool-launcher.yaml +++ b/playbooks/group_vars/nodepool-launcher.yaml @@ -1,3 +1,4 @@ openstacksdk_config_dir: /home/nodepool/.config/openstack openstacksdk_config_owner: nodepool openstacksdk_config_group: nodepool +openstacksdk_config_template: clouds/nodepool_clouds.yaml.j2 diff --git a/playbooks/roles/configure-openstacksdk/README.rst b/playbooks/roles/configure-openstacksdk/README.rst index 16ba44c249..ae511dfbaa 100644 --- a/playbooks/roles/configure-openstacksdk/README.rst +++ b/playbooks/roles/configure-openstacksdk/README.rst @@ -10,5 +10,10 @@ Configure openstacksdk files needed by nodepool and ansible. .. zuul:rolevar:: openstacksdk_config_owner :default: root -.. zuul:rolevar:: openstacksdf_config_group +.. zuul:rolevar:: openstacksdk_config_group :default: root + +.. zuul:rolevar:: openstacksdk_config_file + :default: {{ openstacksdk_config_dir }}/clouds.yaml + +.. zuul:rolevar:: openstacksdk_config_template diff --git a/playbooks/roles/configure-openstacksdk/defaults/main.yaml b/playbooks/roles/configure-openstacksdk/defaults/main.yaml index 8ca0dacd21..7609e6399a 100644 --- a/playbooks/roles/configure-openstacksdk/defaults/main.yaml +++ b/playbooks/roles/configure-openstacksdk/defaults/main.yaml @@ -1,3 +1,4 @@ openstacksdk_config_dir: /etc/openstack openstacksdk_config_owner: root openstacksdk_config_group: root +openstacksdk_config_file: '{{ openstacksdk_config_dir }}/clouds.yaml' diff --git a/playbooks/roles/configure-openstacksdk/tasks/main.yaml b/playbooks/roles/configure-openstacksdk/tasks/main.yaml index 3094092717..d4d40632c1 100644 --- a/playbooks/roles/configure-openstacksdk/tasks/main.yaml +++ b/playbooks/roles/configure-openstacksdk/tasks/main.yaml @@ -13,3 +13,11 @@ mode: 0640 owner: '{{ openstacksdk_config_owner }}' src: limestone_cacert.pem + +- name: Install the clouds config file + template: + src: '{{ openstacksdk_config_template }}' + dest: '{{ openstacksdk_config_file }}' + group: '{{ openstacksdk_config_group }}' + owner: '{{ openstacksdk_config_owner }}' + mode: 0640 diff --git a/modules/openstack_project/templates/puppetmaster/all-clouds.yaml.erb b/playbooks/templates/clouds/bridge_all_clouds.yaml.j2 similarity index 52% rename from modules/openstack_project/templates/puppetmaster/all-clouds.yaml.erb rename to playbooks/templates/clouds/bridge_all_clouds.yaml.j2 index 3fb247a538..b26d088300 100644 --- a/modules/openstack_project/templates/puppetmaster/all-clouds.yaml.erb +++ b/playbooks/templates/clouds/bridge_all_clouds.yaml.j2 @@ -2,9 +2,9 @@ clouds: openstackci-inap: profile: internap auth: - username: <%= @puppetmaster_clouds['openstackci_internap_username'] %> - password: <%= @puppetmaster_clouds['openstackci_internap_password'] %> - project_name: <%= @puppetmaster_clouds['openstackci_internap_project_name'] %> + username: '{{ clouds.openstackci_internap_username }}' + password: '{{ clouds.openstackci_internap_password }}' + project_name: '{{ clouds.openstackci_internap_project_name }}' regions: - name: mtl01 values: @@ -14,9 +14,9 @@ clouds: openstackjenkins-inap: profile: internap auth: - username: <%= @puppetmaster_clouds['openstackjenkins_internap_username'] %> - password: <%= @puppetmaster_clouds['openstackjenkins_internap_password'] %> - project_name: <%= @puppetmaster_clouds['openstackjenkins_internap_project_name'] %> + username: '{{ clouds.openstackjenkins_internap_username }}' + password: '{{ clouds.openstackjenkins_internap_password }}' + project_name: '{{ clouds.openstackjenkins_internap_project_name }}' regions: - name: mtl01 values: @@ -33,9 +33,9 @@ clouds: # for now ignore ipv6 force_ipv4: true auth: - username: <%= @puppetmaster_clouds['openstackci_ovh_username'] %> - password: <%= @puppetmaster_clouds['openstackci_ovh_password'] %> - project_name: <%= @puppetmaster_clouds['openstackci_ovh_project_name'] %> + username: '{{ clouds.openstackci_ovh_username }}' + password: '{{ clouds.openstackci_ovh_password }}' + project_name: '{{ clouds.openstackci_ovh_project_name }}' openstackci-rax: regions: - DFW @@ -43,9 +43,9 @@ clouds: - IAD profile: rackspace auth: - username: <%= @puppetmaster_clouds['openstackci_rax_username'] %> - password: <%= @puppetmaster_clouds['openstackci_rax_password'] %> - project_id: <%= @puppetmaster_clouds['openstackci_rax_project_id'] %> + username: '{{ clouds.openstackci_rax_username }}' + password: '{{ clouds.openstackci_rax_password }}' + project_id: '{{ clouds.openstackci_rax_project_id }}' openstackjenkins-rax: regions: - DFW @@ -53,9 +53,9 @@ clouds: - IAD profile: rackspace auth: - username: <%= @puppetmaster_clouds['openstackjenkins_rax_username'] %> - password: <%= @puppetmaster_clouds['openstackjenkins_rax_password'] %> - project_id: <%= @puppetmaster_clouds['openstackjenkins_rax_project_id'] %> + username: '{{ clouds.openstackjenkins_rax_username }}' + password: '{{ clouds.openstackjenkins_rax_password }}' + project_id: '{{ clouds.openstackjenkins_rax_project_id }}' openstackjenkins-ovh: regions: - GRA1 @@ -66,18 +66,18 @@ clouds: # for now ignore ipv6 force_ipv4: true auth: - username: <%= @puppetmaster_clouds['openstackjenkins_ovh_username'] %> - password: <%= @puppetmaster_clouds['openstackjenkins_ovh_password'] %> - project_name: <%= @puppetmaster_clouds['openstackjenkins_ovh_project_name'] %> + username: '{{ clouds.openstackjenkins_ovh_username }}' + password: '{{ clouds.openstackjenkins_ovh_password }}' + project_name: '{{ clouds.openstackjenkins_ovh_project_name }}' openstackjenkins-vexxhost: regions: - ca-ymq-1 - sjc1 profile: vexxhost auth: - username: '<%= @puppetmaster_clouds['openstackjenkins_vexxhost_username'] %>' - password: '<%= @puppetmaster_clouds['openstackjenkins_vexxhost_password'] %>' - project_name: '<%= @puppetmaster_clouds['openstackjenkins_vexxhost_project_name'] %>' + username: '{{ clouds.openstackjenkins_vexxhost_username }}' + password: '{{ clouds.openstackjenkins_vexxhost_password }}' + project_name: '{{ clouds.openstackjenkins_vexxhost_project_name }}' project_domain_name: default user_domain_name: default openstackci-vexxhost: @@ -86,9 +86,9 @@ clouds: - sjc1 profile: vexxhost auth: - username: '<%= @puppetmaster_clouds['openstackci_vexxhost_username'] %>' - password: '<%= @puppetmaster_clouds['openstackci_vexxhost_password'] %>' - project_name: '<%= @puppetmaster_clouds['openstackci_vexxhost_project_name'] %>' + username: '{{ clouds.openstackci_vexxhost_username }}' + password: '{{ clouds.openstackci_vexxhost_password }}' + project_name: '{{ clouds.openstackci_vexxhost_project_name }}' project_domain_name: default user_domain_name: default openstackci-citycloud: @@ -99,8 +99,8 @@ clouds: - Sto2 profile: citycloud auth: - username: <%= @puppetmaster_clouds['openstackci_citycloud_username'] %> - password: <%= @puppetmaster_clouds['openstackci_citycloud_password'] %> + username: '{{ clouds.openstackci_citycloud_username }}' + password: '{{ clouds.openstackci_citycloud_password }}' project_id: 656841f5d46e4b0889129d1fc20bd0b8 project_domain_id: a5e7d1a8f25b42b081cf89d1130638da user_domain_id: a5e7d1a8f25b42b081cf89d1130638da @@ -112,8 +112,8 @@ clouds: - Sto2 profile: citycloud auth: - username: <%= @puppetmaster_clouds['openstackzuul_citycloud_username'] %> - password: <%= @puppetmaster_clouds['openstackzuul_citycloud_password'] %> + username: '{{ clouds.openstackzuul_citycloud_username }}' + password: '{{ clouds.openstackzuul_citycloud_password }}' project_id: bed89257500340af8d0fbe7141b1bfd6 project_domain_id: a5e7d1a8f25b42b081cf89d1130638da user_domain_id: a5e7d1a8f25b42b081cf89d1130638da @@ -122,9 +122,9 @@ clouds: - RegionOne auth: auth_url: https://cn1.linaro.cloud:35357 - username: <%= @puppetmaster_clouds['openstackci_linaro_username'] %> - password: <%= @puppetmaster_clouds['openstackci_linaro_password'] %> - project_name: <%= @puppetmaster_clouds['openstackci_linaro_project_name'] %> + username: '{{ clouds.openstackci_linaro_username }}' + password: '{{ clouds.openstackci_linaro_password }}' + project_name: '{{ clouds.openstackci_linaro_project_name }}' project_domain_name: default user_domain_name: default openstackzuul-linaro: @@ -132,9 +132,9 @@ clouds: - RegionOne auth: auth_url: https://cn1.linaro.cloud:35357 - username: <%= @puppetmaster_clouds['openstackzuul_linaro_username'] %> - password: <%= @puppetmaster_clouds['openstackzuul_linaro_password'] %> - project_name: <%= @puppetmaster_clouds['openstackzuul_linaro_project_name'] %> + username: '{{ clouds.openstackzuul_linaro_username }}' + password: '{{ clouds.openstackzuul_linaro_password }}' + project_name: '{{ clouds.openstackzuul_linaro_project_name }}' project_domain_name: default user_domain_name: default openstackci-limestone: @@ -151,9 +151,9 @@ clouds: nat_source: true auth: auth_url: https://osa.continuous.pw:5000 - username: <%= @puppetmaster_clouds['openstackci_limestone_username'] %> - password: <%= @puppetmaster_clouds['openstackci_limestone_password'] %> - project_name: <%= @puppetmaster_clouds['openstackci_limestone_project_name'] %> + username: '{{ clouds.openstackci_limestone_username }}' + password: '{{ clouds.openstackci_limestone_password }}' + project_name: '{{ clouds.openstackci_limestone_project_name }}' user_domain_name: default project_domain_name: default identity_api_version: 3 @@ -172,9 +172,9 @@ clouds: nat_source: true auth: auth_url: https://osa.continuous.pw:5000 - username: <%= @puppetmaster_clouds['openstackzuul_limestone_username'] %> - password: <%= @puppetmaster_clouds['openstackzuul_limestone_password'] %> - project_name: <%= @puppetmaster_clouds['openstackzuul_limestone_project_name'] %> + username: '{{ clouds.openstackzuul_limestone_username }}' + password: '{{ clouds.openstackzuul_limestone_password }}' + project_name: '{{ clouds.openstackzuul_limestone_project_name }}' user_domain_name: default project_domain_name: default identity_api_version: 3 @@ -188,9 +188,9 @@ clouds: default_interface: True auth: auth_url: https://packet.platform9.net/keystone - username: <%= @puppetmaster_clouds['openstackci_packethost_username'] %> - password: <%= @puppetmaster_clouds['openstackci_packethost_password'] %> - project_name: <%= @puppetmaster_clouds['openstackci_packethost_project_name'] %> + username: '{{ clouds.openstackci_packethost_username }}' + password: '{{ clouds.openstackci_packethost_password }}' + project_name: '{{ clouds.openstackci_packethost_project_name }}' user_domain_name: default project_domain_name: default @@ -203,9 +203,9 @@ clouds: default_interface: True auth: auth_url: https://packet.platform9.net/keystone - username: <%= @puppetmaster_clouds['openstackzuul_packethost_username'] %> - password: <%= @puppetmaster_clouds['openstackzuul_packethost_password'] %> - project_name: <%= @puppetmaster_clouds['openstackzuul_packethost_project_name'] %> + username: '{{ clouds.openstackzuul_packethost_username }}' + password: '{{ clouds.openstackzuul_packethost_password }}' + project_name: '{{ clouds.openstackzuul_packethost_project_name }}' user_domain_name: default project_domain_name: default identity_api_version: '3' diff --git a/modules/openstack_project/templates/puppetmaster/ansible-clouds.yaml.erb b/playbooks/templates/clouds/bridge_clouds.yaml.j2 similarity index 55% rename from modules/openstack_project/templates/puppetmaster/ansible-clouds.yaml.erb rename to playbooks/templates/clouds/bridge_clouds.yaml.j2 index b421c17539..021b58eeea 100644 --- a/modules/openstack_project/templates/puppetmaster/ansible-clouds.yaml.erb +++ b/playbooks/templates/clouds/bridge_clouds.yaml.j2 @@ -13,9 +13,9 @@ clouds: openstackci-inap: profile: internap auth: - username: <%= @puppetmaster_clouds['openstackci_internap_username'] %> - password: <%= @puppetmaster_clouds['openstackci_internap_password'] %> - project_name: <%= @puppetmaster_clouds['openstackci_internap_project_name'] %> + username: '{{ clouds.openstackci_internap_username }}' + password: '{{ clouds.openstackci_internap_password }}' + project_name: '{{ clouds.openstackci_internap_project_name }}' regions: - name: mtl01 values: @@ -32,9 +32,9 @@ clouds: # for now ignore ipv6 force_ipv4: true auth: - username: <%= @puppetmaster_clouds['openstackci_ovh_username'] %> - password: <%= @puppetmaster_clouds['openstackci_ovh_password'] %> - project_name: <%= @puppetmaster_clouds['openstackci_ovh_project_name'] %> + username: '{{ clouds.openstackci_ovh_username }}' + password: '{{ clouds.openstackci_ovh_password }}' + project_name: '{{ clouds.openstackci_ovh_project_name }}' openstackci-rax: regions: - DFW @@ -42,18 +42,18 @@ clouds: - IAD profile: rackspace auth: - username: <%= @puppetmaster_clouds['openstackci_rax_username'] %> - password: <%= @puppetmaster_clouds['openstackci_rax_password'] %> - project_id: <%= @puppetmaster_clouds['openstackci_rax_project_id'] %> + username: '{{ clouds.openstackci_rax_username }}' + password: '{{ clouds.openstackci_rax_password }}' + project_id: '{{ clouds.openstackci_rax_project_id }}' openstackci-vexxhost: regions: - ca-ymq-1 - sjc1 profile: vexxhost auth: - username: '<%= @puppetmaster_clouds['openstackci_vexxhost_username'] %>' - password: '<%= @puppetmaster_clouds['openstackci_vexxhost_password'] %>' - project_name: '<%= @puppetmaster_clouds['openstackci_vexxhost_project_name'] %>' + username: '{{ clouds.openstackci_vexxhost_username }}' + password: '{{ clouds.openstackci_vexxhost_password }}' + project_name: '{{ clouds.openstackci_vexxhost_project_name }}' project_domain_name: default user_domain_name: default openstackci-citycloud: @@ -64,8 +64,8 @@ clouds: - Sto2 profile: citycloud auth: - username: <%= @puppetmaster_clouds['openstackci_citycloud_username'] %> - password: <%= @puppetmaster_clouds['openstackci_citycloud_password'] %> + username: '{{ clouds.openstackci_citycloud_username }}' + password: '{{ clouds.openstackci_citycloud_password }}' project_id: 656841f5d46e4b0889129d1fc20bd0b8 project_domain_id: a5e7d1a8f25b42b081cf89d1130638da user_domain_id: a5e7d1a8f25b42b081cf89d1130638da @@ -74,9 +74,9 @@ clouds: - RegionOne auth: auth_url: https://cn1.linaro.cloud:35357 - username: <%= @puppetmaster_clouds['openstackci_linaro_username'] %> - password: <%= @puppetmaster_clouds['openstackci_linaro_password'] %> - project_name: <%= @puppetmaster_clouds['openstackci_linaro_project_name'] %> + username: '{{ clouds.openstackci_linaro_username }}' + password: '{{ clouds.openstackci_linaro_password }}' + project_name: '{{ clouds.openstackci_linaro_project_name }}' project_domain_name: default user_domain_name: default openstackci-limestone: @@ -93,9 +93,9 @@ clouds: nat_source: true auth: auth_url: https://osa.continuous.pw:5000 - username: <%= @puppetmaster_clouds['openstackci_limestone_username'] %> - password: <%= @puppetmaster_clouds['openstackci_limestone_password'] %> - project_name: <%= @puppetmaster_clouds['openstackci_limestone_project_name'] %> + username: '{{ clouds.openstackci_limestone_username }}' + password: '{{ clouds.openstackci_limestone_password }}' + project_name: '{{ clouds.openstackci_limestone_project_name }}' user_domain_name: default project_domain_name: default identity_api_version: 3 @@ -109,9 +109,9 @@ clouds: default_interface: True auth: auth_url: https://packet.platform9.net/keystone - username: <%= @puppetmaster_clouds['openstackci_packethost_username'] %> - password: <%= @puppetmaster_clouds['openstackci_packethost_password'] %> - project_name: <%= @puppetmaster_clouds['openstackci_packethost_project_name'] %> + username: '{{ clouds.openstackci_packethost_username }}' + password: '{{ clouds.openstackci_packethost_password }}' + project_name: '{{ clouds.openstackci_packethost_project_name }}' user_domain_name: default project_domain_name: default identity_api_version: '3' diff --git a/modules/openstack_project/templates/nodepool/clouds.yaml.erb b/playbooks/templates/clouds/nodepool_clouds.yaml.j2 similarity index 68% rename from modules/openstack_project/templates/nodepool/clouds.yaml.erb rename to playbooks/templates/clouds/nodepool_clouds.yaml.j2 index 7379583eb9..7d790cbe66 100644 --- a/modules/openstack_project/templates/nodepool/clouds.yaml.erb +++ b/playbooks/templates/clouds/nodepool_clouds.yaml.j2 @@ -12,9 +12,9 @@ clouds: - IAD api_timeout: 60 auth: - username: '<%= @rackspace_username %>' - password: '<%= @rackspace_password %>' - project_id: <%= @rackspace_project %> + username: '{{ rackspace_username }}' + password: '{{ rackspace_password }}' + project_id: '{{ rackspace_project }}' force_ipv4: true ovh: profile: ovh @@ -26,16 +26,16 @@ clouds: - GRA1 api_timeout: 60 auth: - username: '<%= @ovh_username %>' - password: '<%= @ovh_password %>' - project_name: '<%= @ovh_project %>' + username: '{{ ovh_username }}' + password: '{{ ovh_password }}' + project_name: '{{ ovh_project }}' inap: profile: internap api_timeout: 60 auth: - username: '<%= @internap_username %>' - password: '<%= @internap_password %>' - project_name: '<%= @internap_project %>' + username: '{{ internap_username }}' + password: '{{ internap_password }}' + project_name: '{{ internap_project }}' regions: - name: mtl01 values: @@ -50,9 +50,9 @@ clouds: api_timeout: 60 auth_type: password auth: - username: '<%= @vexxhost_username %>' - password: '<%= @vexxhost_password %>' - project_name: '<%= @vexxhost_project %>' + username: '{{ vexxhost_username }}' + password: '{{ vexxhost_password }}' + project_name: '{{ vexxhost_project }}' project_domain_name: default user_domain_name: default image_format: 'raw' @@ -65,8 +65,8 @@ clouds: profile: citycloud api_timeout: 60 auth: - username: '<%= @citycloud_username %>' - password: '<%= @citycloud_password %>' + username: '{{ citycloud_username }}' + password: '{{ citycloud_password }}' project_id: bed89257500340af8d0fbe7141b1bfd6 project_domain_id: a5e7d1a8f25b42b081cf89d1130638da user_domain_id: a5e7d1a8f25b42b081cf89d1130638da @@ -76,9 +76,9 @@ clouds: identity_api_version: '3' auth: auth_url: https://cn1.linaro.cloud:35357 - username: <%= @linaro_username %> - password: <%= @linaro_password %> - project_name: <%= @linaro_project %> + username: '{{ linaro_username }}' + password: '{{ linaro_password }}' + project_name: '{{ linaro_project }}' project_domain_name: default user_domain_name: default limestone: @@ -92,9 +92,9 @@ clouds: nat_destination: true auth: auth_url: https://osa.continuous.pw:5000 - username: <%= @limestone_username %> - password: <%= @limestone_password %> - project_name: <%= @limestone_project %> + username: '{{ limestone_username }}' + password: '{{ limestone_password }}' + project_name: '{{ limestone_project }}' user_domain_name: default project_domain_name: default api_timeout: 60 @@ -110,9 +110,9 @@ clouds: default_interface: True auth: auth_url: https://packet.platform9.net/keystone - username: <%= @packethost_username %> - password: <%= @packethost_password %> - project_name: <%= @packethost_project %> + username: '{{ packethost_username }}' + password: '{{ packethost_password }}' + project_name: '{{ packethost_project }}' user_domain_name: default project_domain_name: default identity_api_version: '3' diff --git a/playbooks/zuul/run-base.yaml b/playbooks/zuul/run-base.yaml index 891740ddd8..319c848aef 100644 --- a/playbooks/zuul/run-base.yaml +++ b/playbooks/zuul/run-base.yaml @@ -42,6 +42,8 @@ dest: "/etc/ansible/hosts/{{ item }}" loop: - group_vars/all.yaml + - group_vars/nodepool.yaml + - host_vars/bridge.openstack.org.yaml - name: Display group membership command: ansible localhost -m debug -a 'var=groups' - name: Run base.yaml diff --git a/playbooks/zuul/templates/group_vars/nodepool.yaml.j2 b/playbooks/zuul/templates/group_vars/nodepool.yaml.j2 new file mode 100644 index 0000000000..77e3e2b12f --- /dev/null +++ b/playbooks/zuul/templates/group_vars/nodepool.yaml.j2 @@ -0,0 +1,24 @@ +# Necessary for fake clouds.yaml to be written +rackspace_username: user +rackspace_password: password +rackspace_project: project +ovh_username: user +ovh_password: password +ovh_project: project +internap_username: user +internap_password: password +internap_project: project +vexxhost_username: user +vexxhost_password: password +vexxhost_project: project +citycloud_username: user +citycloud_password: password +linaro_username: user +linaro_password: password +linaro_project: project +limestone_username: user +limestone_password: password +limestone_project: project +packethost_username: user +packethost_password: password +packethost_project: project diff --git a/playbooks/zuul/templates/host_vars/bridge.openstack.org.yaml.j2 b/playbooks/zuul/templates/host_vars/bridge.openstack.org.yaml.j2 new file mode 100644 index 0000000000..37fc5bcbc7 --- /dev/null +++ b/playbooks/zuul/templates/host_vars/bridge.openstack.org.yaml.j2 @@ -0,0 +1,48 @@ +# Necessary for fake clouds.yaml to be written +clouds: + openstackci_internap_username: user + openstackci_internap_password: password + openstackci_internap_project_name: project + openstackjenkins_internap_username: user + openstackjenkins_internap_password: password + openstackjenkins_internap_project_name: project + openstackci_ovh_username: user + openstackci_ovh_password: password + openstackci_ovh_project_name: project + openstackci_rax_username: user + openstackci_rax_password: password + openstackci_rax_project_id: project + openstackjenkins_rax_username: user + openstackjenkins_rax_password: password + openstackjenkins_rax_project_id: project + openstackjenkins_ovh_username: user + openstackjenkins_ovh_password: password + openstackjenkins_ovh_project_name: project + openstackjenkins_vexxhost_username: user + openstackjenkins_vexxhost_password: password + openstackjenkins_vexxhost_project_name: project + openstackci_vexxhost_username: user + openstackci_vexxhost_password: password + openstackci_vexxhost_project_name: project + openstackci_citycloud_username: user + openstackci_citycloud_password: password + openstackzuul_citycloud_username: user + openstackzuul_citycloud_password: password + openstackci_linaro_username: user + openstackci_linaro_password: password + openstackci_linaro_project_name: project + openstackzuul_linaro_username: user + openstackzuul_linaro_password: password + openstackzuul_linaro_project_name: project + openstackci_limestone_username: user + openstackci_limestone_password: password + openstackci_limestone_project_name: project + openstackzuul_limestone_username: user + openstackzuul_limestone_password: password + openstackzuul_limestone_project_name: project + openstackci_packethost_username: user + openstackci_packethost_password: password + openstackci_packethost_project_name: project + openstackzuul_packethost_username: user + openstackzuul_packethost_password: password + openstackzuul_packethost_project_name: project diff --git a/tools/check_clouds_yaml.py b/tools/check_clouds_yaml.py index 772dbac0a8..db32494986 100644 --- a/tools/check_clouds_yaml.py +++ b/tools/check_clouds_yaml.py @@ -21,9 +21,9 @@ import sys import tempfile FILES_TO_CHECK = ( - 'modules/openstack_project/templates/nodepool/clouds.yaml.erb', - 'modules/openstack_project/templates/puppetmaster/all-clouds.yaml.erb', - 'modules/openstack_project/templates/puppetmaster/ansible-clouds.yaml.erb' + 'playbooks/templates/clouds/nodepool_clouds.yaml.j2', + 'playbooks/templates/clouds/bridge_all_clouds.yaml.j2', + 'playbooks/templates/clouds/bridge_clouds.yaml.j2', ) @@ -39,7 +39,7 @@ def check_files(): os.path.basename(file)), 'w') in_file = open(file, 'r') for line in in_file: - line = re.sub(r'<%.*%>', 'loremipsum', line) + line = re.sub(r'{{.*}}', 'loremipsum', line) temp.write(line) temp.close()