[ansible-project] Re: Help with blockinfile module running against Proxmox

2018-03-10 Thread saicrazyfire
Hi Troy,

No I didn't get it working before but thank you for posting your solution. 
I will try it out.

Thanks.

On Saturday, March 10, 2018 at 5:03:20 PM UTC-5, Troy Cauble wrote:
>
> I found it.  /etc/pve is a non-posix compliant filesystem
> https://pve.proxmox.com/wiki/Proxmox_Cluster_File_System_(pmxcfs)
> and blockinfile (and many other file modules) do their work in /tmp and 
> end with the
> equivalent of "cp -a" or "cp -p" which fails to /etc/pve.
>
> Workaround is to copy: to /tmp, do blockinfile: there, "command: cp" back.
>
> -troy
>
> On Saturday, March 10, 2018 at 2:56:08 PM UTC-5, Troy Cauble wrote:
>>
>> Did you find a solution?  I'm stuck on the same file.  Different contents 
>> -- I'm doing idmaps, but same file.
>>
>> "msg": "Failed to replace file: /tmp/tmpTzm6Bh to /etc/pve/lxc/100.conf: 
>> [Errno 1] Operation not permitted: 
>> '/etc/pve/lxc/.ansible_tmpONaD0O100.conf'"
>>
>> -troy
>>
>> On Monday, February 19, 2018 at 3:05:43 PM UTC-5, saicrazyfire wrote:
>>>
>>> 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/851e0b3d-d6a1-4be1-91e1-ea51cc05cafc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Help with blockinfile module running against Proxmox

2018-02-19 Thread saicrazyfire
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.