Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [fileservers]
- fs01.example.com ansible_ssh_host=192.168.1.1 ip_addr=192.168.1.1
- [dbservers]
- db01.example.com ansible_ssh_host=192.168.1.2 ip_addr=192.168.1.2
- [webservers]
- web01.example.com ansible_ssh_host=192.168.1.3 ip_addr=192.168.1.3
- [cmsservers]
- cms01.example.com ansible_ssh_host=192.168.1.4 ip_addr=192.168.1.4
- - name: create alias facts
- set_fact:
- file_server_alias: hostvars[{{ inventory_hostname }}]['groups']['fileservers'][0] # should get string 'fs01.example.com'
- db_server_alias: hostvars[{{ inventory_hostname }}]['groups']['dbservers'][0] # should get string 'db01.example.com'
- cms_server_alias: hostvars[{{ inventory_hostname }}]['groups']['cmsservers'][0] # should get string 'cms01.example.com'
Add Comment
Please, Sign In to add comment