This one fooled me for a little while because I wasn't paying attention 
(Ansible 1.6.6). 

I ran 

% ansible machine -m file -a 'path=/tmp/jon state=touch mode=0644 
owner=root' 

The file '/tmp/jon' was created, but Ansible returned 

ansible | FAILED >> { 
    "failed": true, 
    "gid": 1000, 
    "group": "jonf", 
    "mode": "0664", 
    "msg": "chown failed", 
    "owner": "jonf", 
    "path": "/tmp/jon", 
    "size": 0, 
    "state": "file", 
    "uid": 1000 
} 

The "FAILED" fooled me, since the file was created. Then I noticed the 
"chown failed" message. This was caused by the fact that the remote user 
isn't root so it can't change owner. 

I was hoping that a simple command like this would either completely 
succeed or completely fail. If it fails, it shouldn't change the state of 
the system it's running on. Instead, it leaves '/tmp/jon' in place, but it 
isn't owned by the specified user. 

One could argue that the file module should fail without doing anything if 
it's told to change ownership of a file, and the module isn't being run as 
root.

Jon 

-- 
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 [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/c984eb3b-5ad0-4d4c-838f-d634dc482d65%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to