Skip to content

Instantly share code, notes, and snippets.

@ernesen
Created March 24, 2019 13:48
Show Gist options
  • Save ernesen/b0bf8a6276897d1f712a57e5dbfd274f to your computer and use it in GitHub Desktop.
Save ernesen/b0bf8a6276897d1f712a57e5dbfd274f to your computer and use it in GitHub Desktop.
---
- name: Install Jenkins
hosts: jenkins-ci
gather_facts: false
become: true
tasks:
- name: Ensure the jenkins apt repository key is installed
apt_key:
url: https://pkg.jenkins.io/debian-stable/jenkins.io.key
state: present
- name: Ensure the repository is configured
apt_repository:
repo: deb https://pkg.jenkins.io/debian-stable binary/
state: present
- name: Install Jenkins
apt:
name: jenkins
state: present
- name: Start & Enable Jenkins
service:
name: jenkins
state: started
- name: Sleep for 30 seconds and continue with play
wait_for:
timeout: 30
- name: Get init password Jenkins
shell: cat /var/lib/jenkins/secrets/initialAdminPassword
changed_when: false
register: result
- name: Print init password Jenkins
debug:
var: result.stdout
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment