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!

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/d3a553e6-9a12-4e34-9b6f-23d9fad28199%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to