Skip to content

Instantly share code, notes, and snippets.

@nasirhm
Created December 7, 2019 04:46
Show Gist options
  • Save nasirhm/52b9a25b2eddd6a832739fe31d70073f to your computer and use it in GitHub Desktop.
Save nasirhm/52b9a25b2eddd6a832739fe31d70073f to your computer and use it in GitHub Desktop.
---
- name: Installing Jenkins by Ansible automation
hosts: localhost
tasks:
- name: Installing Java 8
yum:
name: "java-1.8.0-openjdk"
state: present
become: true
- name: Correcting the Alternative to Change Default Java
alternatives:
name: java
link: /bin/java
path: /usr/lib/jvm/jre-1.8.0-openjdk-1.8.0.232.b09-0.fc31.x86_64/jre/bin/java
- name: Downloading Jenkins from yum repo
get_url:
url: "https://pkg.jenkins.io/redhat-stable/jenkins.repo"
dest: /etc/yum.repos.d/jenkins.repo
become: true
- name: GPG Key
rpm_key:
state: present
key: https://pkg.jenkins.io/redhat-stable/jenkins.io.key
- name: Install Jenkins
yum:
name: jenkins
state: present
# - name: JAVA options for Jenkins
# lineinfile:
# dest= /etc/sysconfig/jenkins regexp= ^JENKINS_JAVA_OPTIONS=line=JENKINS_JAVA_OPTIONS="-Djava.awt.headless=true -Djenkins.install.runSetupWizard=false"
# become: true
- name: Start Jenkins service to Enable on Boot
service:
name: jenkins
state: started
enabled: yes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment