forked from squad12-devops/case-study
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtools-install.yml
More file actions
44 lines (44 loc) · 1.19 KB
/
tools-install.yml
File metadata and controls
44 lines (44 loc) · 1.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
---
- hosts: webservers
become: yes
tasks:
- name: Update and upgrade apt packages
apt:
upgrade: yes
update_cache: yes
cache_valid_time: 86400 #One day
- name: "Install Java"
apt:
name: openjdk-8-jdk
state: present
- hosts: node1
become: yes
tasks:
- name: Update and upgrade apt packages
apt:
upgrade: yes
update_cache: yes
cache_valid_time: 86400 #One day
- name: "Install Java"
apt:
name: openjdk-8-jdk
state: present
- name: "Install Jenkins on Node1"
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: "Check Jenkins is installed"
apt: name=jenkins update_cache=yes
become: yes
- name: "Start the Jenkins service"
service: name=jenkins state=started
- name: "Pause for 10 seconds"
pause:
seconds: 10
- name: "Get Jenkins initial Admin Password"
shell: "cat /var/lib/jenkins/secrets/initialAdminPassword"
changed_when: false
register: result
- name: "Echo the password"
debug:
var: result.stdout