homeserver/roles/mgrote_proxmox_lxc_profiles/tasks/profile.yml

25 lines
838 B
YAML
Raw Permalink Normal View History

---
- name: set apparmor profile
become: true
ansible.builtin.lineinfile:
path: "/etc/pve/lxc/{{ item.vmid }}.conf"
line: "lxc.apparmor.profile: {{ item.apparmor_profile }}"
state: present
register: restart
# schreibe vm id in die Liste "reboot"
- name: set reboot list # noqa no-handler var-naming[pattern]
become: true
ansible.builtin.set_fact:
ansible.builtin.reboot:
- "{{ item.vmid }}"
when: restart.changed
# Füge die leere Liste "lists_merged" aus den defaults, mit der Liste "reboot" zusammen. Nur wenn auch etwas geändert wurde, daher "when:..."
- name: merge reboot lists # noqa no-handler
become: true
ansible.builtin.set_fact:
lists_merged: "{{ lists_merged + reboot }}"
when: restart.changed
# https://blog.crisp.se/2016/10/20/maxwenzin/how-to-append-to-lists-in-ansible