common/test_prep.yml needs to be used as the input parameter to a tool which is called inside of common/test_client_check.yml on each client 'myhosts'.
$ cat testplaybook.yml
---
- hosts: 127.0.0.1
connection: local
gather_facts: False
tasks:
- include: "{{ playbook_dir }}/pb_test.yml myhosts=app_set1"
$ cat pb_test.yml
---
- include: common/test_prep.yml
- include: common/test_client_check.yml
$ cat common/test_prep.yml
---
- hosts: 127.0.0.1
connection: local
gather_facts: false
tasks:
- name: Check authoritative DNS for app datasources
local_action: shell ../bin/dns_check
ignore_errors: true
register: check_results
- debug: var=check_results.stdout_lines[0]
- set_fact: json_as_input_for_next_play={{ check_results.stdout_lines[0] }}
- debug: var=json_as_input_for_next_play
$ cat common/test_client_check.yml
---
- hosts: '{{ myhosts }}'
gather_facts: false
tasks:
# this ruby script returns a Boolean
- name: Check DNS for app datasources on the clients
shell: /usr/local/bin/client-side-lookup json_as_input_for_next_play
sudo: yes
# When running it by hand, the json needs to be surrounded by single quotes:
#client# /usr/local/bin/client-side-lookup '{"db1.example.com":"10.4.4.113","db2.example.com":"10.4.4.114"}'
How do I make this happen? Thank you!
kallen