Created
April 21, 2017 14:42
-
-
Save kustodian/5bfd237fe134037eb6d522ea649216e9 to your computer and use it in GitHub Desktop.
Ansible include_vars sets host facts (host vars)
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
# host_vars/localhost.yml | |
--- | |
var1: inventory |
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
--- | |
- hosts: localhost | |
gather_facts: no | |
vars: | |
var1: play | |
tasks: | |
- debug: | |
var: var1 | |
- debug: | |
var: hostvars[inventory_hostname].var1 | |
- include_vars: vars.yml | |
- debug: | |
var: var1 | |
- debug: | |
var: hostvars[inventory_hostname].var1 | |
- hosts: localhost | |
gather_facts: no | |
tasks: | |
- debug: | |
var: var1 | |
- debug: | |
var: hostvars[inventory_hostname].var1 |
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
--- | |
var1: include_vars |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment