Need to automate tasks via Bastion server

Hi All,

I have requirement to automate some tasks via ansible playbook, the problem is I cannot go to the serves directly I need to go to remote nodes via bastion node. Could anyone pls help how can I write the same inside inventory.

you can use delegate_to. you could execution nodes strategy.
Ansible delegate_to | How do the Ansible delegate_to works? (educba.com)

awx/execution_nodes.md at devel · ansible/awx (github.com)

this is documentation for execution nodes

Hello Monica,

Here is the article that can explain it better https://github.com/IBM/IBMDeveloper-recipes/blob/main/multiple-jumphosts-in-ansible-tower-part-1/index.md

In the inventory (group or host) you should add this:

for unix

ansible_ssh_common_args: ‘-o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o ProxyCommand=“ssh -W %h:%p -p {{ jh_ssh_port }} {{ jh_ssh_user }}@{{ jh_ip }} -i $JH_SSH_PRIVATE_KEY -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null”’

regards

jose osorio

Hi,
We don’t have any official docs on this exact situation, but this blog post might help point you in the right direction: https://www.jeffgeerling.com/blog/2022/using-ansible-playbook-ssh-bastion-jump-host
-AWX Team

Hi there,
We actually do have docs, I just missed them: https://docs.ansible.com/automation-controller/latest/html/administration/tipsandtricks.html#setting-up-a-jump-host-to-use-with-the-controller
again, good luck!
-AWX Team