I have a simple Ansible playbook executing against a Windows server and I get this error:
The module ansible.legacy.setup was redirected to ansible.windows.setup, which could not be loaded
This is the playbook:
---
- name: Test get values
hosts: dc
gather_facts: true
become: true
tasks:
- name: Value of inventory_hostname
debug: var={{ inventory_hostname }}
- name: Value of ansible_hostname
debug: var={{ ansible_hostname }}
- name: Value of ansible_user
debug: var={{ ansible_user }}
This is the hosts file:
[dc]
spwawsinfdc01
[dc:vars]
ansible_host=10.11.12.13
ansible_user=username
ansible_port=5986
ansible_connection=winrm
ansible_winrm_scheme=https
ansible_winrm_server_cert_validation=ignore
ansible_winrm_kerberos_delegation=true
I run the playbook with this command:
ansible-playbook -i hosts main.yaml --ask-pass
What is causing this module redirect error?
This module (ansible.windows.setup
) is part of the ansible.windows collection (version 2.4.0
). It seems that you don't have it installed. To install it, use:
ansible-galaxy collection install ansible.windows