Fix cloud-init detection rules

Do not wait for cloud init, when it's disabled via kernel args.

Change-Id: Ia6618111be285d6883bd7adfa2ac39d205d9fcc3
Signed-off-by: Bogdan Dobrelya <bdobreli@redhat.com>
(cherry picked from commit cef35a45a9)
This commit is contained in:
Bogdan Dobrelya 2022-01-10 15:03:13 +01:00
parent b9a3359181
commit bb608c5f98

View File

@ -12,6 +12,11 @@
failed_when: false failed_when: false
become: true become: true
register: cloud_init_enabled register: cloud_init_enabled
- name: Check if cloud-init is disabled via kernel args
shell: cat /proc/cmdline | grep -q cloud-init=disabled
failed_when: false
check_mode: false
register: cloud_init_vendor_disabled
- name: Wait for cloud-init to finish, if enabled - name: Wait for cloud-init to finish, if enabled
community.general.cloud_init_data_facts: community.general.cloud_init_data_facts:
filter: status filter: status
@ -24,6 +29,7 @@
when: when:
- cloud_init_enabled.rc is defined - cloud_init_enabled.rc is defined
- cloud_init_enabled.rc == 0 - cloud_init_enabled.rc == 0
- cloud_init_vendor_disabled.rc is not defined or cloud_init_vendor_disabled.rc != 0
- name: Create /var/lib/container-puppet - name: Create /var/lib/container-puppet
become: true become: true
no_log: True no_log: True