infra-ansible/roles/bootstrap_puppetmaster/tasks/main.yml

104 lines
3.4 KiB
YAML

---
- name: Install required packages
apt: name={{ item }} state=installed
with_items:
- puppetmaster-passenger
- python-paramiko
- name: Download install_modules.sh script
get_url: >
url=https://git.openstack.org/cgit/openstack-infra/system-config/plain/install_modules.sh
dest=/tmp/install_modules.sh
- name: Download modules.env file required by install_modules.sh
get_url: >
url=https://git.openstack.org/cgit/openstack-infra/system-config/plain/modules.env
dest=/tmp/modules.env
- name: Run install_modules.sh to install all openstack-infra Puppet modules
command: bash /tmp/install_modules.sh
- name: Deploy /etc/puppet.conf template
template: src=puppet.conf.j2 dest=/etc/puppet/puppet.conf
- name: Copy top-level site.pp to /etc/puppet/manifests
copy: src=site.pp dest=/etc/puppet/manifests
- name: Create /etc/puppet/hieradata folder
file: path=/etc/puppet/hieradata state=directory
- name: Create /etc/puppet/hieradata/production folder
file: path=/etc/puppet/hieradata/production state=directory
- name: Copy hiera.yaml to /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: 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=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['gerrit'][0] }}.yaml
- name: Deploy Zuul fqdn hiera file
copy: >
src=hiera/fqdn/zuul.yaml
dest=/etc/puppet/hieradata/production/fqdn/{{ groups['zuul'][0] }}.yaml
- 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
service: name=puppet enabled=yes state=started
- name: Start apache2 for Puppetmaster passenger
service: name=apache2 enabled=yes state=started
- name: Enable puppet agent, as it is disabled upon installation
command: puppet agent --enable