Good day everyone!
I am trying to provision some LXC in my 4-node Proxmox 7.2 cluster via Ansible using the proxmox module. After much struggle I've been able to provision the container but I am stuck at the firewall configuration. Currently I am trying to template a
If I go to the WebGUI and enable the firewall through the
How am I supposed to overcome this situation? I was thinking of maybe calling the API directly via HTTP, or using an
I am trying to provision some LXC in my 4-node Proxmox 7.2 cluster via Ansible using the proxmox module. After much struggle I've been able to provision the container but I am stuck at the firewall configuration. Currently I am trying to template a
firewall.j2
file into a /etc/pve/firewall/<ctid>.fw
file on the host where the LXC resides, but it's giving me this error:
Code:
The error was: PermissionError: [Errno 1] Operation not permitted: b'/etc/pve/firewall/.ansible_tmprq3twd6j110.fw'
fatal: [nginx2.domain.com -> proxmox2.domain.com(46.4.119.240)]: FAILED! => {"changed": false, "checksum": "0b9846acfc8e004b03866f37d47021c351916bd8", "msg": "Failed to replace file: b'/root/.ansible/t
mp/ansible-tmp-1668374971.1686177-877382-46644331251500/source' to /etc/pve/firewall/110.fw: [Errno 1] Operation not permitted: b'/etc/pve/firewall/.ansible_tmprq3twd6j110.fw'"}
If I go to the WebGUI and enable the firewall through the
Firewall: Options: Firewall: Yes
menu option, then it allows me to overwrite the file with the desired template:
Code:
[OPTIONS]
enable: 1
[RULES]
GROUP ansible -i net0 # Allow access from Ansible controller
GROUP ping_public_ip -i net1 # Allow ping from management IP addresses
GROUP webserver -i net1 # Allow HTTP/HTTPS traffic to Nginx
How am I supposed to overcome this situation? I was thinking of maybe calling the API directly via HTTP, or using an
ansible.builtin.shell
task to run pvesh
, just to enable the option, then continue the playbook. For reference, the task doing the job is this one:
YAML:
- name: builtin | template | deploy firewall configuration
ansible.builtin.template:
src: "templates/provision/firewall.j2"
dest: "/etc/pve/firewall/{{ proxmox_ctid }}.fw"
owner: root
group: www-data
mode: "0640"
delegate_to: proxmox2.domain.com
Last edited: