aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2023-08-09 22:14:25 +0200
committerEgor Tensin <Egor.Tensin@gmail.com>2023-08-09 22:14:41 +0200
commit18ec71eeaf9b0666799a3f6280545bf91ba61c8f (patch)
tree06dd7a07f773b0214b301c6fe537ee12080ca191
parentadd cloud_init_wait role (diff)
downloadinfra-ansible-18ec71eeaf9b0666799a3f6280545bf91ba61c8f.tar.gz
infra-ansible-18ec71eeaf9b0666799a3f6280545bf91ba61c8f.zip
cloud_init_wait: parametrize
-rw-r--r--roles/cloud_init_wait/defaults/main.yml3
-rw-r--r--roles/cloud_init_wait/tasks/main.yml6
2 files changed, 6 insertions, 3 deletions
diff --git a/roles/cloud_init_wait/defaults/main.yml b/roles/cloud_init_wait/defaults/main.yml
new file mode 100644
index 0000000..e5971c9
--- /dev/null
+++ b/roles/cloud_init_wait/defaults/main.yml
@@ -0,0 +1,3 @@
+cloud_init_wait_path: /var/lib/cloud/instance/boot-finished
+cloud_init_wait_seconds: 300
+cloud_init_wait_delay: 10
diff --git a/roles/cloud_init_wait/tasks/main.yml b/roles/cloud_init_wait/tasks/main.yml
index 4a69f60..5de51eb 100644
--- a/roles/cloud_init_wait/tasks/main.yml
+++ b/roles/cloud_init_wait/tasks/main.yml
@@ -1,6 +1,6 @@
- name: Wait until cloud-init is finished
ansible.builtin.stat:
- path: /var/lib/cloud/instance/boot-finished
+ path: '{{ cloud_init_wait_path }}'
# WTF? Is this the best way to _just_ check if a file exists?
get_attributes: false
get_checksum: false
@@ -8,5 +8,5 @@
register: boot_finished
until: boot_finished.stat.exists is not false
# About 5 minutes worth of attempts.
- retries: 30
- delay: 10
+ retries: '{{ cloud_init_wait_seconds // cloud_init_wait_delay }}'
+ delay: '{{ cloud_init_wait_delay }}'