# ansible\_user and ansible\_port not getting to ssh to vagrant box

**URL:** <https://forum.ansible.com/t/ansible-user-and-ansible-port-not-getting-to-ssh-to-vagrant-box/21692>\
**Category:** Ansible Project\
**Created:** [June 7, 2016, 5:34pm UTC](https://forum.ansible.com/t/ansible-user-and-ansible-port-not-getting-to-ssh-to-vagrant-box/21692 "2016-06-07T17:34:20Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Bala\_V](https://avatars.discourse-cdn.com/v4/letter/b/a88e4f/32.png) [@Bala\_V](https://forum.ansible.com/u/Bala_V)\
**Post date:** [June 7, 2016, 5:34pm UTC](https://forum.ansible.com/t/ansible-user-and-ansible-port-not-getting-to-ssh-to-vagrant-box/21692/1 "2016-06-07T17:34:20Z")

</div>

##### ISSUE TYPE- Bug Report

##### ANSIBLE VERSION

ansible 2.1.0.0

##### CONFIGURATION

test-mac:ansible$ ansible --version  
ansible 2.1.0.0  
config file = /Users/balviswa//ansible.cfg  
configured module search path = Default w/o overrides

##### OS / ENVIRONMENT

mac osx

##### SUMMARY

ssh to port mapping in virtualbox not connecting to right port or using right user specified in command line or hosts file

test-mac:ansible test$ ansible -vvvv -m ping pdit -ansible\_user=test -ansible\_port=3333  
Using /Users/test/ansible/ansible.cfg as config file  
SSH password:  
Loaded callback minimal of type stdout, v2.0  
\<127.0.0.1\> ESTABLISH CONNECTION FOR USER: vagrant on PORT 2222 TO 127.0.0.1  
127.0.0.1 | UNREACHABLE! =\> {  
“changed”: false,  
“msg”: “[Errno None] Unable to connect to port 2222 on 127.0.0.1”,  
“unreachable”: true  
}

##### STEPS TO REPRODUCE1. Install ansible 2.1.0

1. configure hosts file to use ansible\_user= and ansible\_port= to corresponding network mapping in virtual box
2. Test ansible -m ping
3. SSH failure

##### EXPECTED RESULTS

I expect ssh to use value provided in ansible\_user and ansible\_port instead it is using vagrant and port mapping of 2222 from another box.

---

<div class="post-metadata">

**Author:** ![Brian\_Coca](https://avatars.discourse-cdn.com/v4/letter/b/6de8d8/32.png) [@Brian\_Coca](https://forum.ansible.com/u/Brian_Coca)\
**Post date:** [June 7, 2016, 7:01pm UTC](https://forum.ansible.com/t/ansible-user-and-ansible-port-not-getting-to-ssh-to-vagrant-box/21692/2 "2016-06-07T19:01:22Z")

</div>

these are not valid options to the ansible command: -ansible\_user=test -ansible\_port=3333
