- name: Create random names set_fact: storage_account: "{{ resource_group | hash('md5') | truncate(24, True, '') }}" storage_account2: "{{ resource_group | hash('md5') | truncate(18, True, '') }}" vm_name1: "vm1{{ resource_group | hash('md5') | truncate(5, True, '') }}" vm_name2: "vm2{{ resource_group | hash('md5') | truncate(5, True, '') }}" vm_name3: "vm3{{ resource_group | hash('md5') | truncate(5, True, '') }}" vm_name4: "vm4{{ resource_group | hash('md5') | truncate(5, True, '') }}" abs_name1: "avbs1{{ resource_group | hash('md5') | truncate(3, True, '') }}" abs_name2: "avbs2{{ resource_group | hash('md5') | truncate(3, True, '') }}" - name: Create storage account azure_rm_storageaccount: resource_group: "{{ resource_group }}" name: "{{ storage_account }}" account_type: Standard_LRS - name: Create 2nd storage account azure_rm_storageaccount: resource_group: "{{ resource_group }}" name: "{{ storage_account2 }}" account_type: Standard_LRS - name: Create an availability set azure_rm_availabilityset: name: "{{ abs_name1 }}" resource_group: "{{ resource_group }}" - name: Create virtual network azure_rm_virtualnetwork: resource_group: "{{ resource_group }}" name: "{{ vm_name1 }}" address_prefixes: "10.10.0.0/16" - name: Add subnet azure_rm_subnet: resource_group: "{{ resource_group }}" name: "{{ vm_name1 }}" address_prefix: "10.10.0.0/24" virtual_network: "{{ vm_name1 }}" - name: Create public ip azure_rm_publicipaddress: resource_group: "{{ resource_group }}" allocation_method: Static name: "{{ vm_name1 }}" - name: Create security group azure_rm_securitygroup: resource_group: "{{ resource_group }}" name: "{{ vm_name1 }}" purge_rules: yes rules: - name: ALLOW_SSH protocol: Tcp destination_port_range: 22 access: Allow priority: 100 direction: Inbound - name: ALLOW_HTTP protocol: Tcp destination_port_range: 80 access: Allow priority: 110 direction: Inbound - name: Create NIC for single nic VM azure_rm_networkinterface: resource_group: "{{ resource_group }}" name: "{{ vm_name1 }}" virtual_network: "{{ vm_name1 }}" subnet: "{{ vm_name1 }}" public_ip_name: "{{ vm_name1 }}" security_group: "{{ vm_name1 }}"