# calling a role and passing it a different host

**URL:** <https://forum.ansible.com/t/calling-a-role-and-passing-it-a-different-host/31318>\
**Category:** Ansible Project\
**Created:** [September 19, 2019, 5:20pm UTC](https://forum.ansible.com/t/calling-a-role-and-passing-it-a-different-host/31318 "2019-09-19T17:20:45Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Spiro\_Mitsialis](https://avatars.discourse-cdn.com/v4/letter/s/c57346/32.png) [@Spiro\_Mitsialis](https://forum.ansible.com/u/Spiro_Mitsialis)\
**Post date:** [September 19, 2019, 5:20pm UTC](https://forum.ansible.com/t/calling-a-role-and-passing-it-a-different-host/31318/1 "2019-09-19T17:20:45Z")

</div>

I have playbook that is running for a network switch. From within this playbook, I want to call a role which will run a IOS Ansible module but the host should be a different device (host). The different device is its upstream neighbor which the first playbook gets doing a URI call to a database. I dont have the information before the URI call.  
Both devices are listed in my hosts inventory file.  
I have tried listing the new host in the role/vars/main.yml file but it still sees the first network switch.  
hosts: xxxxxxx

I have also tried specifying hosts when calling the role:

- name: call manage trunk vlans  
include\_role:  
name: manage\_trunk\_vlans  
vars:  
hosts: burnside-lab-srp.gw.mcgill.ca
