Switch to roles/profiles pattern and Hiera as ENC for role assignment
Turns out using Hiera as ENC is limited and you can't order the classes to be applied on a node. This change switched to the Roles/Profiles pattern and uses Hiera as ENC still, but only to assign which role a node belongs to
This commit is contained in:
parent
cd329e7920
commit
d7ed978ab2
@ -0,0 +1,2 @@
|
||||
---
|
||||
roles: infra-ansible::roles::gerrit
|
@ -0,0 +1,2 @@
|
||||
---
|
||||
roles: infra-ansible::roles::jenkins
|
2
roles/bootstrap_puppetmaster/files/hiera/fqdn/zuul.yaml
Normal file
2
roles/bootstrap_puppetmaster/files/hiera/fqdn/zuul.yaml
Normal file
@ -0,0 +1,2 @@
|
||||
---
|
||||
roles: infra-ansible::roles::zuul
|
@ -1 +1 @@
|
||||
hiera_include('classes', [])
|
||||
hiera_include('roles', [])
|
||||
|
@ -32,28 +32,67 @@
|
||||
- name: Create /etc/puppet/hieradata/production folder
|
||||
file: path=/etc/puppet/hieradata/production state=directory
|
||||
|
||||
- name: Create /etc/puppet/hieradata/production/fqdn folder
|
||||
file: path=/etc/puppet/hieradata/production/fqdn state=directory
|
||||
|
||||
- name: Copy hiera.yaml to /etc/puppet/
|
||||
copy: src=hiera.yaml dest=/etc/puppet
|
||||
copy: src=hiera/hiera.yaml dest=/etc/puppet
|
||||
|
||||
- name: Run generate_hiera_common.py to populate common.yaml
|
||||
script: generate_hiera_common.py
|
||||
|
||||
- name: Deploy Gerrit server template for hiera
|
||||
- name: Create /etc/puppet/hieradata/production/fqdn folder
|
||||
file: path=/etc/puppet/hieradata/production/fqdn state=directory
|
||||
|
||||
- name: Create infra-ansible modules folder for roles and profiles
|
||||
file: path=/etc/puppet/modules/infra-ansible/manifests state=directory
|
||||
|
||||
- name: Create infra-ansible roles folder
|
||||
file: path=/etc/puppet/modules/infra-ansible/manifests/roles state=directory
|
||||
|
||||
- name: Create infra-ansible profiles folder
|
||||
file: path=/etc/puppet/modules/infra-ansible/manifests/profiles state=directory
|
||||
|
||||
- name: Deploy Gerrit puppet role module
|
||||
template: >
|
||||
src=gerrit.yaml.j2
|
||||
src=puppet_roles/gerrit.pp.j2
|
||||
dest=/etc/puppet/modules/infra-ansible/manifests/roles/gerrit.pp
|
||||
|
||||
- name: Deploy Zuul puppet role module
|
||||
template: >
|
||||
src=puppet_roles/zuul.pp.j2
|
||||
dest=/etc/puppet/modules/infra-ansible/manifests/roles/zuul.pp
|
||||
|
||||
- name: Deploy Jenkins puppet role module
|
||||
template: >
|
||||
src=puppet_roles/jenkins.pp.j2
|
||||
dest=/etc/puppet/modules/infra-ansible/manifests/roles/jenkins.pp
|
||||
|
||||
- name: Deploy Gerrit puppet profile template
|
||||
template: >
|
||||
src=puppet_profiles/gerrit.pp.j2
|
||||
dest=/etc/puppet/modules/infra-ansible/manifests/profiles/gerrit.pp
|
||||
|
||||
- name: Deploy Zuul puppet profile template
|
||||
template: >
|
||||
src=puppet_profiles/zuul.pp.j2
|
||||
dest=/etc/puppet/modules/infra-ansible/manifests/profiles/zuul.pp
|
||||
|
||||
- name: Deploy Jenkins puppet profile template
|
||||
template: >
|
||||
src=puppet_profiles/jenkins.pp.j2
|
||||
dest=/etc/puppet/modules/infra-ansible/manifests/profiles/jenkins.pp
|
||||
|
||||
- name: Deploy Gerrit fqdn hiera file
|
||||
copy: >
|
||||
src=hiera/fqdn/gerrit.yaml
|
||||
dest=/etc/puppet/hieradata/production/fqdn/{{ groups['meta-infra_type_gerrit'][0] }}.yaml
|
||||
|
||||
- name: Deploy Zuul server template for hiera
|
||||
template: >
|
||||
src=zuul.yaml.j2
|
||||
- name: Deploy Zuul fqdn hiera file
|
||||
copy: >
|
||||
src=hiera/fqdn/zuul.yaml
|
||||
dest=/etc/puppet/hieradata/production/fqdn/{{ groups['meta-infra_type_zuul'][0] }}.yaml
|
||||
|
||||
- name: Deploy Jenkins master server template for hiera
|
||||
template: >
|
||||
src=jenkins.yaml.j2
|
||||
- name: Deploy Jenkins fqdn hiera file
|
||||
copy: >
|
||||
src=hiera/fqdn/jenkins.yaml
|
||||
dest=/etc/puppet/hieradata/production/fqdn/{{ groups['meta-infra_type_jenkins'][0] }}.yaml
|
||||
|
||||
- name: Start puppet agent service
|
||||
|
@ -1,8 +0,0 @@
|
||||
---
|
||||
classes:
|
||||
- gerrit
|
||||
|
||||
gerrit::mysql_password: "%{hiera('gerrit_mysql_password')}"
|
||||
gerrit::gerrit_auth_type: DEVELOPMENT_BECOME_ANY_ACCOUNT
|
||||
gerrit::war: http://tarballs.openstack.org/ci/gerrit/gerrit-v2.10.2.23.039a170.war
|
||||
gerrit::secondary_index: true
|
@ -1,8 +0,0 @@
|
||||
---
|
||||
classes:
|
||||
- jenkins::master
|
||||
|
||||
jenkins::master::ssl_cert_file: /etc/ssl/certs/ssl-cert-snakeoil.pem
|
||||
jenkins::master::ssl_key_file: /etc/ssl/private/ssl-cert-snakeoil.key
|
||||
jenkins::master::jenkins_ssh_private_key: "%{hiera('jenkins_ssh_private_key')}"
|
||||
jenkins::master::jenkins_ssh_public_key: "%{hiera('jenkins_ssh_public_key')}"
|
@ -0,0 +1,8 @@
|
||||
class infra-ansible::profiles::gerrit {
|
||||
class { '::gerrit':
|
||||
mysql_password => hiera('gerrit_mysql_password'),
|
||||
gerrit_auth_type => 'DEVELOPMENT_BECOME_ANY_ACCOUNT',
|
||||
war => 'http://tarballs.openstack.org/ci/gerrit/gerrit-v2.10.2.23.039a170.war',
|
||||
secondary_index =>true
|
||||
}
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
class infra-ansible::profiles::jenkins {
|
||||
class { '::project_config':
|
||||
url => 'git://git.openstack.org/openstack-infra/project-config'
|
||||
}
|
||||
|
||||
class { 'jenkins::job_builder':
|
||||
url => 'http://localhost:8080',
|
||||
username => 'gerrig',
|
||||
password => hiera('jenkins_jobs_password'),
|
||||
config_dir => $::project_config::jenkins_job_builder_config_dir,
|
||||
require => $::project_config::config_dir
|
||||
}
|
||||
|
||||
class { 'jenkins::master':
|
||||
jenkins_ssh_private_key => hiera('jenkins_ssh_private_key'),
|
||||
jenkins_ssh_public_key => hiera('jenkins_ssh_public_key'),
|
||||
}
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
class infra-ansible::profiles::zuul {
|
||||
class { '::project_config':
|
||||
url => 'git://git.openstack.org/openstack-infra/project-config'
|
||||
}
|
||||
|
||||
class { '::zuul':
|
||||
gerrit_server => '{{ groups['meta-infra_type_gerrit'][0] }}',
|
||||
gerrit_user => 'gerrit',
|
||||
zuul_ssh_private_key => hiera('zuul_ssh_private_key_contents'),
|
||||
zuul_url => 'http://{{ groups['meta-infra_type_zuul'][0] }}/p',
|
||||
}
|
||||
|
||||
class { '::zuul::server':
|
||||
layout_dir => $::project_config::zuul_layout_dir
|
||||
}
|
||||
}
|
@ -0,0 +1,3 @@
|
||||
class infra-ansible::roles::gerrit {
|
||||
include infra-ansible::profiles::gerrit
|
||||
}
|
@ -0,0 +1,3 @@
|
||||
class infra-ansible::roles::jenkins {
|
||||
include infra-ansible::profiles::jenkins
|
||||
}
|
@ -0,0 +1,3 @@
|
||||
class infra-ansible::roles::zuul {
|
||||
include infra-ansible::profiles::zuul
|
||||
}
|
@ -1,12 +0,0 @@
|
||||
---
|
||||
classes:
|
||||
- project_config
|
||||
- zuul
|
||||
- zuul::server
|
||||
|
||||
project_config::url: git://git.openstack.org/openstack-infra/project-config
|
||||
zuul::gerrit_server: {{ groups['meta-infra_type_gerrit'][0] }}
|
||||
zuul::gerrit_user: gerrit
|
||||
zuul::zuul_ssh_private_key: "%{hiera(zuul_ssh_private_key_contents)}"
|
||||
zuul::zuul_url: http://{{ groups['meta-infra_type_zuul'][0] }}/p
|
||||
zuul::server::layout_dir: "%{::project_config::zuul_layout_dir}"
|
Loading…
Reference in New Issue
Block a user