Only install puppet 4 if not already installed

The reinstallation of puppet 4 on every ansible run was assumed to be a
non issue that we could disable after our complete conversion to puppet
4 (via removal of the explicit install playbook and reliance on our
launch tooling). However, Installation of this package actually causes
the removal of Gerrit rc.d files which the next puppet run reinstalls.

Avoid this back and forth and the unnecesasry additional package
installation by checking if the puppet 4 bin path exists prior to
reinstalling puppet 4.

Change-Id: I47821ae799412f6cb9693b617ae6e7e630590c15
This commit is contained in:
Clark Boylan 2019-03-08 09:04:11 -08:00
parent 683b73b4fb
commit 2cfd85c792

View File

@ -2,11 +2,19 @@
name: "Puppet-version: install puppet-4 on puppet-4 hosts" name: "Puppet-version: install puppet-4 on puppet-4 hosts"
gather_facts: false gather_facts: false
tasks: tasks:
- get_url: - name: "Check if puppet 4 is already installed"
stat:
path: /opt/puppetlabs/puppet/bin/puppet
register: puppet4_bin_path
- name: "Get puppet installation script"
get_url:
url: http://git.openstack.org/cgit/openstack-infra/system-config/plain/install_puppet.sh url: http://git.openstack.org/cgit/openstack-infra/system-config/plain/install_puppet.sh
dest: /tmp/install_puppet.sh dest: /tmp/install_puppet.sh
mode: 0755 mode: 0755
checksum: sha256:741b8cfdc039e817bd598511dd7203da16701f213775e639994e8bb278a68239 checksum: sha256:741b8cfdc039e817bd598511dd7203da16701f213775e639994e8bb278a68239
- shell: /tmp/install_puppet.sh when: not puppet4_bin_path.stat.exists
- name: "Install puppet 4 if not already installed"
shell: /tmp/install_puppet.sh
environment: environment:
PUPPET_VERSION: 4 PUPPET_VERSION: 4
when: not puppet4_bin_path.stat.exists