In my scenario i have inventory of three machines localhost, host2 and
host3. i am using localhost as ansible machine to run my playbooks. I want
to run some tasks/commands on host3 while my ansible playbook is still
playing on host2 *without* *switching* from host2 to host3 - is that
possible? Below might explain what i am trying to achieve:
- name: Playing host2
hosts: host2
become: yes
tasks:
- name: run following commands on host3
local_action: command <command1 for host3>
local_action: command <command2 for host3>
- name: continue to run host2
command: <command for host2>
I tried using delegate_to: host3 but then i am getting *Failed to connect
to the host via ssh*
-name: Playing host2
hosts: host2
become:yes
tasks:
- name: run following commands on host3
shell: <command1>
shell: <command2>
shell: <command3>
delegate_to: host2
remote_user: centos
Can anyone please suggest?
Thanks,
Deepak
--
You received this message because you are subscribed to the Google Groups
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/9bd5a964-d321-4d30-9cde-383262599390%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.