ansible-community / molecule-plugins

Collection on molecule plugins
MIT License
115 stars 76 forks source link

Unable to Connect to Windows VM over WinRM using Azure Driver #188

Open milind173 opened 1 year ago

milind173 commented 1 year ago

Issue Description

I'm trying to use the Azure driver with Molecule, to test Ansible windows role on a virtual machine created in Azure Cloud. The Windows virtual machine is successfully created on Azure Cloud with molecule setup. But molecule is unable to connect to the VM over WinRM unless I manually provide the IP address.

Molecule and Ansible details are here below

molecule 5.1.0 using python 3.9 ansible:2.15.2 azure:0.5.0 from molecule_azure delegated:5.1.0 from molecule

error message

fatal: [instance]: UNREACHABLE! => {"changed": false, "msg": "basic: HTTPSConnectionPool(host='instance', port=5986): Max retries exceeded with url: /wsman (Caused by NameResolutionError(\"<urllib3.connection.HTTPSConnection object at 0x7ff698466ee0>: Failed to resolve 'instance' ([Errno -2] Name or service not known)\"))", "unreachable": true}

molecule.yml

---
dependency:
  name: galaxy
driver:
  name: azure

platforms:
  - name: "instance"
    hostname: "win-test-molecule"
    image:
      offer: WindowsServer
      publisher: MicrosoftWindowsServer
      sku: 2019-Datacenter
      version: latest
    managed_disk_type: "Premium_LRS"
    managed_disk_size_gb: "128"

provisioner:
  name: ansible
   connection_options:
     ansible_user: <username>
     ansible_password: <password>
     ansible_connection: winrm
     ansible_port: 5986
     ansible_winrm_scheme: https
     ansible_winrm_transport: basic
     ansible_winrm_server_cert_validation: ignore

verifier:
  name: ansible

Please let me know any further details need from my end.

zhan9san commented 1 year ago

@milind173

Would you please provide the full log?