-
Notifications
You must be signed in to change notification settings - Fork 2
/
jenkins-config.yml
61 lines (50 loc) · 1.49 KB
/
jenkins-config.yml
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 ssl certificates in jenkins
hosts: all
tasks:
- name: install and configure nginx
block:
- name: "APT - install nginx"
apt:
name: nginx
update_cache: yes
- name: copy nginx conf file
template:
src: ../files/nginx/jenkins.nginx.j2
dest: "/etc/nginx/sites-available/jenkins"
- name: copy nginx https conf file
template:
src: ../files/nginx/jenkins.https.nginx.j2
dest: "/etc/nginx/sites-available/jenkinsssl"
- name: copy certificates
copy:
src: "{{item}}"
dest: /etc/ssl/private/
with_items:
- ../files/certs/jenkins/certificate.crt
- ../files/certs/jenkins/private.key
- name: enable jenkins site in nginx
file:
src: "/etc/nginx/sites-available/jenkins"
dest: "/etc/nginx/sites-enabled/jenkins"
state: link
notify: restart nginx
- name: enable jenkinsssl site in nginx
file:
src: "/etc/nginx/sites-available/jenkinsssl"
dest: "/etc/nginx/sites-enabled/jenkinsssl"
state: link
notify: restart nginx
- name: de-activate default nginx site
file:
path: /etc/nginx/sites-enabled/default
state: absent
notify: restart nginx
become: yes
become_user: root
handlers:
- name: restart nginx
service:
name: nginx
state: restarted
become: yes