In this tutorial, we’ll use Ansible to automate the installation of Jenkins CI on a fresh Ubuntu 14.04 LTS and integrate it with the GitHub OAuth. Ansible will also assign the matrix based permission on the Jenkins like which github user or group(s) have what rights on the Jenkins. Beside that, it will also install the Apache which serves as frontend for all the Jenkins requests.
In short, in this tutorial we’ll do the following tasks using Ansible:
Install the JAVA 7
Install the mentioned version of Jenkins(in this case it will be 1.658)
Install the desired plugins
Install the Apache and configure it as frontend for Jenkins
Install the SSL certificate for Apache Virtual Host that act as frontend for Jenkins
Integrate the Jenkins with GitHub using OAuth for Authenication
Configure the matrix based security using the github username or group
Without going into the further details let’s start, first we’ll create the GitHub OAuth credential for integration and for this using the below link(just replace your github Organization name):
Open jenkins/defaults/main.yml and set the values for these variables:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
GITHUB_ORG: Name of your GitHub Organization
GITHUB_CLINT_ID: OAuth Client ID that we have created above
GITHUB_SECRET_ID: OAuth Secret ID that we have created above
GITHUB_OAUTH_SCOPES: Scope of OAuth application
JENKINS_ADMIN_GROUP: GitHub group that can administrate the Jenkins
JENKINS_DEVELOPER_GROUP: GitHub group that is allowed to use this Jenkins(all job or one based on permission)
Then open apache/defaults/main.yml and set the values of these variables:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters