Created
June 21, 2019 14:12
-
-
Save pescobar/7a21d0e065d6b8d204ba09000aa0a49e to your computer and use it in GitHub Desktop.
override ansible host on runtime
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
``` | |
--- | |
- name: Common tasks for dcc-devel servers | |
hosts: "{{ hostsvar | default('host1, host2, host3') }}" | |
gather_facts: True | |
remote_user: root | |
tasks: | |
- name: dummy task | |
command: echo hi | |
``` | |
if you run `ansible-playbook playbook.yml` it will be executed in `host1, host2, host3` but you can override it by doing | |
`ansible-playbook -e hostsvar=newhost playbook.yml` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment