ansible-core/roles/common_tweaks/tasks/main.yml
2024-01-05 15:55:27 +01:00

42 lines
1.1 KiB
YAML

---
# roles/common_tweaks/tasks/main.yml
- name: Find existing files in /etc/update-motd.d
ansible.builtin.find:
paths: /etc/update-motd.d
register: files_to_remove
- name: Remove other files in /etc/update-motd.d
ansible.builtin.file:
path: "{{ item.path }}"
state: absent
with_items: "{{ files_to_remove.files }}"
when: item.path != '/etc/update-motd.d/01-motd'
- name: Copy 01-motd to /etc/update-motd.d on remote host
ansible.builtin.copy:
src: ../files/etc/update-motd.d/01-motd
dest: /etc/update-motd.d/01-motd
mode: '0755'
- name: Ensure /etc/motd is empty
ansible.builtin.copy:
content: ''
dest: /etc/motd
mode: '0644'
- name: Add Proxmox-ID to /etc/environment ({{ proxmox_id }})
ansible.builtin.lineinfile:
path: /etc/environment
regexp: '^PROXMOX_ID='
line: 'PROXMOX_ID={{ proxmox_id }}'
create: yes
state: present
- name: Add a warning comment
ansible.builtin.lineinfile:
path: /etc/environment
insertbefore: "^PROXMOX_ID="
line: "# Do not change the line below - it is set by Ansible"
create: yes
state: present