]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-cm-ansible.git/commitdiff
Regenerate random machine UUID before the subscription to satellite 717/head
authorAdam Kraitman <akraitma@redhat.com>
Sun, 15 Jan 2023 15:03:23 +0000 (17:03 +0200)
committerAdam Kraitman <akraitma@redhat.com>
Sun, 15 Jan 2023 15:03:23 +0000 (17:03 +0200)
Fixes: The DMI UUID of this host (XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX) matches other registered hosts
Signed-off-by: Adam Kraitman <akraitma@redhat.com>
roles/common/tasks/rhel-entitlements.yml

index bb15a310421188f800522e18ce3674b1da6b243b..eb8e7ae2a5c0ad8a523bf9d142d8e1e38a287f78 100644 (file)
   command: subscription-manager clean
   when: use_satellite == true
 
+- name: remove host UUID files
+  file:
+    state: absent
+    path: "{{ item }}"
+  with_items:
+    - /var/lib/dbus/machine-id
+    - /etc/machine-id
+    - /etc/rhsm/facts/dmi_system_uuid.facts
+    - /etc/rhsm/facts/katello.facts
+    - /etc/insights-client/machine-id
+  when: use_satellite == true
+
+- name: Generate new UUID
+  shell: uuidgen
+  register: new_uuid
+  when: use_satellite == true
+
+- name: Add new UUID to dmi_system_uuid.facts
+  ansible.builtin.lineinfile:
+    path: /etc/rhsm/facts/dmi_system_uuid.facts
+    create: yes
+    line: |
+      WA{"dmi.system.uuid": "{{ new_uuid.stdout }}"}WA
+  when: use_satellite == true
+
+- name: remove 'WA' PREFIX from dmi_system_uuid.facts
+  replace: dest="/etc/rhsm/facts/dmi_system_uuid.facts" regexp="WA" replace=""
+
+- name: Add fqdn to katello.facts
+  ansible.builtin.lineinfile:
+    path: /etc/rhsm/facts/katello.facts
+    create: yes
+    line: |
+      WA{"network.hostname-override": "{{ ansible_fqdn }}"}WA
+  when: use_satellite == true
+
+- name: remove 'WA' PREFIX from katello.facts
+  replace: dest="/etc/rhsm/facts/katello.facts" regexp="WA" replace=""
+
 - name: Install CA Cert from Satellite Server
   yum:
     name: "{{ satellite_cert_rpm }}"