I've written this little playbook to show the problem:

- name: test become
  hosts: localhost
  serial: 1
  tasks:
  - name: create test directories
    file: path=/tmp/test/{{ item }} state=directory
    with_items:
    - one
    - two
    delegate_to: localhost
    become: true



It's not very realistic because the delegated host is the same as the 
target host but the problem is the same with any target hosts.

Make a /tmp/test directory with root's permissions only.

If you run this playbook with a non-root user but who has sudo rights, it 
will fail on the second item ("two"). The "one" directory will be created 
correctly.

PLAY [test become] 
*************************************************************

TASK [setup] 
*******************************************************************
ok: [localhost]

TASK [create test directories] 
*************************************************
changed: [localhost -> localhost] => (item=one)
failed: [localhost -> localhost] => (item=two) => {"failed": true, "item": 
"two", "msg": "There was an issue creating /tmp/test/two as requested: 
'module' object has no attribute 'EEXISTS'", "path": "/tmp/test/two", 
"state": "absent"}

PLAY RECAP 
*********************************************************************
localhost                  : ok=1    changed=0    unreachable=0    failed=1 
  


$ ansible-playbook --version
ansible-playbook 2.0.0.2
  config file = /etc/ansible/ansible.cfg
  configured module search path = Default w/o overrides



-- 
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/02888809-5895-478a-b509-40901a4a32cd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to