Ensure cloud-init config dir exists

In some cases, it may happen cloud-init isn't installed (on the UC, for
instance).
In such cases, the directory doesn't exist, and ansible fails to push
the file to this location, leading to a deploy error.

Change-Id: I02b8aef9bf8ae73556ade37a20bd0afda2786321
Related-Bug: #1958332
This commit is contained in:
Cédric Jeanneret 2022-01-24 08:58:59 +01:00
parent e23554218c
commit 7d16b0f33f

View File

@ -54,6 +54,11 @@
when: os_net_config_returncode_stat.stat.exists
register: os_net_config_returncode_slurp
- name: Ensure we get cloud-init
stat:
path: /etc/cloud/cloud.cfg.d
register: cloud_init_exists
- name: NetworkConfig
become: true
block:
@ -104,6 +109,8 @@
when:
- NetworkConfig_result.rc is defined
- NetworkConfig_result.rc == 0
- cloud_init_exists.stat.exists
- cloud_init_exists.stat.isdir
# os-net-config currently relies on the legacy network
# so we need to ensure it's enabled on boot. This should