|
- ---
-
- - hosts: localhost
- vars:
- vm_hosts: "{
- {% for hostname in groups.vms %}
- {{hostname|to_json}}: {{
- {
- 'provider': hostvars[hostname].provider,
- 'server_type': hostvars[hostname].server_type,
- } | to_json }},
- {% endfor %} }"
- tasks:
- - name: terraform inventory vars
- copy:
- content:
- vm_hosts: "{{ vm_hosts }}"
- groups: {}
- dest: "{{playbook_dir}}/inventory.auto.tfvars.json"
|