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”]}
`