From 88a2792eb5e986039502945e152617b36a188d07 Mon Sep 17 00:00:00 2001 From: "Anderson, Craig (ca846m)" Date: Mon, 12 Apr 2021 15:38:52 -0700 Subject: [PATCH] Have cloud-init generate machine-id Change-Id: I616d1f0c6fd03108730f2773974caa54b9c91306 --- .../playbooks/roles/osconfig/tasks/cloud-init.yaml | 11 +++++++++++ .../osconfig/templates/cloud-init-local-overrides.j2 | 2 ++ 2 files changed, 13 insertions(+) create mode 100644 image-builder/assets/playbooks/roles/osconfig/templates/cloud-init-local-overrides.j2 diff --git a/image-builder/assets/playbooks/roles/osconfig/tasks/cloud-init.yaml b/image-builder/assets/playbooks/roles/osconfig/tasks/cloud-init.yaml index d50ee3b..be1c94c 100644 --- a/image-builder/assets/playbooks/roles/osconfig/tasks/cloud-init.yaml +++ b/image-builder/assets/playbooks/roles/osconfig/tasks/cloud-init.yaml @@ -10,3 +10,14 @@ systemd: masked: yes name: ssh.socket + +- name: "Cloud-Init | Ensuring cloud-init overrides directory exists" + file: + path: "/etc/systemd/system/cloud-init-local.service.d" + state: directory + mode: '0755' +- name: "Cloud-Init | Place cloud-init override file" + template: + src: cloud-init-local-overrides.j2 + dest: "/etc/systemd/system/cloud-init-local.service.d/override.conf" + mode: '0644' diff --git a/image-builder/assets/playbooks/roles/osconfig/templates/cloud-init-local-overrides.j2 b/image-builder/assets/playbooks/roles/osconfig/templates/cloud-init-local-overrides.j2 new file mode 100644 index 0000000..136383f --- /dev/null +++ b/image-builder/assets/playbooks/roles/osconfig/templates/cloud-init-local-overrides.j2 @@ -0,0 +1,2 @@ +[Service] +ExecStart=/bin/systemd-machine-id-setup