-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjenkins_vm.yaml
executable file
·76 lines (64 loc) · 1.67 KB
/
jenkins_vm.yaml
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
---
- hosts: automation
become: yes
tasks:
# - name: "Server List"
# ansible.builtin.ping:
# register: ping_output
#
# - name: "Ping Output"
# debug:
# msg: "{{ ping_output }}"
#
# - name: "Check Uptime"
# ansible.builtin.command:
# cmd: uptime
# register: uptime_output
#
# - name: "Uptime Output"
# debug:
# var: uptime_output.stdout
#
- name: Install Jenkins
ansible.builtin.dnf:
name:
- java-11-openjdk
- java-11-openjdk-devel
state: present
- name: "Java Version"
ansible.builtin.command:
cmd: java --version
register: java_check
- name: "Java Version Check"
debug:
var: java_check.stdout
- name: "Download Jenkins Repo and Install Key"
ansible.builtin.get_url:
url: https://pkg.jenkins.io/redhat-stable/jenkins.repo
dest: /etc/yum.repos.d/jenkins.repo
- name: "Import Jenkins Key"
ansible.builtin.rpm_key:
state: present
key: https://pkg.jenkins.io/redhat-stable/jenkins.io.key
- name: "Install Jenkins Package"
ansible.builtin.dnf:
name:
- epel-release
- jenkins
state: latest
register: package_installation
- name: "Verify Package Installation"
debug:
var: package_installation
- name: "Start/Enable Jenkins Service and Verify"
ansible.builtin.systemd:
name: jenkins
state: started
enabled: yes
- name: "Verify if Jenkins service is started and enabled or not"
ansible.builtin.command:
cmd: systemctl status jenkins
register: service_verification
- name: "Systemctl Status Logs of Verification"
debug:
var: service_verification