From 18ec71eeaf9b0666799a3f6280545bf91ba61c8f Mon Sep 17 00:00:00 2001 From: Egor Tensin Date: Wed, 9 Aug 2023 22:14:25 +0200 Subject: cloud_init_wait: parametrize --- roles/cloud_init_wait/defaults/main.yml | 3 +++ roles/cloud_init_wait/tasks/main.yml | 6 +++--- 2 files changed, 6 insertions(+), 3 deletions(-) create mode 100644 roles/cloud_init_wait/defaults/main.yml (limited to 'roles/cloud_init_wait') 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 }}' -- cgit v1.2.3