homeserver/roles/mgrote.proxmox_lxc_profiles/tasks/profile.yml

25 lines
776 B
YAML
Raw 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
become: true
set_fact:
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
become: true
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