获取错误“无法获取 CSRF";尝试使用 ANSIBLE 安装 jenkins-plugin 时 [英] Gets error "Cannot get CSRF" when trying to install jenkins-plugin using ANSIBLE
本文介绍了获取错误“无法获取 CSRF";尝试使用 ANSIBLE 安装 jenkins-plugin 时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用 ANSIBLE 在 CENTOS 上安装 jenkins.安装工作正常,但是当涉及到安装插件的任务时,我收到以下错误.
I am using ANSIBLE to install jenkins on CENTOS. The installation works fine but when it comes to the task of installing plugin, i get the following error.
fatal: [jenkins]: FAILED! => {"changed": false, "details": "Request failed: <urlopen error [Errno 111] Connection refused>", "failed": true, "msg": "Cannot get CSRF"}
代码如下.
- name: Install jenkins
rpm_key:
state: present
key: https://pkg.jenkins.io/redhat-stable/jenkins.io.key
- name: Add Repository for jenkins
yum_repository:
name: jenkins
description: Repo needed for automatic installation of Jenkins
baseurl: http://pkg.jenkins.io/redhat-stable
gpgcheck: yes
gpgkey: https://pkg.jenkins.io/redhat-stable/jenkins.io.key
#Pre requisite: add key and repo
- name: Install jenkins
yum:
name: jenkins
state: present
#Start/Stop jenkins
- name: Start jenkins service
service:
name: jenkins
state: started
#Start jenkins on startup
- name: Start jenkins on boot
shell: chkconfig jenkins on
- name: Install build-pipeline
jenkins_plugin:
name: build-pipeline-plugin
notify:
- "restart jenkins-service"
推荐答案
为了跳过启动向导,我发现了这个(offcourse google)
In order to skip the startup wizard, I found this (offcourse googling)
- name: Jenkins Skip startUp for MI
lineinfile:
dest=/etc/sysconfig/jenkins
regexp='^JENKINS_JAVA_OPTIONS='
line='JENKINS_JAVA_OPTIONS="-Djava.awt.headless=true -Djenkins.install.runSetupWizard=false"'
register: result_skip_startup_wizard
这篇关于获取错误“无法获取 CSRF";尝试使用 ANSIBLE 安装 jenkins-plugin 时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文