jackl0phty.ansible-role-jenkins
Ansible Role: Jenkins CI
This role installs Jenkins CI on RHEL/CentOS and Debian/Ubuntu servers.
Requirements
Make sure curl
is installed on the server.
Role Variables
Here are the variables you can use, along with their default values (found in vars/main.yml
):
jenkins_hostname:
localhost
This is the server's hostname. Usually,localhost
works well. It is used to connect to the Jenkins instance.jenkins_jar_location:
/opt/jenkins-cli.jar
This is where thejenkins-cli.jar
file will be stored. It helps in connecting to Jenkins from the command line.jenkins_plugins:
git
sonar
ssh
These are the Jenkins plugins that will be installed automatically. You can add more plugins later using the Jenkins UI if needed.
jenkins_connection_delay:
5
jenkins_connection_retries:
60
These settings control how long and how many times the script will wait to connect to Jenkins after it starts. The total wait time isdelay * retries
, which means it will wait for a maximum of 300 seconds by default.For RedHat/CentOS (default settings):
- jenkins_repo_url:
http://pkg.jenkins-ci.org/redhat/jenkins.repo
- jenkins_repo_key_url:
http://pkg.jenkins-ci.org/redhat/jenkins-ci.org.key
- jenkins_repo_url:
For Debian (default settings):
- jenkins_repo_url:
deb http://pkg.jenkins-ci.org/debian binary/
- jenkins_repo_key_url:
http://pkg.jenkins-ci.org/debian/jenkins-ci.org.key
- jenkins_repo_url:
By default, this role will install the latest version of Jenkins using the official repositories listed above. You can change these variables to install the current LTS version instead:
For RedHat/CentOS LTS:
- jenkins_repo_url:
http://pkg.jenkins-ci.org/redhat-stable/jenkins.repo
- jenkins_repo_key_url:
http://pkg.jenkins-ci.org/redhat-stable/jenkins-ci.org.key
- jenkins_repo_url:
For Debian/Ubuntu LTS:
- jenkins_repo_url:
deb http://pkg.jenkins-ci.org/debian-stable binary/
- jenkins_repo_key_url:
http://pkg.jenkins-ci.org/debian-stable/jenkins-ci.org.key
- jenkins_repo_url:
Dependencies
- geerlingguy.java
Example Playbook
- hosts: ci-server
vars:
jenkins_hostname: jenkins.example.com
roles:
- { role: geerlingguy.jenkins }
License
MIT / BSD
Author Information
This role was created in 2014 by Jeff Geerling, who also wrote Ansible for DevOps.
ansible-galaxy install jackl0phty.ansible-role-jenkins