HI,
I had some problems with sudo_user switching. Config file not changed.
ansible 1.7.2
test.yml
---
- hosts: test_host.local
remote_user: notroot
tasks:
- name: test1
*sudo_user: test*
shell: whoami
- name: test2
sudo: yes
*sudo_user: test*
shell: whoami
***********************************************************
ansible-playbook test.yml -v
PLAY [test_host.local] *****************************
GATHERING FACTS
***************************************************************
ok: [test_host.local]
TASK: [test1]
*****************************************************************
changed: [test_host.local] => {"changed": true, "cmd": "whoami", "delta":
"0:00:00.002587", "end": "2014-11-24 15:41:03.876659", "rc": 0, "start":
"2014-11-24 15:41:03.874072", "stderr": "", "*stdout": "notroot"*}
TASK: [test2]
*****************************************************************
changed: [test_host.local] => {"changed": true, "cmd": "whoami", "delta":
"0:00:00.002617", "end": "2014-11-24 15:41:04.847170", "rc": 0, "start":
"2014-11-24 15:41:04.844553", "stderr": "", *"stdout": "root"*}
PLAY RECAP
********************************************************************
test_host.local : ok=3 changed=2 unreachable=0 failed=0
***********************************************************
In docs, I saw this example:
http://docs.ansible.com/playbooks_intro.html
You can also login as you, and then sudo to different users than root:
---
- hosts: webservers
remote_user: yourname
sudo: yes
sudo_user: postgres
But as you see it's not quite right.
Help please. How can i execute command under specific user, not root end
not remote user?
--
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/523e4274-c75c-485c-80cb-2f27be2e7ade%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.