-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Proxy Configuration step failure #75
Comments
Hi @Hokonoken |
Hello :)
|
Not sure, maybe this problem with this script |
Normaly the script should create a proxy.xml file to be use by the jenkins.war... |
@Hokonoken Could you please try to update the proxy jinja template with this code import jenkins.model.*
def instance = Jenkins.getInstance()
final String name = "{{ jenkins2_proxy_host }}"
final int port = {{ jenkins2_proxy_port }}
final String userName = "{{ jenkins2_proxy_username }}"
final String password = "{{ jenkins2_proxy_password }}"
final String noProxyHost = "{{ jenkins2_proxy_no_proxy_hosts }}"
if (name != "") {
final def pc = new hudson.ProxyConfiguration(name, port, userName, password, noProxyHost)
instance.proxy = pc
instance.save()
} else {
instance.proxy = null
instance.save()
} |
Hello, I am also running into an issue when I try to run this through my scripts. I get the following error on the "proxy configuration step". PLAY RECAP ********************************************************************************************************************************************* I know my SSH connection works between my two EC2 instances, master/slave. Can someone point me in the right direction. |
Have the same issue. No proxy at all. No changes in the defaults/main.yml
OS: Linux amznlnx2 4.14.262-200.489.amzn2.x86_64 #1 SMP Fri Feb 4 20:34:30 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux, running in VirtualBox. Tried new edition of /templates/jenkins_install_plugins/proxy_configuration.groovy.j2. No luck. |
Same issue ... TASK [lean_delivery.jenkins : Jenkins confuguration] ***************************************************************************************** TASK [lean_delivery.jenkins : include_tasks] ************************************************************************************************* TASK [lean_delivery.jenkins : Proxy Configuration] ******************************************************************************************* |
I'm also experiencing issues with this, except in my case I'm getting an TASK [lean_delivery.jenkins : Proxy Configuration] ******************************************************
task path: /home/akraker/avvale_repos/jenkins/roles/lean_delivery.jenkins/tasks/install_plugins.yml:2
redirecting (type: modules) ansible.builtin.jenkins_script to community.general.jenkins_script
redirecting (type: modules) ansible.builtin.jenkins_script to community.general.jenkins_script
Using module file /usr/local/lib/python3.9/dist-packages/ansible_collections/community/general/plugins/modules/jenkins_script.py
Pipelining is enabled.
<10.0.0.4> ESTABLISH SSH CONNECTION FOR USER: vagrant
<10.0.0.4> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="vagrant"' -o ConnectTimeout=10 -o 'ControlPath="/home/akraker/.ansible/cp/e38b1de10c"' 10.0.0.4 '/bin/sh -c '"'"'sudo -H -S -n -u root /bin/sh -c '"'"'"'"'"'"'"'"'echo BECOME-SUCCESS-cqgxsuuihqpwhuisedpfdvdsppcxkkkk ; /usr/libexec/platform-python'"'"'"'"'"'"'"'"' && sleep 0'"'"''
Escalation succeeded
<10.0.0.4> (1, b'\n{"output": "", "failed": true, "msg": "HTTP error 401 HTTP Error 401: Unauthorized", "invocation": {"module_args": {"url": "http://0.0.0.0:8080", "script": "def host = \'\'\\ndef port = 0\\ndef username = \'\'\\ndef password = \'\'\\ndef noProxyHosts = \'\'\\n\\nif (host != \\"\\") {\\n def proxy = new hudson.ProxyConfiguration(host, port, username, password, noProxyHosts)\\n proxy.save()\\n jenkins.model.Jenkins.instance.proxy = proxy\\n} else {\\n def xmlFile = hudson.ProxyConfiguration.xmlFile\\n xmlFile.delete()\\n jenkins.model.Jenkins.instance.proxy = null\\n}\\n", "user": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER", "password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER", "validate_certs": false, "timeout": 240, "args": null, "url_username": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER", "url_password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER", "force_basic_auth": true}}}\n', b'/tmp/ansible_jenkins_script_payload_nz1_gsu6/ansible_jenkins_script_payload.zip/ansible/module_utils/urls.py:190: CryptographyDeprecationWarning: Python 3.6 is no longer supported by the Python core team. Therefore, support for it is deprecated in cryptography. The next release of cryptography will remove support for Python 3.6.\n')
<10.0.0.4> Failed to connect to the host via ssh: /tmp/ansible_jenkins_script_payload_nz1_gsu6/ansible_jenkins_script_payload.zip/ansible/module_utils/urls.py:190: CryptographyDeprecationWarning: Python 3.6 is no longer supported by the Python core team. Therefore, support for it is deprecated in cryptography. The next release of cryptography will remove support for Python 3.6.
fatal: [rocky8]: FAILED! => {
"changed": false,
"invocation": {
"module_args": {
"args": null,
"force_basic_auth": true,
"password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
"script": "def host = ''\ndef port = 0\ndef username = ''\ndef password = ''\ndef noProxyHosts = ''\n\nif (host != \"\") {\n def proxy = new hudson.ProxyConfiguration(host, port, username, password, noProxyHosts)\n proxy.save()\n jenkins.model.Jenkins.instance.proxy = proxy\n} else {\n def xmlFile = hudson.ProxyConfiguration.xmlFile\n xmlFile.delete()\n jenkins.model.Jenkins.instance.proxy = null\n}\n",
"timeout": 240,
"url": "http://0.0.0.0:8080",
"url_password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
"url_username": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
"user": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
"validate_certs": false
}
},
"msg": "HTTP error 401 HTTP Error 401: Unauthorized",
"output": ""
} Playbook: ---
# Setup Jenkins CI
- name: Install and Configure Jenkins
hosts: all
become: true
roles:
- role: lean_delivery.java
java_distribution: openjdk
java_major_version: 11
transport: repositories
- role: lean_delivery.jenkins I'm targeting a Rocky Linux 8 sandbox VM: [vagrant@rocky8 ~]$ cat /etc/os-release
NAME="Rocky Linux"
VERSION="8.7 (Green Obsidian)"
ID="rocky"
ID_LIKE="rhel centos fedora"
VERSION_ID="8.7"
PLATFORM_ID="platform:el8"
PRETTY_NAME="Rocky Linux 8.7 (Green Obsidian)"
ANSI_COLOR="0;32"
LOGO="fedora-logo-icon"
CPE_NAME="cpe:/o:rocky:rocky:8:GA"
HOME_URL="https://rockylinux.org/"
BUG_REPORT_URL="https://bugs.rockylinux.org/"
ROCKY_SUPPORT_PRODUCT="Rocky-Linux-8"
ROCKY_SUPPORT_PRODUCT_VERSION="8.7"
REDHAT_SUPPORT_PRODUCT="Rocky Linux"
REDHAT_SUPPORT_PRODUCT_VERSION="8.7"
[vagrant@rocky8 ~]$ uname -a
Linux rocky8 4.18.0-425.10.1.el8_7.x86_64 #1 SMP Thu Jan 12 16:32:13 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux WorkaroundIn my case, I've found a workaround. First I need to make sure that the firewall is open so that I can open Jenkins in a browser: [vagrant@rocky8 ~]$ sudo firewall-cmd --add-port=8080/tcp --permanent
success
[vagrant@rocky8 ~]$ sudo firewall-cmd --reload
success Then I'll open Jenkins in a browser at http://<ip_address>:8080 and "Unlock Jenkins" using the [vagrant@rocky8 ~]$ sudo cat /var/lib/jenkins/secrets/initialAdminPassword
92b9f037ba56431fa3f724a7e90c05d8 I setup Jenkins with the default username and password of:
Skip installing recommended plugins and finish the setup wizard. Then if I re-run the playbook it successfully completes the "Proxy Configuration" task. |
TASK [ansible-role-jenkins : Proxy Configuration] ****************************************************************************************************************************************************************************************************************************************************************************************************
task path: /home/cfm/ansible/roles/ansible-role-jenkins/tasks/install_plugins.yml:3
Using module file /usr/lib/python2.7/site-packages/ansible/modules/web_infrastructure/jenkins_script.py
Pipelining is enabled.
ESTABLISH SSH CONNECTION FOR USER: None
SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=10 -o ControlPath=/home/cfm/.ansible/cp/ef04de8b1e SRV0000 '/bin/sh -c '"'"'sudo -H -S -p "[sudo via ansible, key=euyujfparygopguhceypmkxsqfewbdnp] password:" -u root /bin/sh -c '"'"'"'"'"'"'"'"'echo BECOME-SUCCESS-euyujfparygopguhceypmkxsqfewbdnp ; no_proxy='"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'*.*, '"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"' https_proxy=http_proxy=/usr/libexec/platform-python'"'"'"'"'"'"'"'"' && sleep 0'"'"''
Escalation succeeded
(1, '\n{"msg": "HTTP error 404 HTTP Error 404: Not Found", "output": "", "failed": true, "invocation": {"module_args": {"script": "def host = 'proxy.mgnt.zas..ch'\ndef port = 8080\ndef username = '[]'\ndef password = '[]'\ndef noProxyHosts = '[]'\n\nif (host != \"\") {\n def proxy = new hudson.ProxyConfiguration(host, port, username, noProxyHosts)\n proxy.save()\n jenkins.model.Jenkins.instance.proxy = proxy\n} else {\n def xmlFile = hudson.ProxyConfiguration.xmlFile\n xmlFile.delete()\n jenkins.model.Jenkins.instance.proxy = null\n}\n", "url": "http://SERV0000:8080", "user": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER", "timeout": 240, "password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER", "validate_certs": false, "args": null, "url_username": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER", "url_password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER", "force_basic_auth": true}}}\n', '')
Failed to connect to the host via ssh:
fatal: [SERV0000]: FAILED! => {
"changed": false,
"invocation": {
"module_args": {
"args": null,
"force_basic_auth": true,
"password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
"script": "def host = 'proxy..ch'\ndef port = 8080\ndef username = '[]'\ndef password = '[]'\ndef noProxyHosts = '[]'\n\nif (host != "") {\n def proxy = new hudson.ProxyConfiguration(host, port, username, noProxyHosts)\n proxy.save()\n jenkins.model.Jenkins.instance.proxy = proxy\n} else {\n def xmlFile = hudson.ProxyConfiguration.xmlFile\n xmlFile.delete()\n jenkins.model.Jenkins.instance.proxy = null\n}\n",
"timeout": 240,
"url": "http://SERV0000:8080",
"url_password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
"url_username": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
"user": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
"validate_certs": false
}
},
"msg": "HTTP error 404 HTTP Error 404: Not Found",
"output": ""
}
The text was updated successfully, but these errors were encountered: