Install Jenkins LTS via Ansible
Personally, I'd like to use other's work as much as possible in its original state. With ansible roles, authors usually name their repos as 'ansible-role-java' but internally, it's something like 'geerlingguy.java' which is what they put in dependencies. Now, if you simply clone as is, you will need to change the dependencies name.
This is the case with Geerlingguy's jenkins role, where I hit on errors in java due to the name of the dependencies. To preserve Jeff Geerling's work, I had to clone this way:
1git clone --branch 1.8.1 https://github.com/geerlingguy/ansible-role-java.git geerlingguy.java
2git clone --branch 3.5.0 https://github.com/geerlingguy/ansible-role-jenkins.git geerlingguy.jenkins
Then, create symlinks
1ln -s geerlingguy.java ansible-role-java
2ln -s geerlingguy.jenkins ansible-role-jenkins
Now, playbook is (using latest LTS releases)
1---
2- name: Jenkins LTS Installer
3 hosts: all
4
5 vars:
6 java_packages: java-1.8.0-openjdk
7 jenkins_hostname: jenkins-standby.prometdev.com
8 jenkins_repo_url: http://pkg.jenkins-ci.org/redhat-stable/jenkins.repo
9 jenkins_repo_key_url: http://pkg.jenkins-ci.org/redhat-stable/jenkins-ci.org.key
10
11 roles:
12 - role: ansible-role-jenkins
13 become: true