--- - name: get resource group info become: true become_user: root # become_method: runas hosts: localhost roles: - role: azure_createwindowsvm environment: - AZURE_CLIENT_ID: 140ddce1-f5e1-45a3-84e0-38e8ec16e72b - AZURE_SECRET: "{{secret}}" - AZURE_SUBSCRIPTION_ID: "{{((sub_id | split(':'))[1]) | trim }}" # - AZURE_SUBSCRIPTION_ID: a7f4215b-c8f8-45ac-8fdd-062c940b02f6 - AZURE_TENANT: 26845d4f-0cf4-4d08-b717-06b6b7824ec4 tasks: - name: output subscriptionID debug: var: "AZURE_SUBSCRIPTION_ID" - name: make host group from survey hosts list add_host: hostname: "{{nic_info.networkinterfaces[0].ip_configurations[0].private_ip_address}}" groups: new_group ansible_connection: winrm ansible_port: 5985 ansible_winrm_server_cert_validation: ignore ansible_user: ApeAdmin ansible_password: "{{password}}" ansible_winrm_transport: ntlm no_log: True - name: create hostgroup for ad group creation add_host: hostname: awe-mps-006.adagility.net groups: ad_group ansible_connection: winrm ansible_port: 5985 ansible_winrm_server_cert_validation: ignore ansible_user: "{{ansible_user}}" ansible_password: "{{ansible_password}}" ansible_winrm_transport: kerberos no_log: True - name: Onboard vm gather_facts: no hosts: new_group roles: - role: win_ping - role: windows_domain-join - role: windows_finalize ansible_user: "{{ansible_user}}" ansible_password: "{{ansible_password}}" - name: Create admin group gather_facts: hosts: ad_group tasks: - name: Create ad security group for Devices community.windows.win_domain_group: name: G-MGMT-LA-DEVADM-{{ hostname|upper }} path: OU=Local_Admin,OU=Device_Privileges,OU=Management_Groups,OU=Aperam,DC=ADAGILITY,DC=NET domain_username: "{{domain_admin}}" domain_password: "{{domain_password}}" domain_server: awe-dcw-004.adagility.net state: present scope: global ignore_errors: true no_log: true