From 8ac8fb3f3309eb7124504beedcd405e38181c082 Mon Sep 17 00:00:00 2001 From: Maximilian Geberl <48486938+dergeberl@users.noreply.github.com> Date: Wed, 6 Sep 2023 15:05:41 +0200 Subject: [PATCH] improve cloud init timeouts (#238) * add cloud-init config for openstack to increase timeout * increase timeout for cloud-init * overwrite initd of cloud-init to allow longer startup times * disable resizefs in cloud-init --- image/cloud-init-10_openstack.cfg | 8 ++++++++ image/cloud-init-initd | 14 ++++++++++++++ image/install-alpine.yaml | 22 ++++++++++++++++++++++ 3 files changed, 44 insertions(+) create mode 100644 image/cloud-init-10_openstack.cfg create mode 100644 image/cloud-init-initd diff --git a/image/cloud-init-10_openstack.cfg b/image/cloud-init-10_openstack.cfg new file mode 100644 index 00000000..aee79621 --- /dev/null +++ b/image/cloud-init-10_openstack.cfg @@ -0,0 +1,8 @@ +datasource_list: ["OpenStack"] +datasource: + OpenStack: +# metadata_urls: ["http://169.254.169.254"] +# max_wait: -1 + timeout: 15 + retries: 10 +# apply_network_config: True diff --git a/image/cloud-init-initd b/image/cloud-init-initd new file mode 100644 index 00000000..9931bfa0 --- /dev/null +++ b/image/cloud-init-initd @@ -0,0 +1,14 @@ +#!/sbin/openrc-run +# add depends for network, dns, fs etc +depend() { + after cloud-init-local + after net + before cloud-config + provide cloud-init + keyword -timeout +} + +start() { + cloud-init init + eend 0 +} diff --git a/image/install-alpine.yaml b/image/install-alpine.yaml index cad084b7..4e2a883b 100644 --- a/image/install-alpine.yaml +++ b/image/install-alpine.yaml @@ -239,6 +239,28 @@ - name: enable keepalivedstats command: "rc-update add keepalivedstats default" + - name: add cloud-init config + copy: + src: ./cloud-init-10_openstack.cfg + dest: /etc/cloud/cloud.cfg.d/10_openstack.cfg + owner: root + group: root + mode: 0644 + + - name: overwrite cloud-init initd file + copy: + src: ./cloud-init-initd + dest: /etc/init.d/cloud-init + owner: root + group: root + mode: 0755 + + - name: disable resizefs in cloud-init + ansible.builtin.lineinfile: + path: /etc/cloud/cloud.cfg + regexp: '^(#)?\s- resizefs.*' + line: '# - resizefs' + - name: enable cloud-config command: "rc-update add cloud-config default" - name: enable cloud-init-local