ansible/ansible — pull request #7143 by sivel (2014-04-23 21:20:48+00:00)
Title: Allow sudo to another user from root with the ansible command

##### Issue Type:

Bug Report

##### Ansible Version:

```
ansible 1.6 (devel d88ac5e24d) last updated 2014/04/22 11:14:36 (GMT -500)
```

Issue introduced in f72f5a20df22c9231191d15502a606cef7f2f287

##### Environment:

Control: N/A

Target: N/A

##### Summary:

When using the `ansible` command, with a remote user of `root`, specifying to sudo to another user, will still run the module as `root`.

`ansible-playbook` does not appear to be affected

The issue appears to be some invalid logic in a couple of if statements.

##### Steps To Reproduce:

1. `ansible all -i test.example.com, -u root -k -s -U foobar -a id`

##### Expected Results:

```
uid=1001(foobar) gid=1001(foobar) groups=1001(foobar)
```

##### Actual Results:

```
uid=0(root) gid=0(root) groups=0(root)
```