# Running playbook ios\_command through bastion host

**URL:** <https://forum.ansible.com/t/running-playbook-ios-command-through-bastion-host/22305>\
**Category:** Ansible Project\
**Created:** [August 17, 2016, 10:21am UTC](https://forum.ansible.com/t/running-playbook-ios-command-through-bastion-host/22305 "2016-08-17T10:21:32Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Bharath\_Bharadwaj](https://avatars.discourse-cdn.com/v4/letter/b/8edcca/32.png) [@Bharath\_Bharadwaj](https://forum.ansible.com/u/Bharath_Bharadwaj)\
**Post date:** [August 17, 2016, 10:21am UTC](https://forum.ansible.com/t/running-playbook-ios-command-through-bastion-host/22305/1 "2016-08-17T10:21:32Z")

</div>

Hi All,

I have followed instructions on setting up bastion host from this article “[https://gagor.pl/2016/04/use-bastion-host-with-ansible/](https://gagor.pl/2016/04/use-bastion-host-with-ansible/)” while I’m able to connect to my cisco switch through bastion host from a command line by executing “ssh -F ssh\_config bastion” from the playbook I can’t make it go through the bastion host, it still continues to connect directly to the switch, attached below is my playbook.

---

<div class="post-metadata">

**Author:** ![Bharath\_Bharadwaj](https://avatars.discourse-cdn.com/v4/letter/b/8edcca/32.png) [@Bharath\_Bharadwaj](https://forum.ansible.com/u/Bharath_Bharadwaj)\
**Post date:** [August 23, 2016, 6:05am UTC](https://forum.ansible.com/t/running-playbook-ios-command-through-bastion-host/22305/2 "2016-08-23T06:05:59Z")

</div>

Hi, can anyone give a help on this?

---

<div class="post-metadata">

**Author:** ![Kai\_Stian\_Olstad](https://avatars.discourse-cdn.com/v4/letter/k/e19adc/32.png) [@Kai\_Stian\_Olstad](https://forum.ansible.com/u/Kai_Stian_Olstad)\
**Post date:** [August 23, 2016, 8:11am UTC](https://forum.ansible.com/t/running-playbook-ios-command-through-bastion-host/22305/3 "2016-08-23T08:11:05Z")

</div>

connection: local means, run everything on local machine, I guess that's not what you want.

I dont't think IOS has sudo/su, so become: yes might not work either.

---

<div class="post-metadata">

**Author:** ![Bharath\_Bharadwaj](https://avatars.discourse-cdn.com/v4/letter/b/8edcca/32.png) [@Bharath\_Bharadwaj](https://forum.ansible.com/u/Bharath_Bharadwaj)\
**Post date:** [August 23, 2016, 12:15pm UTC](https://forum.ansible.com/t/running-playbook-ios-command-through-bastion-host/22305/4 "2016-08-23T12:15:13Z")

</div>

Thanks,

what should i set the connection as to make sure it goes through the bastion host? I have already setup the ssh config and ansible.cfg with the ssh args, since you mentioned connection= local it won’t go from bastion, i want to change this to go through bastion host.

Thank you.

---

<div class="post-metadata">

**Author:** ![Kai\_Stian\_Olstad](https://avatars.discourse-cdn.com/v4/letter/k/e19adc/32.png) [@Kai\_Stian\_Olstad](https://forum.ansible.com/u/Kai_Stian_Olstad)\
**Post date:** [August 23, 2016, 12:49pm UTC](https://forum.ansible.com/t/running-playbook-ios-command-through-bastion-host/22305/5 "2016-08-23T12:49:54Z")

</div>

ssh which is the default so just remove or comment out the line.

---

<div class="post-metadata">

**Author:** ![Bharath\_Bharadwaj](https://avatars.discourse-cdn.com/v4/letter/b/8edcca/32.png) [@Bharath\_Bharadwaj](https://forum.ansible.com/u/Bharath_Bharadwaj)\
**Post date:** [August 23, 2016, 2:08pm UTC](https://forum.ansible.com/t/running-playbook-ios-command-through-bastion-host/22305/6 "2016-08-23T14:08:33Z")

</div>

Thank you!

It was ssh by default, it is just I did not have paramiko installed on my jump host, once that was done the connectivity was successful.

Regards,
