There are my .j2 template and playbook to generate hostname, fqdn and ipv4 for all manage node
→ vi hosts.j2
{% for i in groups[‘all’] %}
{{ hostvars[i].inventory_hostname }}
{{hostvars[i].ansible_fqdn }}
{{hostvars[i].ansible_default_ipv4.address }}
{% endfor %}
→ vi hosts.yml