--- # Written before the container is created, so its rules exist before net0 first comes up with # firewall=1; pve-firewall picks up the change by itself. pmxcfs refuses a chmod to any mode but # 0640, and template cannot create a new file there (its atomic move chmods the 0600 staging file). # Over an existing file it keeps that file's 0640, so the file is created empty first: touch is a # plain open(), and preserving the timestamps keeps it idempotent. Mode omitted: pmxcfs sets it. - name: Create the guest firewall config file # noqa: risky-file-permissions delegate_to: "{{ pve_lxc_node }}" become: true ansible.builtin.file: path: "/etc/pve/firewall/{{ pve_lxc_vmid }}.fw" state: touch modification_time: preserve access_time: preserve - name: Write the guest firewall config # noqa: risky-file-permissions delegate_to: "{{ pve_lxc_node }}" become: true ansible.builtin.template: src: firewall.fw.j2 dest: "/etc/pve/firewall/{{ pve_lxc_vmid }}.fw"