how to solve local_action -> unreachable?

45 views
Skip to first unread message

Gabriel Rios

unread,
Jul 31, 2019, 5:34:02 PM7/31/19
to Ansible Project
Hi,

I'm currently experiencing a problem when executing the following playbook. Everything I'm currently executing is attached too. What should I modify? 

---
- hosts: all
vars_files:
- winrms.yml
tasks:
- name: execute locally
local_action:
module: file
path: /home/gabriel/Conex_ansible/reporte.csv
state: touch

It gives the error
fatal: [10.240.30.249]: UNREACHABLE! => {"changed": false, "msg": "ssl: HTTPSConnectionPool(host='localhost', port=5986):
Max retries exceeded with url: /wsman (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object
at 0x7fd25dd28590>: Failed to establish a new connection: [Errno 111] Connection refused',))", "unreachable": true}

I am currently connected to a Windows server, inventory.ini only contains the IP address of said server and winrms.yml contains:
---
ansible_user: user
ansible_password: password
ansible_port: 5986
ansible_connection: winrm
ansible_winrm_server_cert_validation: ignore




Gabriel Rios

unread,
Aug 1, 2019, 1:11:32 PM8/1/19
to Ansible Project
Maybe you've wondered why I don't just set everything to local. My playbook contains other tasks to pull facts from a Windows machine. That's why I have the connection configured for winrm. Then I want to retrieve those facts into a .csv file created locally, which is what is failing.

Update: 

I have used delegate_to: localhost too, without success.

I added this to the playbook expecting to connect to my pc:
- name: change connection
add_host:
hostname: name
ansible_user: myuser
ansible_password: mypassphrase
ansible_port: 22
ansible_connection: ssh
changed_when: true

Seems it doesn't actually change the connection
TASK [change connection] *******************************************************************************************
changed: [10.240.30.249]

TASK [execute locally] *******************************************************************************************
 [WARNING]: No python interpreters found for host 10.240.30.249 (tried ['/usr/bin/python', 'python3.7',
'python3.6', 'python3.5', 'python2.7', 'python2.6', '/usr/libexec/platform-python', '/usr/bin/python3',
'python'])

fatal: [10.240.30.249]: FAILED! => {"ansible_facts": {"discovered_interpreter_python":... and so on.
Reply all
Reply to author
Forward
0 new messages