19 lines
518 B
YAML
19 lines
518 B
YAML
---
|
|
|
|
- name: Query Azure VMs IPs
|
|
command: az vm list-ip-addresses -o json --resource-group {{ azure_resource_group }}
|
|
register: vm_ip_list_cmd
|
|
|
|
- name: Query Azure VMs Roles
|
|
command: az vm list -o json --resource-group {{ azure_resource_group }}
|
|
register: vm_list_cmd
|
|
|
|
- name: Set VM IP and roles lists
|
|
set_fact:
|
|
vm_ip_list: "{{ vm_ip_list_cmd.stdout }}"
|
|
vm_roles_list: "{{ vm_list_cmd.stdout }}"
|
|
|
|
- name: Generate inventory
|
|
template:
|
|
src: inventory.j2
|
|
dest: "{{ playbook_dir }}/inventory"
|