Here is what my current ansible/
directory looks like:
`
├── development
│ └── hosts
├── production
│ └── hosts
├── group_vars
│ └── prod.example.com
│ └── dev1.example.com
│ └── dev2.example.com
├── playbooks
│ ├── prod.example.com.com
│ │ └── site.yml
│ ├── dev1.example.com.com
│ │ └── site.yml
│ ├── dev2.example.com.com
│ │ └── site.yml
└── roles
├── webservers
├── templates
│ └── main.yml
├── tasks
│ └── main.yml
└── vars
└── main.yml
`
In my roles/webservers/templates/main.yml
, I would reference variables such as
-
http_port
-
document_root
-
server_name
I can easily reference them in myroles/webservers/templates/main.yml
by typing the following into my template: -
{{ http_port }}
-
{{ document_root }}
-
{{ server_name }}
I know when I type it like the above, it references myroles/webservers/vars/main.yml
file; which contain variables for production.
I would like to change the 3 variables if I am referencing my dev1.example.com
and dev2.example.com
environments, but I am unsure on how to do this with using group_vars/dev1.example.com
and group_vars/dev2.example.com