Here is an example inventory file:
[web_servers]
web_server-1 ansible_ssh_host=xxx ansible_ssh_user=yyy
[ops_servers]
ops_server-1 ansible_ssh_host=xxx ansible_ssh_user=zzz
In addition, the group web_servers
has certain vars in group_vars/web_servers
:
tomcat_jmx_port: 123456
How can I access tomcat_jmx_port
var when working with ops_servers
?
Some of them will probably say that I need a transition group (for example all
) to host shared vars, but this is just an example, in real life there are many vars with which I want to access from ops_servers
, and I want everything to be clear , therefore, tomcat_jmx_port
must remain in the web_servers
group_vars file .
Actually I need a local search.
Any ideal?
Thank you for your help.
source
share