Skip to content

Instantly share code, notes, and snippets.

@michaelgugino
Created September 5, 2018 18:00
Show Gist options
  • Select an option

  • Save michaelgugino/4df124b2f03f4086809d8948c844e8cf to your computer and use it in GitHub Desktop.

Select an option

Save michaelgugino/4df124b2f03f4086809d8948c844e8cf to your computer and use it in GitHub Desktop.
How to use variable group_names.
# prerequisites.yml
- hosts: "{{ new_hosts | default('apache_hosts') }}"
tasks:
- do_something
# playbook1.yml
- hosts: "{{ current_apache_hosts | default('apache_hosts') }}"
tasks:
- do_something
# site.yml
- import_playbook: prerequisites.yml
- import_playbook: playbook1.yml
# add_hosts.yml
- import_playbook: prerequisites.yml
vars:
new_hosts: "new_apache_hosts"
- import_playbook: playbook1.yml
vars:
current_apache_hosts: "new_apache_hosts"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment