Hi Experts,
I am using below playbook in awx tower getting "skipping: no hosts matched" in second play.The variable are passed from survey.
Variables from tower survey:
source_host
destination_host
file1
file2
Playbook:
---
- hosts: "{{ source_host }}"
become: true
ignore_errors: yes
tasks:
- name: Create file
shell: touch /tmp/"{{file1}}"
- hosts: "{{ destination_host }}"
become: true
ignore_errors: yes
tasks:
- name: Create the file
shell: touch /tmp/"{{file2}}"
Error:
PLAY [node1] *************************************************************
TASK [Gathering Facts] *********************************************************
TASK [Create the file] ****************************************************
PLAY [node2] *************************************************************
skipping: no hosts matched
PLAY RECAP *********************************************************************
node1 : ok=3 changed=1 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0