Skip to content

Commit bede7ae

Browse files
committed
fail fast if ansible-init failed
1 parent 06ae09b commit bede7ae

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

ansible/bootstrap.yml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,16 @@
88
stat:
99
path: /etc/systemd/system/ansible-init.service
1010
register: _stat_ansible_init_unitfile
11-
11+
- name: Check ansible-init status
12+
command: systemctl is-failed ansible-init
13+
register: _ansible_init_failed
14+
failed_when: false # rc != 0 for non-failure!
15+
changed_when: false
16+
- name: Check ansible-init hasn't failed (yet)
17+
# NB: only allows early exit if it has, does not catch future failures!
18+
assert:
19+
that: "'failed' not in _ansible_init_failed.stdout"
20+
fail_msg: "ansible-init has failed - check journalctl -xeu ansible-init"
1221
- name: Wait for ansible-init to finish
1322
wait_for:
1423
path: /var/lib/ansible-init.done

0 commit comments

Comments
 (0)