-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhupendra.yml
More file actions
61 lines (52 loc) · 1.61 KB
/
hupendra.yml
File metadata and controls
61 lines (52 loc) · 1.61 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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
---
- name: Install Nginx and Jenkins
hosts: slave2
become: true
tasks:
- name: Install Nginx on Ubuntu
apt:
name: nginx
state: present
when: ansible_distribution == "Ubuntu"
- name: Install Nginx on CentOS
yum:
name: nginx
state: present
when: ansible_distribution == "CentOS"
- name: Install Jenkins keyring on Ubuntu
shell: curl -fsSL https://pkg.jenkins.io/debian-stable/jenkins.io-2023.key | sudo tee /usr/share/keyrings/jenkins-keyring.asc > /dev/null
when: ansible_distribution == "Ubuntu"
- name: Install Jenkins repository on Ubuntu
shell: echo deb [signed-by=/usr/share/keyrings/jenkins-keyring.asc] https://pkg.jenkins.io/debian-stable binary/ | sudo tee /etc/apt/sources.list.d/jenkins.list > /dev/null
when: ansible_distribution == "Ubuntu"
- name: Install openjdk-11-jdk on Ubuntu
apt:
name: openjdk-11-jdk
state: present
when: ansible_distribution == "Ubuntu"
- name: Update apt package cache
apt:
update_cache: yes
- name: Install Jenkins on Ubuntu
apt:
name: jenkins
state: present
when: ansible_distribution == "Ubuntu"
- name: Install Jenkins on CentOS
yum:
name: jenkins
state: present
when: ansible_distribution == "CentOS"
handlers:
- name: Restart Nginx
service:
name: nginx
state: restarted
- name: Enable Nginx and Jenkins services
service:
name: "{{ item }}"
enabled: true
state: started
loop:
- nginx
- jenkins