]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-cm-ansible.git/commitdiff
roles/common/tasks/rhel-entitlements.yml: check for /var/lib/dbus wip-dbus-uuid
authorDan Mick <dmick@redhat.com>
Fri, 6 Sep 2024 06:59:42 +0000 (23:59 -0700)
committerDan Mick <dmick@redhat.com>
Fri, 6 Sep 2024 06:59:42 +0000 (23:59 -0700)
dbus-uuidgen will only work if /var/lib/dbus already exists.
In RHEL 9.3, 1) dbus-uuidgen isn't even installed (from
dbus-tools), and 2) /var/lib/dbus does not exist unless
dbus-daemon is installed, which it's not, by default, for a
kickstart install.  So this role will break when run during
fog image capture.

Change to do the two dbus-uuidgen's only if /var/lib/dbus exists.

Signed-off-by: Dan Mick <dmick@redhat.com>
roles/common/tasks/rhel-entitlements.yml

index f1d155b9d965c7405ed4aa421449e3213f1735a4..aee0cdf204e9eb2dbbb5db40074a7808e2173127 100644 (file)
   register: new_uuid
   when: use_satellite == true
 
+- name: Check for existence of /var/lib/dbus
+  stat:
+    path: /var/lib/dbus
+  register: var_lib_dbus
+
 - name: Run dbus-uuidgen to create /var/lib/dbus/machine-id
   shell: dbus-uuidgen --ensure
+  when: var_lib_dbus.stat.exists
 
 - name: Run systemd-machine-id-setup to set /etc/machine-id
   shell: systemd-machine-id-setup
 # recreate the removed machine-id files to avoid breaking
 # other parts of the system, /bin/install-kernel for instance
 
+- name: Check for existence of /var/lib/dbus
+  stat:
+    path: /var/lib/dbus
+  register: var_lib_dbus
+
 - name: Run dbus-uuidgen to create /var/lib/dbus/machine-id
   shell: dbus-uuidgen --ensure
+  when: var_lib_dbus.stat.exists
 
 - name: Run systemd-machine-id-setup to set /etc/machine-id
   shell: systemd-machine-id-setup