Hi,
I’m trying to create containers in Proxmox via ansible and I’ve gotten most of it working. I’m leveraging LXC containers to host Docker containers (since they’re more lightweight, and easier to create). In order to do so, I need to append a few lines in the configuration of the container.
Let’s say I’m creating a LXC container with ID 100, the following lines needs to be added to /etc/pve/lxc/100.conf (courtesy of https://gist.github.com/kvaps/25f730e0ec39dd2e5749fb6b020e71fc)
lxc.apparmor.profile: unconfined
lxc.cgroup.devices.allow: a
lxc.cap.drop:
lxc.mount.auto: proc:rw sys:rw
I have the following task in Ansible
- name: Add configs to LXC for Docker via Proxmox host cfg files
become: true
blockinfile:
path: “/etc/pve/lxc/{{ item }}.conf”
block: |
lxc.apparmor.profile: unconfined
lxc.cgroup.devices.allow: a
lxc.cap.drop:
lxc.mount.auto: proc:rw sys:rw
with_items: - 100
but I get this error
TASK [Add configs to LXC for Docker via Proxmox host cfg files] ********************************************************************************************************************************************
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: OSError: [Errno 1] Operation not permitted: ‘/etc/pve/lxc/.ansible_tmp8TEvvY100.conf’
failed: [192.168.1.6] (item=100) => {“changed”: false, “item”: 100, “msg”: “Failed to replace file: /tmp/tmpuptjyz to /etc/pve/lxc/100.conf: [Errno 1] Operation not permitted: ‘/etc/pve/lxc/.ansible_tmp8TEvvY100.conf’”}
Any help would be appreciated. Thanks!