fix: accept cloud-init exit code 2 after first boot
Ubuntu cloud-init returns exit code 2 for some completed boots even when the status output is 'done'. Treat that as a successful wait state so Ansible can continue into the package install phase instead of aborting early.
This commit is contained in:
@@ -7,7 +7,14 @@
|
|||||||
|
|
||||||
- name: Wait for cloud-init to finish first-boot tasks
|
- name: Wait for cloud-init to finish first-boot tasks
|
||||||
command: cloud-init status --wait
|
command: cloud-init status --wait
|
||||||
|
register: cloud_init_wait
|
||||||
changed_when: false
|
changed_when: false
|
||||||
|
failed_when: >-
|
||||||
|
cloud_init_wait.rc not in [0, 2] or
|
||||||
|
(
|
||||||
|
'status: done' not in cloud_init_wait.stdout and
|
||||||
|
'status: disabled' not in cloud_init_wait.stdout
|
||||||
|
)
|
||||||
when: cloud_init_binary.rc == 0
|
when: cloud_init_binary.rc == 0
|
||||||
|
|
||||||
- name: Update apt cache
|
- name: Update apt cache
|
||||||
|
|||||||
Reference in New Issue
Block a user