Hello,
I want to define a variable for playbook in group_vars/server_genre file. However, I don’t know if Ansible can support something like server_genre@environment syntax notation. Here is the detail:
In inventory/environment:
Hello,
I want to define a variable for playbook in group_vars/server_genre file. However, I don’t know if Ansible can support something like server_genre@environment syntax notation. Here is the detail:
In inventory/environment:
There could be some distinction between both the environments. Can you use gather_facts and get the differentiating value ?
if you are able to get it using gather_facts, you can use set_facts
Example
set_facts:
nfs_server: xyx
when: ansible_distribution= ‘CentOS’
set_fact:
nfs_server: abc
when: ansible_distribution =‘Ubuntu’
Hello,
That construct actually makes sense to me. The fact of Development vs. Production is controlled by their network. We can just create custom fact based on each host IP address, and return customer fact variable. Then we can set nfs_server per that custom fact.
Thanks for showing this tip.