-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmirror.yml
113 lines (97 loc) · 2.26 KB
/
mirror.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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
---
- hosts: mirror
become: True
vars:
domain: "mirrors.dgplug.org"
email: "[email protected]"
tasks:
- name: install epel-release
yum:
name: "epel-release"
state: latest
- name: install nginx
yum:
name: "nginx"
state: latest
- name: make sure well known directory exists
file:
path: "/var/www/{{ domain }}/.well-known"
state: directory
mode: 0755
- name: install iptables-services
yum:
name: "iptables-services"
state: latest
tags:
- firewall
- name: Copy iptables rules
copy:
src: "iptables"
dest: /etc/sysconfig/iptables
tags:
- firewall
- name: Stop firewalld
systemd:
name: firewalld
state: stopped
enabled: no
tags:
- firewall
- name: Start iptables
systemd:
name: iptables
state: started
enabled: yes
tags:
- firewall
- name: Install certbot
yum:
name: "certbot"
state: latest
tags:
- certbot
- name: Check if certificate exists
stat:
path: "/etc/letsencrypt/live/{{ domain }}/cert.pem"
register: letscert
tags:
- certbot
- name: Stop nginx
systemd:
name: nginx
state: stopped
tags:
- certbot
- name: Get the certbot certificate
shell: certbot certonly --standalone --noninteractive --agree-tos --email {{ email }} -d {{ domain }}
when: not letscert.stat.exists
tags:
- certbot
- name: Install nginx configuration
template:
src: nginx.conf.j2
dest: /etc/nginx/conf.d/{{ domain }}.conf
tags:
- nginx
- name: Restart nginx
systemd:
name: nginx
state: restarted
enabled: yes
tags:
- nginx
- name: Copy cron qubes shell script
copy:
src: "cron-qubes.sh"
dest: "/usr/bin/cron-qubes.sh"
mode: 0700
tags:
- cron
- name: Enable cron job
cron:
name: "run cron job"
hour: "4,16"
minute: "10"
job: "/usr/bin/cron-qubes.sh"
tags:
- cron