Browse Source

Skip installing puppetlabs repos if they exist

Currently ansible fails on most puppet4 hosts with

 TASK [puppet-install : Install puppetlabs repo] ********************************
 fatal: [...]: FAILED! => {"changed": false, "msg": "A later version is already installed"}

As described inline, the version at the "top level" we are installing
via ansible here is actualy lower than the version in the repo this
package installs (inception).  Thus once an upgrade has been run on
the host, we are now trying to *downgrade* the puppetlabs-release
package.  This stops the ansible run and makes everything unhappy.

If we have the puppet repo, just skip trying to install it again.

We do this for just trusty and xenial; at this point we don't have any
puppet5 hosts (and none are planned) and I haven't checked if it has
the same issues.

Change-Id: I55ea8bfbfc40befb1d138e9bc0f95b120f8f5dbd
changes/64/651064/2
Ian Wienand 1 month ago
parent
commit
72b4b868ab

+ 14
- 0
roles/puppet-install/tasks/puppet-install/trusty.yaml View File

@@ -24,9 +24,23 @@
24 24
   when: puppet_install_version == 4
25 25
   become: true
26 26
   block:
27
+
28
+    # The puppetlabs-release-pc1 deb install below unfortunatley isn't
29
+    # idempotent.  If you install the puppet repo with this deb and
30
+    # then upgrade, you pull in a new version of
31
+    # puppetlabs-release-pc1 ... now ansible gets upset because we're
32
+    # trying to downgrade the package.  This could be fixed by puppet
33
+    # symlinking the version at the top-level to the latest .deb
34
+    # ... or we just skip installing it if we seem to have the repo
35
+    # already.
36
+    - name: "Check for puppet 4 repo"
37
+      stat:
38
+        path: /etc/apt/sources.list.d/puppetlabs-pc1.list
39
+      register: puppet4_repo
27 40
     - name: Install puppetlabs repo
28 41
       apt:
29 42
         deb: http://apt.puppetlabs.com/puppetlabs-release-pc1-trusty.deb
43
+      when: not puppet4_repo.stat.exists
30 44
 
31 45
     - name: Install puppet packages
32 46
       apt:

+ 14
- 0
roles/puppet-install/tasks/puppet-install/xenial.yaml View File

@@ -19,9 +19,23 @@
19 19
   when: puppet_install_version == 4
20 20
   become: true
21 21
   block:
22
+
23
+    # The puppetlabs-release-pc1 deb install below unfortunatley isn't
24
+    # idempotent.  If you install the puppet repo with this deb and
25
+    # then upgrade, you pull in a new version of
26
+    # puppetlabs-release-pc1 ... now ansible gets upset because we're
27
+    # trying to downgrade the package.  This could be fixed by puppet
28
+    # symlinking the version at the top-level to the latest .deb
29
+    # ... or we just skip installing it if we seem to have the repo
30
+    # already.
31
+    - name: "Check for puppet 4 repo"
32
+      stat:
33
+        path: /etc/apt/sources.list.d/puppetlabs-pc1.list
34
+      register: puppet4_repo
22 35
     - name: Install puppetlabs repo
23 36
       apt:
24 37
         deb: https://apt.puppetlabs.com/puppetlabs-release-pc1-xenial.deb
38
+      when: not puppet4_repo.stat.exists
25 39
 
26 40
     - name: Install puppet packages
27 41
       apt:

Loading…
Cancel
Save