Eliminate duplicate invocation of roles/handlers 61/14461/1
authorChris Wheeler <chwheele@redhat.com>
Mon, 23 Jun 2025 21:45:54 +0000 (21:45 +0000)
committerJackie Huang <jackie.huang@windriver.com>
Fri, 27 Jun 2025 01:20:08 +0000 (01:20 +0000)
- Only call the ocloud_setup role and ocloud_platform_okd handlers once,
  regardless of the number of hosts in the 'ocloud' group

Change-Id: I7afe9a7376a180d7cc268d055b94a0a29bdbbb1f
Signed-Off-By: Chris Wheeler <chwheele@redhat.com>
Issue-ID: INF-496
(cherry picked from commit 74ef734113989b0f34317cd087f057ec608556e9)

okd/roles/ocloud/tasks/main.yml
okd/roles/ocloud_infra_vm/tasks/main.yml
okd/roles/ocloud_platform_cgu/meta/main.yml [deleted file]
okd/roles/ocloud_platform_hwmgr/meta/main.yml [deleted file]
okd/roles/ocloud_platform_mco/meta/main.yml [deleted file]
okd/roles/ocloud_platform_o2ims/meta/main.yml [deleted file]
okd/roles/ocloud_platform_okd/handlers/main.yml
okd/roles/ocloud_platform_okd/meta/main.yml [deleted file]
okd/roles/ocloud_platform_siteconfig/meta/main.yml [deleted file]
okd/roles/ocloud_platform_stolostron/meta/main.yml [deleted file]

index beef4fd..99be7c6 100644 (file)
@@ -1,4 +1,10 @@
 ---
+- name: Include ocloud_setup role
+  ansible.builtin.import_role:
+    name: "ocloud_setup"
+  delegate_to: "{{ groups['deployer'][0] }}"
+  run_once: true
+
 - name: Include platform role - {{ ocloud_platform }}
   ansible.builtin.import_role:
     name: "ocloud_platform_okd"
@@ -59,4 +65,5 @@
   ansible.builtin.import_role:
     name: "ocloud_platform_hwmgr"
   delegate_to: "{{ groups['deployer'][0] }}"
+  run_once: true
   when: ocloud_platform == "okd"
index 0594ecb..a0aa2a1 100644 (file)
@@ -34,7 +34,7 @@
   when: item.stat.exists
   loop: "{{ ocloud_infra_vm_emulator_stat.results }}"
 
-- name: Create virtual machine - {{ inventory_hostname }}
+- name: Create virtual machine
   community.libvirt.virt:
     command: define
     xml: '{{ lookup("template", "virt.xml.j2") }}'
@@ -55,7 +55,7 @@
   when: ocloud_infra_vm_definition.changed
   become: true
 
-- name: Activate virtual machine - {{ inventory_hostname }}
+- name: Activate virtual machine
   community.libvirt.virt:
     name: "{{ inventory_hostname }}"
     state: running
diff --git a/okd/roles/ocloud_platform_cgu/meta/main.yml b/okd/roles/ocloud_platform_cgu/meta/main.yml
deleted file mode 100644 (file)
index 5b47805..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
----
-dependencies:
-  - role: ocloud_setup
diff --git a/okd/roles/ocloud_platform_hwmgr/meta/main.yml b/okd/roles/ocloud_platform_hwmgr/meta/main.yml
deleted file mode 100644 (file)
index 5b47805..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
----
-dependencies:
-  - role: ocloud_setup
diff --git a/okd/roles/ocloud_platform_mco/meta/main.yml b/okd/roles/ocloud_platform_mco/meta/main.yml
deleted file mode 100644 (file)
index 5b47805..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
----
-dependencies:
-  - role: ocloud_setup
diff --git a/okd/roles/ocloud_platform_o2ims/meta/main.yml b/okd/roles/ocloud_platform_o2ims/meta/main.yml
deleted file mode 100644 (file)
index 5b47805..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
----
-dependencies:
-  - role: ocloud_setup
index ac61e2f..558f252 100644 (file)
@@ -8,4 +8,4 @@
     - bootstrap-complete
     - install-complete
   listen: monitor_platform_deployment
-  run_once: true
+  when: inventory_hostname == groups['ocloud'][0]
diff --git a/okd/roles/ocloud_platform_okd/meta/main.yml b/okd/roles/ocloud_platform_okd/meta/main.yml
deleted file mode 100644 (file)
index 5b47805..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
----
-dependencies:
-  - role: ocloud_setup
diff --git a/okd/roles/ocloud_platform_siteconfig/meta/main.yml b/okd/roles/ocloud_platform_siteconfig/meta/main.yml
deleted file mode 100644 (file)
index 5b47805..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
----
-dependencies:
-  - role: ocloud_setup
diff --git a/okd/roles/ocloud_platform_stolostron/meta/main.yml b/okd/roles/ocloud_platform_stolostron/meta/main.yml
deleted file mode 100644 (file)
index 5b47805..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
----
-dependencies:
-  - role: ocloud_setup