Properly handle machine-ids
/etc/machind-id needed to be removed from the image for cloud-init to generate it, no simply blank. /var/lib/dbus/machine-id needed to be symlinked to /etc/machine-id, otherwise dbus was storing its ID into the generic image. Some NIC drivers use this for generating unique MAC addresses, so duplicating these IDs could cause duplicate MAC addressing. Also correct spelling of "finalize". Change-Id: Iaabd0730c4e6d2ae47e5ff1c25adc1b6eb65533b
This commit is contained in:
parent
053c992218
commit
7a99dea948
@ -5,7 +5,7 @@
|
|||||||
owner: root
|
owner: root
|
||||||
group: root
|
group: root
|
||||||
mode: '0644'
|
mode: '0644'
|
||||||
- name: "Finalise | Reset MOTD"
|
- name: "Finalize | Reset MOTD"
|
||||||
file:
|
file:
|
||||||
state: "{{ item }}"
|
state: "{{ item }}"
|
||||||
path: "/etc/update-motd.d/"
|
path: "/etc/update-motd.d/"
|
||||||
@ -15,7 +15,7 @@
|
|||||||
loop:
|
loop:
|
||||||
- absent
|
- absent
|
||||||
- directory
|
- directory
|
||||||
- name: "Finalise | Remove MOTD News config"
|
- name: "Finalize | Remove MOTD News config"
|
||||||
file:
|
file:
|
||||||
state: "absent"
|
state: "absent"
|
||||||
path: "/etc/default/motd-news"
|
path: "/etc/default/motd-news"
|
||||||
|
@ -1,5 +0,0 @@
|
|||||||
- name: "Finalise | Removing .pyc files"
|
|
||||||
shell:
|
|
||||||
cmd: |
|
|
||||||
find "/usr/" "/var/" \( -name "*.pyc" -o -name "__pycache__" \) -delete
|
|
||||||
apt -y clean
|
|
@ -0,0 +1,24 @@
|
|||||||
|
- name: "Finalize | Removing .pyc files"
|
||||||
|
shell:
|
||||||
|
cmd: |
|
||||||
|
find "/usr/" "/var/" \( -name "*.pyc" -o -name "__pycache__" \) -delete
|
||||||
|
apt -y clean
|
||||||
|
|
||||||
|
- name: "Finalize | Ensure no /etc/machine-id is delivered in image"
|
||||||
|
file:
|
||||||
|
path: /etc/machine-id
|
||||||
|
state: absent
|
||||||
|
|
||||||
|
- name: "Finalize | remove /var/lib/dbus/machine-id"
|
||||||
|
file:
|
||||||
|
path: /var/lib/dbus/machine-id
|
||||||
|
state: absent
|
||||||
|
|
||||||
|
- name: "Finalize | symlink /var/lib/dbus/machine-id to /etc/machine-id"
|
||||||
|
file:
|
||||||
|
src: /etc/machine-id
|
||||||
|
dest: /var/lib/dbus/machine-id
|
||||||
|
owner: root
|
||||||
|
group: root
|
||||||
|
state: link
|
||||||
|
force: yes
|
@ -61,5 +61,5 @@
|
|||||||
include_tasks: file-permissions.yaml
|
include_tasks: file-permissions.yaml
|
||||||
|
|
||||||
# Context-independent cleanup tasks
|
# Context-independent cleanup tasks
|
||||||
- name: "finalise rootfs"
|
- name: "finalize rootfs"
|
||||||
include_tasks: finalise-rootfs.yaml
|
include_tasks: finalize-rootfs.yaml
|
||||||
|
@ -1,7 +1,3 @@
|
|||||||
- name: "Systemd | Remove machine id"
|
|
||||||
copy:
|
|
||||||
content: ""
|
|
||||||
dest: "/etc/machine-id"
|
|
||||||
- name: "Systemd | Link systemd to /sbin/init"
|
- name: "Systemd | Link systemd to /sbin/init"
|
||||||
file:
|
file:
|
||||||
src: /bin/systemd
|
src: /bin/systemd
|
||||||
|
Loading…
Reference in New Issue
Block a user