# How to specify ansible user?

**URL:** <https://forum.ansible.com/t/how-to-specify-ansible-user/12602>\
**Category:** Ansible Project\
**Tags:** ubuntu, aws\
**Created:** [March 29, 2013, 10:58pm UTC](https://forum.ansible.com/t/how-to-specify-ansible-user/12602 "2013-03-29T22:58:57Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Yang\_Zhang](https://avatars.discourse-cdn.com/v4/letter/y/96bed5/32.png) [@Yang\_Zhang](https://forum.ansible.com/u/Yang_Zhang)\
**Post date:** [March 29, 2013, 10:58pm UTC](https://forum.ansible.com/t/how-to-specify-ansible-user/12602/1 "2013-03-29T22:58:57Z")

</div>

ssh-agent works fine for normal ssh. For instance, being careful not  
to use use any ssh config (since from many prior mailing list queries  
inheriting the full ssh config has been identified as  
will-not-implement - seems worth mentioning in the docs BTW):

$ ssh -F /dev/null ubuntu@www.aws.slice-data.com echo hello  
hello

But ansible cannot authenticate:

$ head /etc/ansible/hosts  
www.aws.slice-data.com ansible\_ssh\_user=ubuntu  
...

$ ansible www.\* -m ping  
www.aws.slice-data.com | FAILED =\> FAILED: Authentication failed.

When I try -c ssh, I am prompted to enter (which already is added to  
my agent), but all my passphrase entries seem to be ignored/rejected.

$ ansible -c ssh www.\* -m ping  
Enter passphrase for key '/home/yang/sec/slice-west-2.pem':  
Enter passphrase for key '/home/yang/sec/slice-west-2.pem':  
Enter passphrase for key '/home/yang/sec/slice-west-2.pem':  
www.aws.slice-data.com | FAILED =\> failed to transfer file to /ping:

Permission denied (publickey).  
Couldn't read packet: Connection reset by peer

At this point I noticed that the docs say this is a feature for 1.1+  
only. I'm using Ubuntu 12.04 and ansible 1.0 from the Ubuntu PPA  
listed in [http://ansible.cc/docs/gettingstarted.html](http://ansible.cc/docs/gettingstarted.html). I noticed some  
references to 1.1 so I thought maybe the PPA was out of date. However  
the PyPI version is also 1.1. I'm wary of using non-release git  
versions and would prefer to stick with stable releases. Some clarity  
here would be greatly appreciated. Do I need to use the git version  
just to specify a user for a particular host? Is there no other  
workaround?

Also, I'm looking for how to specify a key/ident file, but I can't  
find where in the docs there's a comprehensive listing of options like  
ansible\_ssh\_user/ansible\_ssh\_host/ansible\_ssh\_port. Closest I could  
find is [http://ansible.cc/docs/patterns.html](http://ansible.cc/docs/patterns.html) which just mentions some  
of these in passing. Does a complete listing of options exist?

Thanks for any answers.

---

<div class="post-metadata">

**Author:** ![Yang\_Zhang](https://avatars.discourse-cdn.com/v4/letter/y/96bed5/32.png) [@Yang\_Zhang](https://forum.ansible.com/u/Yang_Zhang)\
**Post date:** [March 29, 2013, 11:00pm UTC](https://forum.ansible.com/t/how-to-specify-ansible-user/12602/2 "2013-03-29T23:00:27Z")

</div>

I tried the git version anyway. I ran:

$ pip install -e git://github.com/ansible/ansible.git#egg=ansible  
...

$ ansible --help  
Traceback (most recent call last):  
&nbsp;&nbsp;File "/home/yang/.virtualenvs/ansible/bin/ansible", line 7, in \<module\>  
&nbsp;&nbsp;&nbsp;&nbsp;execfile(\_\_file\_\_)  
&nbsp;&nbsp;File "/home/yang/.virtualenvs/ansible/src/ansible/bin/ansible", line  
155, in \<module\>  
&nbsp;&nbsp;&nbsp;&nbsp;(options, args) = cli.parse()  
&nbsp;&nbsp;File "/home/yang/.virtualenvs/ansible/src/ansible/bin/ansible", line  
57, in parse  
&nbsp;&nbsp;&nbsp;&nbsp;usage='%prog \<host-pattern\> [options]'  
TypeError: base\_parser() got an unexpected keyword argument 'check\_opts'

Any hints?

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan2](https://avatars.discourse-cdn.com/v4/letter/m/da6949/32.png) [@Michael\_DeHaan2](https://forum.ansible.com/u/Michael_DeHaan2)\
**Post date:** [March 31, 2013, 2:10pm UTC](https://forum.ansible.com/t/how-to-specify-ansible-user/12602/3 "2013-03-31T14:10:49Z")

</div>

Installation instructions are on the documentation site 🙂

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan2](https://avatars.discourse-cdn.com/v4/letter/m/da6949/32.png) [@Michael\_DeHaan2](https://forum.ansible.com/u/Michael_DeHaan2)\
**Post date:** [March 31, 2013, 2:12pm UTC](https://forum.ansible.com/t/how-to-specify-ansible-user/12602/4 "2013-03-31T14:12:08Z")

</div>

1.1 has not yet released. It releases Tuesday and there is no reason  
for you to be wary of using it.

I would say 60%+ of people here run from the development branch all of  
the time and stay up to date with latest. That's the great thing  
about ansible being so easy to run from checkout and having a very  
good backwards compatibility track record.

---

<div class="post-metadata">

**Author:** ![Yang\_Zhang](https://avatars.discourse-cdn.com/v4/letter/y/96bed5/32.png) [@Yang\_Zhang](https://forum.ansible.com/u/Yang_Zhang)\
**Post date:** [April 1, 2013, 5:18pm UTC](https://forum.ansible.com/t/how-to-specify-ansible-user/12602/5 "2013-04-01T17:18:47Z")

</div>

I'm confused. I had already read through the installation  
instructions. They say:

> Via Pip
> 
> Are you a python developer?
> 
> Ansible can be installed via Pip, but when you do so, it will ask to install other dependencies used for optional modes:
> 
> $ sudo easy\_install pip  
> $ sudo pip install ansible

I had already tried that and it also gave me 1.0, which I mentioned in  
my email. If you go look at the PyPI site it just has the 1.0  
release. Hence I tried using the git version which failed.

Still stuck on this.

---

<div class="post-metadata">

**Author:** ![Yang\_Zhang](https://avatars.discourse-cdn.com/v4/letter/y/96bed5/32.png) [@Yang\_Zhang](https://forum.ansible.com/u/Yang_Zhang)\
**Post date:** [April 1, 2013, 5:20pm UTC](https://forum.ansible.com/t/how-to-specify-ansible-user/12602/6 "2013-04-01T17:20:24Z")

</div>

Sorry, I realize in my original email I wrote "the PyPI version is  
also 1.1," which doesn't make sense in the context of the other stuff  
I had written. I meant to write "is also 1.0."

Anyway, still stuck on this.

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan2](https://avatars.discourse-cdn.com/v4/letter/m/da6949/32.png) [@Michael\_DeHaan2](https://forum.ansible.com/u/Michael_DeHaan2)\
**Post date:** [April 1, 2013, 6:48pm UTC](https://forum.ansible.com/t/how-to-specify-ansible-user/12602/7 "2013-04-01T18:48:42Z")

</div>

1.0 is still the current version in pip.

1.1 is available on github and is releasing Tuesday evening.

github install instructions are on the documentation site.

---

<div class="post-metadata">

**Author:** ![Yang\_Zhang](https://avatars.discourse-cdn.com/v4/letter/y/96bed5/32.png) [@Yang\_Zhang](https://forum.ansible.com/u/Yang_Zhang)\
**Post date:** [April 2, 2013, 1:32am UTC](https://forum.ansible.com/t/how-to-specify-ansible-user/12602/8 "2013-04-02T01:32:31Z")

</div>

Thanks, I missed that. You may be aware of this already, but FWIW,  
`pip install -e .` from a project source directory with with a  
setup.py usually installs the package to the active virtualenv by  
referencing the source directories. This is a cleaner/more standard  
way of setting things up for development without further mucking with  
the user's environment variables. (Doesn't work with current ansible  
source, would need to tweak setup.py.)
