ansible-community / ansible-community/molecule-plugins

Unable to Connect to Windows VM over WinRM using Azure Driver

Open
#188 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
164
Forks
113
Avg merge
4d 20h
Merged PRs (30d)
1

Description

## 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(\": 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:
ansible_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.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the reported molecule.yml configuration and reproduce the Azure Windows VM setup using the shown Molecule, Ansible, and WinRM versions. Compare the failing hostname-based connection with the manually supplied IP address. Done means the Azure driver provides a usable connection target so WinRM succeeds without manually entering the VM IP.

Written by the indexing model from the issue text.

Assessment

Tech stack
azure, python
Domain
cloud, infrastructure, networking
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.