On Tuesday, March 13, 2018 at 10:35:27 AM UTC-4, Patrick Hunt wrote:
>
> I can help to address #2 at least for now.
>>
>
> Ansible does not allow you to chain "Become" statements.
>

This is true; you cannot use two types or levels of privilege escalation at 
once.
 

>   In other words you cannot log in as user1, become root, and then become 
> user2 (or even user1) in the same play.
>

This is untrue. The privilege escalation settings for each task in a play 
are independent.

- hosts: localhost
  become: true
  tasks:
    - command: whoami
    - command: whoami
      become_user: email
    - command: whoami
      become: false

TASK [command] 
*****************************************************************
changed: [localhost] => {"attempts": 1, "changed": true, "cmd": ["whoami"], 
"delta": "0:00:00.002095", "end": "2018-03-13 12:38:30.764121", "rc": 0, 
"start": "2018-03-13 12:38:30.762026", "stderr": "", "stderr_lines": [], 
"stdout": "root", "stdout_lines": ["root"]}

TASK [command] 
*****************************************************************
changed: [localhost] => {"attempts": 1, "changed": true, "cmd": ["whoami"], 
"delta": "0:00:00.001929", "end": "2018-03-13 12:38:30.889973", "rc": 0, 
"start": "2018-03-13 12:38:30.888044", "stderr": "", "stderr_lines": [], 
"stdout": "email", "stdout_lines": ["email"]}

TASK [command] 
*****************************************************************
changed: [localhost] => {"attempts": 1, "changed": true, "cmd": ["whoami"], 
"delta": "0:00:00.002009", "end": "2018-03-13 12:38:31.004561", "rc": 0, 
"start": "2018-03-13 12:38:31.002552", "stderr": "", "stderr_lines": [], 
"stdout": "ec2-user", "stdout_lines": ["ec2-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 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/7bc4a055-8a29-470f-9d02-e785b1576860%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to