Closed ioc32 closed 9 years ago
Maybe use touch instead? Also, can you update the readme?
So, we're now using touch(1) instead of echo(2). README.md updated too!
Can you give a slightly more detailed example? I still don't understand how to override things :-S
Something like this:
# ansible-playbook -C --tags test stage2.yml
PLAY [localhost] **************************************************************
GATHERING FACTS ***************************************************************
ok: [localhost]
TASK: [touch /etc/pf-custom.conf] *********************************************
skipping: [localhost]
PLAY RECAP ********************************************************************
localhost : ok=1 changed=0 unreachable=0 failed=0
# vim local-vars.yml
# cat local-vars.yml
firewall:
enable_custom_rules: true
# ansible-playbook -C --tags test -e @local-vars.yml stage2.yml
PLAY [localhost] **************************************************************
GATHERING FACTS ***************************************************************
ok: [localhost]
TASK: [touch /etc/pf-custom.conf] *********************************************
changed: [localhost]
PLAY RECAP ********************************************************************
localhost : ok=2 changed=1 unreachable=0 failed=0
I see! Extra karma if you make it an entry in the FAQ ;-)
Let's reword it tomorrow. Mr. Disaronno will help.
LGTM!
Ansible will give the highest priority to those variables provided at the CLI via the -e switch.
This switch accepts YAML or JSON formatted files via '-e @FILE'. This file can be empty.
We can drop an empty local-vars.yml after cloning the repo in bootstrap.sh, which will be ignored via .gitignore.
The key to proper dict overrides is to set hash_behaviour to 'merge' instead of 'replace'. This is more convenient for the user, since individual dictionary keys can be overriden No need to copy the whole dictionary.