On 22.05.2018 18:58, Chris Jefferies wrote:
On any given day I might be accessing different aws systems with
different
sets of FQDNs.
I'm looking for a way to basically templatize (new word?) the hosts
file.
It's called dynamic inventory
Example:
this_track=track4
this_subnet=239
[group1]
ax.$this_track$.ecm ansible_host=10.$this_subnet$.1.5
ansible_ssh_private_key_file=/home/me/.ssh/me_rsa
ca.$this_track$.ecm ansible_host=10.$this_subnet$.1.6
ansible_ssh_private_key_file=/home/me/.ssh/me_rsa
[group2]
if.$this_track$.ecm ansible_host=10.$this_subnet$.1.7
ansible_ssh_private_key_file=/home/me/.ssh/me_rsa
ui.$this_track$.ecm ansible_host=10.$this_subnet$.1.8
ansible_ssh_private_key_file=/home/me/.ssh/me_rsa
Ideally I would set the this_track variable at the top of the playbook
file, but I'd be OK with something like this.
With a custom script you can do all this and more.
https://docs.ansible.com/ansible/latest/user_guide/intro_dynamic_inventory.html
https://docs.ansible.com/ansible/latest/dev_guide/developing_inventory.html
--
Kai Stian Olstad
--
You received this message because you are subscribed to the Google Groups "Ansible
Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/5f909e2738c0990578f356e885a7cd28%40olstad.com.
For more options, visit https://groups.google.com/d/optout.