Windows 10 install fails on Install slave jenkins agent TASK - unreachable
ajweitz opened this issue · 3 comments
SUMMARY
Running the role on a windows 10 machine fails on the install slave jenkins agent
task, with unreachable error.
ISSUE TYPE
- Bug Report
COMPONENT NAME
Windows
install slave jenkins agent task
ANSIBLE VERSION
ansible 2.9.7
config file = None
configured module search path = ['/home/valorahpadm/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /usr/local/lib/python3.6/site-packages/ansible
executable location = /usr/local/bin/ansible
python version = 3.6.8 (default, Apr 2 2020, 13:34:55) [GCC 4.8.5 20150623 (Red Hat 4.8.5-39)]
CONFIGURATION
ansible_port=5986
ansible_winrm_transport=ntlm
validate_certs=false
ansible_winrm_server_cert_validation=ignore
ansible_connection=winrm
OS / ENVIRONMENT
CentOS Linux release 7.6.1810 (Core)
STEPS TO REPRODUCE
---
- hosts: playground
roles:
- lean_delivery.jenkins_slave
vars:
master_host: myjenkinsmasterhostname
master_port: 8080
master_username: myjenkinsuser
master_password: "{{ myjenkinsuser_password }}"
slave_windows_workdir: c:\Jenkins
slave_windows_service: jenkins-slave
slave_windows_java_opts: ""
slave_executors_num: 5
slave_windows_labels:
- "windows"
EXPECTED RESULTS
ACTUAL RESULTS
TASK [jenkins_node_install : Install slave jenkins agent] **********************
task path: /opt/jenkins/workspace/ndows_gitlab_jenkinsnode-feature@2/ansible/roles/jenkins_node_install/tasks/Win32NT/agent.yml:2
File lookup using /opt/jenkins/workspace/ndows_gitlab_jenkinsnode-feature@2/ansible/roles/jenkins_node_install/templates/add_windows_slave.groovy.j2 as file
Using module file /usr/local/lib/python3.6/site-packages/ansible/modules/web_infrastructure/jenkins_script.py
Pipelining is enabled.
<localhost> ESTABLISH WINRM CONNECTION FOR USER: **** on PORT 5986 TO localhost
fatal: [ies-tester-w10]: UNREACHABLE! => {
"changed": false,
"msg": "ntlm: HTTPSConnectionPool(host='localhost', port=5986): Max retries exceeded with url: /wsman (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7fde69bcdbe0>: Failed to establish a new connection: [Errno 111] Connection refused',))",
"unreachable": true
}
PLAY RECAP *********************************************************************
ies-tester-w10 : ok=5 changed=0 unreachable=1 failed=0 skipped=1 rescued=0 ignored=0
@ajweitz I don't have an answer for you unfortunately, but I'm curious if you made any progress with using this role to provision a windows jenkins agent? I'm investigating ways to automated windows agent provisioning and wondering if I should bother with this role if it's not fully supported/tested. I use this role on my linux agents and it works just fine.
EDIT: Looking at the code and your error, I'm inclined to think your problem though is that you don't have WINRM set up on your controlled (agent) machine. Have you followed these instructions for setting up your windows machine so that it can be provisioned with Ansible?
@timblaktu No progress, today I tried running it with another agent, and I have the same exact issue.
I do have WinRM set up on my agents, I'm able to run many other playbooks on them without any issue.
The line delegate_to: localhost
inclines to me that this particular piece of code is running on the the ansible machine itself.
At the end it turned out it was due to the way I was running Ansible playbooks.
Instead of defining the --extra-vars in the command itself, I moved the variables of winrm definition to group vars and now it works.