I have a "master" ansible playbook in which I call multiple playbooks using "import_playbook". At this point all the variables which are needed in the "child" playbooks are retrieved from the inventory file and this is working.
#master_playbook.yml
- import_playbook: playbook1.yaml
- import_playbook: playbook2.yaml
What I'd like to do is instead of listing the passwords required in the "child" playbooks in the inventory file, I'd like the "master" playbook to prompt the user for the required passwords and then pass those passwords to the "child" playbooks. The "child" playbooks would still retrieve the remaining variables (non-passwords) needed from the inventory file.
I can get the usage of vars_prompt to work and be able to input the passwords, however the part I'm stuck on is being able to then pass those variables from the "master" playbook to the "child" playbooks as part of the "import_playbook" operation.
Looking to accomplish something equivalent to the below, but this does not work.
#master_playbook.yml
-vars_prompt:
- name: "password1"
prompt: "Enter password1"
- name: "password2"
prompt: "Enter password2"
- import_playbook: playbook1.yaml
vars:
password1: "{{ password1 }}"
password2: "{{ password2 }}"
- import_playbook: playbook2.yaml
vars:
password1: "{{ password1 }}"
password2: "{{ password2 }}"