使用 Ansible 配置 Jenkins 2.0 [英] Configure Jenkins 2.0 with Ansible

查看:21
本文介绍了使用 Ansible 配置 Jenkins 2.0的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 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,

  1. http://pkg 安装 Jenkins 2.0.jenkins-ci.org/redhat-rc/jenkins-2.0-1.1.noarch.rpm rpm.
  2. 使用 yum 安装 java.
  3. 服务启动詹金斯.
  4. 打开 192.168.46.10:8080,即打开 Jenkins.
  5. 在 Web UI 中添加初始管理员密码.
  6. 在 Web UI 中选择并安装插件.
  7. 在 Web UI 中创建一个新的管理员用户.

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:

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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆