Skip to content

Commit 65c1bfc

Browse files
authored
Merge pull request #61 from stackhpc/wait-cloud-init
Wait for cloud-init to finish running apt update
2 parents 76ecc19 + deab234 commit 65c1bfc

File tree

3 files changed

+24
-7
lines changed

3 files changed

+24
-7
lines changed

ansible/configure-hosts.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
---
2+
- import_playbook: wait-control-host.yml
3+
tags: wait
24
- import_playbook: grow-control-host.yml
35
tags: lvm
46
- import_playbook: deploy-openstack-config.yml

ansible/grow-control-host.yml

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,10 @@
11
---
22
- name: Grow Control Host
33
hosts: ansible_control
4-
gather_facts: false
4+
gather_facts: true
55
vars_files:
66
- vars/defaults.yml
77
tasks:
8-
- name: Ensure hosts are reachable
9-
ansible.builtin.wait_for_connection:
10-
11-
- name: Gather facts
12-
setup:
13-
148
- name: Check LVM status
159
shell:
1610
cmd: vgdisplay | grep -q lvm2

ansible/wait-control-host.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
---
2+
- name: Wait for Control Host to be reachable
3+
hosts: ansible_control
4+
gather_facts: false
5+
vars_files:
6+
- vars/defaults.yml
7+
tasks:
8+
- name: Ensure hosts are reachable
9+
ansible.builtin.wait_for_connection:
10+
11+
# The cloud-final.service unit can run apt update, which acquires the dpkg
12+
# lock and prevents other tasks from acquiring it. Wait for it to finish.
13+
- name: Wait for cloud init to finish
14+
community.general.cloud_init_data_facts:
15+
filter: status
16+
register: cloud_init_result
17+
until:
18+
- cloud_init_result.cloud_init_data_facts.status.v1.stage is defined
19+
- not cloud_init_result.cloud_init_data_facts.status.v1.stage
20+
retries: 72
21+
delay: 5

0 commit comments

Comments
 (0)