Hello, this is my ansible version:
ansible [core 2.20.5]
config file = /home/ansible-dev/ansible-projects/ansible-infra/ansible.cfg
configured module search path = ['/home/ansible-dev/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /home/ansible-dev/.ansible-venv/lib/python3.13/site-packages/ansible
ansible collection location = /home/ansible-dev/.ansible/collections:/usr/share/ansible/collections
executable location = /home/ansible-dev/.ansible-venv/bin/ansible
python version = 3.13.5 (main, Jun 25 2025, 18:55:22) [GCC 14.2.0] (/home/ansible-dev/.ansible-venv/bin/python3)
jinja version = 3.1.6
pyyaml version = 6.0.3 (with libyaml v0.2.5)
And I am trying to use PSRP 0.9.1
I have an issue with a simple playbook that contains only a ping and gathering of os version (Windows Server 2019)
The problem is that if I put connection properties in the inventory or in the playbook, this one works. If I try to put the same parameters in host_vars or group_vars folders (I tried both encrypted o not encrypted vault versions) I have this error:
TASK [Ping WinRM] ***********************************************************************************************************************************************************************************************************************************
task path: /home/ansible-dev/ansible-projects/ansible-infra/playbooks/windows/test_win.yml:7
[ERROR]: Task failed: Failed to connect to the host via ssh: ssh: connect to host 10.39.201.165 port 22: Connection refused
Origin: /home/ansible-dev/ansible-projects/ansible-infra/playbooks/windows/test_win.yml:7:7
5
6 tasks:
7 - name: Ping WinRM
^ column 7
fatal: [tgrp-test]: UNREACHABLE! => {
"changed": false,
"msg": "Task failed: Failed to connect to the host via ssh: ssh: connect to host 10.39.201.165 port 22: Connection refused",
"unreachable": true
}
PLAY RECAP ******************************************************************************************************************************************************************************************************************************************
tgrp-test : ok=0 changed=0 unreachable=1 failed=0 skipped=0 rescued=0 ignored=0
This is my laybook:
---
- name: Test connettività Windows 2019
hosts: cusona_windows
gather_facts: false
vars:
ansible_connection: psrp
ansible_port: 5985
ansible_psrp_auth: ntlm
ansible_user: "foo"
ansible_password: "bar"
ansible_psrp_cert_validation: ignore
tasks:
- name: Ping WinRM
ansible.windows.win_ping:
- name: Info SO
ansible.windows.setup:
- name: Mostra versione
debug:
var: ansible_os_name
This is the inventory occurrence:
tgrp-test ansible_host=10.39.201.165
I have several windows machine out of the domain with their own users and passwords, and I wuold like to avoid to put user and passwords in inventory or in the playbooks.
Can you please help me to understand why I have this behavior?
Thanks in advance.
Very kind regards.
Alessio