# v2 and dynamically setting ansible\_ssh\_host

**URL:** <https://forum.ansible.com/t/v2-and-dynamically-setting-ansible-ssh-host/18616>\
**Category:** Ansible Developer\
**Created:** [June 26, 2015, 4:11am UTC](https://forum.ansible.com/t/v2-and-dynamically-setting-ansible-ssh-host/18616 "2015-06-26T04:11:54Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tony\_Kinsley](https://avatars.discourse-cdn.com/v4/letter/t/b19c9b/32.png) [@Tony\_Kinsley](https://forum.ansible.com/u/Tony_Kinsley)\
**Post date:** [June 26, 2015, 4:11am UTC](https://forum.ansible.com/t/v2-and-dynamically-setting-ansible-ssh-host/18616/1 "2015-06-26T04:11:54Z")

</div>

This seems like a bug, but I want to check first. I have a role that provisions VMs in an openstack tenancy. One of the tasks the role performs is to update the ansible\_ssh\_host variable with the ip address returned from the nova\_compute or os\_server module. After the role finishes the next play goes and attempts to gather facts on the updated hosts, however it keeps using the value of the inventory\_hostname. This approach worked in previous versions of ansible and its nice, because I can avoid writing a dynamic inventory script.

So here is my hosts file

`

$ cat ostest  
[fun]  
os-test

`

And here is my playbook

`

$ cat os\_test.yml
