diff --git a/lib/ansible/modules/commands/psexec.py b/lib/ansible/modules/commands/psexec.py index 4a534c63a81..d2e1b47010c 100644 --- a/lib/ansible/modules/commands/psexec.py +++ b/lib/ansible/modules/commands/psexec.py @@ -276,7 +276,7 @@ EXAMPLES = r''' - name: Download and run ConfigureRemotingForAnsible.ps1 to setup WinRM psexec: - hostname: '{{ ansible_host }}' + hostname: '{{ hostvars[inventory_hostname]["ansible_host"] | default(inventory_hostname) }}' connection_username: '{{ ansible_user }}' connection_password: '{{ ansible_password }}' encrypt: yes