使用Ansible配置Jenkins 2.0 [英] Configure Jenkins 2.0 with Ansible
问题描述
我正在使用Ansible来配置我们的服务器,我安装了Jenkins 2.0,但是当我打开Web UI时,它已具有启动配置.我该如何使用Ansible或shell或jenkins-cli. CentOS 7,Ansible 2.0.1.0. 因此,
I am using Ansible for provision our servers, I installed the Jenkins 2.0 but it is becomeing with a startup configuration when I open the web UI. How can I do it with Ansible or shell or jenkins-cli. CentOS 7, Ansible 2.0.1.0. So,
- 从 http://pkg安装Jenkins 2.0. jenkins-ci.org/redhat-rc/jenkins-2.0-1.1.noarch.rpm rpm.
- 使用yum安装Java.
- 服务启动詹金斯.
- 打开192.168.46.10:8080,这将打开詹金斯一家.
- 在Web UI中添加初始管理员密码.
- 在Web UI中选择并安装插件.
- 在Web UI中创建一个新的管理员用户.
- Installing Jenkins 2.0 from http://pkg.jenkins-ci.org/redhat-rc/jenkins-2.0-1.1.noarch.rpm rpm.
- Install java with yum.
- Service start jenkins.
- Open 192.168.46.10:8080, which is opening the Jenkins.
- In Web UI adding the initial admin password.
- In web UI select and install plugins.
- In web UI create a new admin user.
5、6、7点都是新Jenkins的启动配置.我不知道我们如何自动安装它.
The 5,6,7 points are all the startup config of the new Jenkins. I haven't idea how we can install it autmatically.
1、2、3点已经完成,只是我没有分享,因为没有必要,因为我只需要建议如何配置Jenkins.但是现在我将其添加到我的问题中.
The 1,2,3 point is already done, just I didn't share because it is not necessary, because I only need an advice how can I configure the Jenkins. But now I add it to my question.
---
- name: Jenkins - install | Install java
yum: name=java state=installed
- name: Jenkins - install | Install Jenkins 2.0
yum: pkg=http://pkg.jenkins-ci.org/redhat-rc/jenkins-2.0-1.1.noarch.rpm state=installed
- name: Jenkins - install | Start and enable Jenkins 2.0
service: name=jenkins state=started enabled=yes
推荐答案
我找到了一个解决方案,在我可以更改配置文件之后,请关闭安装向导.
I found a solution, this is turn off the setup wizard, after it I was able to change config files.
- name: Jenkins - configure | Turn off Jenkins setup wizard
lineinfile: dest=/etc/sysconfig/jenkins regexp='^JENKINS_JAVA_OPTIONS=' line='JENKINS_JAVA_OPTIONS="-Djava.awt.headless=true -Djenkins.install.runSetupWizard=false"'
notify: restart jenkins
这篇关于使用Ansible配置Jenkins 2.0的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!