Last active
October 3, 2019 06:01
-
-
Save PrashantBhatasana/44e2eca43c3dd33e4e7bdec46ce7a4cf to your computer and use it in GitHub Desktop.
This is ansible host file for my blog https://medium.com/appgambit/configure-jenkins-with-ansible-7bfaa387fb1c
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
--- | |
- name: Demo for SampleApp-Server | |
hosts: | |
- SampleApp-Server | |
gather_facts: true | |
become: yes | |
become_method: sudo | |
tags: [jenkins] | |
tasks: | |
- name: Update the software package repository | |
yum: | |
name: "*" | |
update_cache: yes | |
- name: Install dependencies | |
package: | |
name: "{{ item }}" | |
state: present | |
with_items: | |
- java-1.8.0-openjdk | |
- git | |
- texlive-latex | |
- wget | |
- deltarpm | |
- name: Download jenkins repo | |
command: wget -O /etc/yum.repos.d/jenkins.repo https://pkg.jenkins.io/redhat-stable/jenkins.repo | |
- name: Import Jenkins CI key | |
rpm_key: | |
key: https://pkg.jenkins.io/redhat-stable/jenkins.io.key | |
state: present | |
- name: Install Jenkins | |
yum: | |
name: "jenkins" | |
state: present | |
- name: Allow port 8080 | |
shell: iptables -I INPUT -p tcp --dport 8080 -m state --state NEW,ESTABLISHED -j ACCEPT | |
- name: Start the server | |
service: | |
name: jenkins | |
state: started | |
- wait_for: | |
port: 8080 | |
command: cat /var/lib/jenkins/secrets/initialAdminPassword | |
- name: Get Admin Password | |
become: yes | |
become_method: sudo | |
command: cat /var/lib/jenkins/secrets/initialAdminPassword |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment