I’m having some issues with variables scope and behavior, simplifying the issue:
I have two environments:
-
production
-
development
which one with several machines and a common role, for example backups.
A variable backup_jobs define which files should be backup and when, so in the production group_vars I set:
machine_a_backup_jobs: …
machine_b_backup_jobs: …
On machine_a group_vars I set:
backup_jobs: “{{ machine_a_backup_jobs }}”
And on machine_b group_vars:
backup_jobs: “{{ machine_b_backup_jobs }}”
In the development group_vars I don’t set these variables since I don’t want backups
the expected behavior was that machine_a_backups and machine_b_backups would be undefined for this environment, instead when I check the variable I see that is replaced as a string:
“backup_jobs”: “{{ machine_a_backup_jobs }}”
ansible --version
ansible 1.8.2