Loop in file template — Ansible module template — Generate hosts file

How to use for loop in Ansible module template to generate/etc/myhosts file with IP address, hostname, and short name from Ansible inventory. Ansible Playbook, Jinja2 template, and with Magic Variables included.

Luca Berton

--

--

--

Luca Berton

I help creative Automation DevOps, Cloud Engineer, System Administrator, and IT Professional to succeed with Ansible Technology to automate more things everyday