# ansible\_ssh\_port behaving differently on v2

**URL:** <https://forum.ansible.com/t/ansible-ssh-port-behaving-differently-on-v2/20133>\
**Category:** Ansible Project\
**Created:** [January 6, 2016, 3:51pm UTC](https://forum.ansible.com/t/ansible-ssh-port-behaving-differently-on-v2/20133 "2016-01-06T15:51:50Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Adham\_H](https://avatars.discourse-cdn.com/v4/letter/a/b2d939/32.png) [@Adham\_H](https://forum.ansible.com/u/Adham_H)\
**Post date:** [January 6, 2016, 3:51pm UTC](https://forum.ansible.com/t/ansible-ssh-port-behaving-differently-on-v2/20133/1 "2016-01-06T15:51:50Z")

</div>

Hey,

I noticed something on v2 not sure if its a bug.

> debug: msg=“{{ ansible\_ssh\_port | default(‘22’) }}”

in v1 if you use above code and your ansible\_ssh\_port is not defined it will fall back to default filter but in v2 it will return any empty string and will not use default

---

<div class="post-metadata">

**Author:** ![Adham\_H](https://avatars.discourse-cdn.com/v4/letter/a/b2d939/32.png) [@Adham\_H](https://forum.ansible.com/u/Adham_H)\
**Post date:** [January 7, 2016, 10:14am UTC](https://forum.ansible.com/t/ansible-ssh-port-behaving-differently-on-v2/20133/2 "2016-01-07T10:14:01Z")

</div>

Ok sorry [http://docs.ansible.com/ansible/playbooks\_variables.html#variable-precedence-where-should-i-put-a-variable](http://docs.ansible.com/ansible/playbooks_variables.html#variable-precedence-where-should-i-put-a-variable) 🙂 v2 ansible\_port
