I’ve playbook A to include roles to conduct an operation. Now I want to create playbook B to import/include playbook A but want to pass ‘hosts’ value to A. In other words, I want to make A to work dynamically with different hosts depending on the playbooks (B/C/D/E/etc.) that include/import it.
I’ve searched around and couldn’t find a good way to do it, I’m running Ansible 2.7.10
I tried in Playbook B like [ -import_playbook playbook-A.yml my-host=‘host_B_name’] (in playbook A [ hosts: {{‘my-host’}}]), but got error: Invalid variable name in vars specified for PlaybookInclude: ‘my-host’ is not a valid variable name
I've playbook A to include roles to conduct an operation. Now I want to create playbook B to import/include playbook A but want to pass 'hosts' value to A. In other words, I want to make A to work dynamically with different hosts depending on the playbooks (B/C/D/E/etc.) that include/import it.
I've searched around and couldn't find a good way to do it, I'm running Ansible 2.7.10
I tried in Playbook B like [ -import_playbook playbook-A.yml my-host='host_B_name'] (in playbook A [ hosts: {{'my-host'}}]), but got error: Invalid variable name in vars specified for PlaybookInclude: 'my-host' is not a valid variable name