From 92c9a7c8695043f27aade0a9adc87ff25946b401 Mon Sep 17 00:00:00 2001 From: Monty Taylor Date: Fri, 17 Aug 2018 05:11:03 -0500 Subject: [PATCH] Clean up puppet variables and playbooks The puppet playbooks were some of the first we wrote, so they're slightly wonky. Remove '---' lines that are completely unnecessary. Fix indentation. Move some variables that are the same everywhere into ansible variables. Put puppet related variables into the puppet group_vars. Stop running puppet on localhost in the git playbook. Change-Id: I2d2a4acccd3523f1931ebec5977771d5a310a0c7 --- playbooks/group_vars/all.yaml | 13 --------- playbooks/group_vars/puppet.yaml | 10 +++++++ playbooks/remote_puppet_adhoc.yaml | 5 +--- playbooks/remote_puppet_afs.yaml | 5 +--- playbooks/remote_puppet_else.yaml | 5 +--- playbooks/remote_puppet_git.yaml | 29 ++++++++----------- playbooks/remote_puppet_infracloud.yaml | 12 ++------ .../remote_puppet_infracloud_baremetal.yaml | 5 +--- tools/test_puppet_apply.sh | 2 ++ 9 files changed, 31 insertions(+), 55 deletions(-) create mode 100644 playbooks/group_vars/puppet.yaml diff --git a/playbooks/group_vars/all.yaml b/playbooks/group_vars/all.yaml index 155221b1e1..30982ea09a 100644 --- a/playbooks/group_vars/all.yaml +++ b/playbooks/group_vars/all.yaml @@ -1,9 +1,3 @@ -copy_hieradata: true -copy_puppet: true -manifest: /opt/system-config/manifests/site.pp -manifest_base: /opt/system-config -mgmt_manifestpath: /opt/system-config -puppet_logdest: syslog distro_lookup_path: - "{{ ansible_facts.distribution }}.{{ ansible_facts.lsb.codename }}.{{ ansible_facts.architecture }}.yaml" - "{{ ansible_facts.distribution }}.{{ ansible_facts.lsb.codename }}.yaml" @@ -18,13 +12,6 @@ exim_base_aliases: root: "{{ exim_sysadmins }}" exim_aliases: "{{ exim_base_aliases|combine(exim_extra_aliases) }}" -puppet: - logdest: syslog - copy_hieradata: true - copy_puppet: true - manifest: /opt/system-config/manifests/site.pp - manifest_base: /opt/system-config - # When adding new users, always pick a UID larger than the last UID, do not # fill in holes in the middle of the range. all_users: diff --git a/playbooks/group_vars/puppet.yaml b/playbooks/group_vars/puppet.yaml new file mode 100644 index 0000000000..5ce8213fd4 --- /dev/null +++ b/playbooks/group_vars/puppet.yaml @@ -0,0 +1,10 @@ +# Puppet related variables +copy_hieradata: true +copy_puppet: true +puppet_reports: none +manage_config: true +manifest: /opt/system-config/manifests/site.pp +manifest_base: /opt/system-config +mgmt_manifestpath: /opt/system-config +puppet_logdest: syslog + diff --git a/playbooks/remote_puppet_adhoc.yaml b/playbooks/remote_puppet_adhoc.yaml index fc11debf07..5724ab196a 100644 --- a/playbooks/remote_puppet_adhoc.yaml +++ b/playbooks/remote_puppet_adhoc.yaml @@ -1,7 +1,4 @@ - hosts: '*' strategy: free - gather_facts: true roles: - - role: puppet - manage_config: True - puppet_reports: none + - puppet diff --git a/playbooks/remote_puppet_afs.yaml b/playbooks/remote_puppet_afs.yaml index 5657271e0c..2d5b0d875b 100644 --- a/playbooks/remote_puppet_afs.yaml +++ b/playbooks/remote_puppet_afs.yaml @@ -1,8 +1,5 @@ --- - hosts: "afs*:!disabled" strategy: free - gather_facts: true roles: - - role: puppet - manage_config: True - puppet_reports: none + - puppet diff --git a/playbooks/remote_puppet_else.yaml b/playbooks/remote_puppet_else.yaml index f7ad594163..6dc0346ff9 100644 --- a/playbooks/remote_puppet_else.yaml +++ b/playbooks/remote_puppet_else.yaml @@ -1,7 +1,4 @@ - hosts: 'puppet:!review:!git0*:!zuul-scheduler:!afs*:!baremetal*:!controller*:!compute*:!puppetmaster*:!disabled' strategy: free - gather_facts: true roles: - - role: puppet - manage_config: True - puppet_reports: none + - puppet diff --git a/playbooks/remote_puppet_git.yaml b/playbooks/remote_puppet_git.yaml index 2a48f8ef23..5ebb0ae6bc 100644 --- a/playbooks/remote_puppet_git.yaml +++ b/playbooks/remote_puppet_git.yaml @@ -1,46 +1,41 @@ ---- - hosts: "localhost:!disabled" strategy: free - gather_facts: true connection: local tasks: + # Note that git module does ls-remote if clone is set to no and places # the remote_head value in returndict.after - - git: repo=https://git.openstack.org/openstack-infra/project-config clone=no + - name: Grab project-config repo info + git: + repo: https://git.openstack.org/openstack-infra/project-config + clone: no register: gitinfo - roles: - - role: puppet - copy_hieradata: False - copy_puppet: False - manage_config: True - puppet_reports: none -- hosts: "git0*:!disabled" + +- hosts: "git-server:!disabled" strategy: free - gather_facts: true max_fail_percentage: 1 roles: + - role: puppet facts: project_config_ref: "{{ hostvars.localhost.gitinfo.after }}" - manage_config: True - puppet_reports: none + - hosts: "review:!disabled" strategy: free gather_facts: true roles: + - role: puppet facts: project_config_ref: "{{ hostvars.localhost.gitinfo.after }}" puppet_timeout: 60m - manage_config: True - puppet_reports: none + - hosts: "zuul-scheduler:!disabled" strategy: free gather_facts: true roles: + - role: puppet facts: project_config_ref: "{{ hostvars.localhost.gitinfo.after }}" puppet_timeout: 60m - manage_config: True - puppet_reports: none diff --git a/playbooks/remote_puppet_infracloud.yaml b/playbooks/remote_puppet_infracloud.yaml index ac3a0c794a..26453f24df 100644 --- a/playbooks/remote_puppet_infracloud.yaml +++ b/playbooks/remote_puppet_infracloud.yaml @@ -1,16 +1,10 @@ ---- - hosts: "controller*.ic.openstack.org:!disabled" - gather_facts: true serial: 1 roles: - - role: puppet - manage_config: True - puppet_reports: none + - puppet + - hosts: "compute*.ic.openstack.org:!disabled" - gather_facts: true max_fail_percentage: 100 serial: "10%" roles: - - role: puppet - manage_config: True - puppet_reports: none + - puppet diff --git a/playbooks/remote_puppet_infracloud_baremetal.yaml b/playbooks/remote_puppet_infracloud_baremetal.yaml index a162af165b..3bb219197a 100644 --- a/playbooks/remote_puppet_infracloud_baremetal.yaml +++ b/playbooks/remote_puppet_infracloud_baremetal.yaml @@ -1,7 +1,4 @@ --- - hosts: "baremetal*.ic.openstack.org:!disabled" - gather_facts: true roles: - - role: puppet - manage_config: True - puppet_reports: none + - puppet diff --git a/tools/test_puppet_apply.sh b/tools/test_puppet_apply.sh index 0ac0af5806..0ab31ad787 100755 --- a/tools/test_puppet_apply.sh +++ b/tools/test_puppet_apply.sh @@ -24,6 +24,8 @@ remote_tmp=$ansible_root/remote_tmp EOF cat > $ansible_root/hosts < $fileout cat $file > $fileout