# how to execute playbook task on Host-B directly from control machine

**URL:** <https://forum.ansible.com/t/how-to-execute-playbook-task-on-host-b-directly-from-control-machine/36429>\
**Category:** Ansible Project\
**Tags:** awx\
**Created:** [March 12, 2022, 6:17pm UTC](https://forum.ansible.com/t/how-to-execute-playbook-task-on-host-b-directly-from-control-machine/36429 "2022-03-12T18:17:59Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dip\_Giri](https://avatars.discourse-cdn.com/v4/letter/d/c77e96/32.png) [@Dip\_Giri](https://forum.ansible.com/u/Dip_Giri)\
**Post date:** [March 12, 2022, 6:17pm UTC](https://forum.ansible.com/t/how-to-execute-playbook-task-on-host-b-directly-from-control-machine/36429/1 "2022-03-12T18:17:59Z")

</div>

First i have to connect **Host-A** then i can connect **Host-B**. i can’t connect Host-B directly. So in this case how to execute playbook task on **Host-B** from **Control Machine.** Because my control machine is centralised where have running **Ansible AWX.** and i can’t install ansible on Host-A because there have restriction they wouldn’t allow it.

So my question is how to execute playbook task on **Host-B** directly from control machine

 ![Screenshot from 2022-03-12 23-46-07.png](https://us1.discourse-cdn.com/ansible/original/2X/c/c418a43898a2ca60d67e5fcbb5c75a3e302811e3.png)

---

<div class="post-metadata">

**Author:** ![racke](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/racke/32/4767_2.png) [@racke](https://forum.ansible.com/u/racke)\
**Post date:** [March 13, 2022, 12:01pm UTC](https://forum.ansible.com/t/how-to-execute-playbook-task-on-host-b-directly-from-control-machine/36429/2 "2022-03-13T12:01:35Z")

</div>

> First i have to connect \*Host-A\*then i can connect \*Host-B\*. i can’t connect Host-B directly. So in this case how to execute playbook task on \*Host-B \*from \*Control Machine. \*Because my control machine is centralised where have running \*Ansible AWX. \* and i can't install ansible on Host-A because there have restriction they wouldn't allow it.
> 
> So my question is how to execute playbooktask on \*Host-B \*directly from control machine
> 
> Screenshot from 2022-03-12 23-46-07.png

Use Host-A as a jump host, e.g. [https://www.jeffgeerling.com/blog/2022/using-ansible-playbook-ssh-bastion-jump-host](https://www.jeffgeerling.com/blog/2022/using-ansible-playbook-ssh-bastion-jump-host)

Regards  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Racke

---

<div class="post-metadata">

**Author:** ![Dip\_Giri](https://avatars.discourse-cdn.com/v4/letter/d/c77e96/32.png) [@Dip\_Giri](https://forum.ansible.com/u/Dip_Giri)\
**Post date:** [March 14, 2022, 3:11am UTC](https://forum.ansible.com/t/how-to-execute-playbook-task-on-host-b-directly-from-control-machine/36429/3 "2022-03-14T03:11:34Z")

</div>

Thank you sir,

But i have another question -  
How to give private key and there passphrase in this case

```auto
ansible_ssh_common_args='-o ProxyCommand="ssh -p 2222 -W %h:%p -q [username@bastion.example.com](mailto:username@bastion.example.com)"'

```

---

<div class="post-metadata">

**Author:** ![Monica](https://avatars.discourse-cdn.com/v4/letter/m/a183cd/32.png) [@Monica](https://forum.ansible.com/u/Monica)\
**Post date:** [April 2, 2023, 3:41pm UTC](https://forum.ansible.com/t/how-to-execute-playbook-task-on-host-b-directly-from-control-machine/36429/4 "2023-04-02T15:41:42Z")

</div>

Hi Dip Giri,

Did you get the answer of above query I am also facing the same issue.
