-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.yml
99 lines (85 loc) · 2.65 KB
/
configure.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
---
- name: Dynamic Inventory
hosts: localhost
gather_facts: false
tasks:
- name: Add Hosts
ansible.builtin.add_host:
name: "{{ dynamic_hostname }}"
groups: self_hosted
tags: ['packages', 'iptables', 'certbot', 'matrix', 'mailserver', 'monitoring']
- name: Configure Personal Services
hosts: self_hosted
gather_facts: true
tasks:
- name: Install Packages
ansible.builtin.import_tasks: tasks/pkg.yml
tags: packages
- name: Configure Iptables
ansible.builtin.import_tasks: tasks/iptables.yml
tags: iptables
- name: Configure Certbot
ansible.builtin.import_tasks: tasks/certbot.yml
tags: certbot
- name: Configure Matrix
ansible.builtin.import_tasks: tasks/matrix.yml
tags: matrix
- name: Configure Mail Server
ansible.builtin.import_tasks: tasks/mailserver.yml
tags: mailserver
- name: Configure Monitoring
ansible.builtin.import_tasks: tasks/monitoring.yml
tags: monitoring
handlers:
- name: Flush iptables
ansible.builtin.iptables:
flush: true
- name: Apply ipv4 iptables rules
community.general.iptables_state:
state: restored
path: /etc/iptables/rules.v4
async: "{{ ansible_timeout }}"
poll: 0
- name: Apply ipv6 iptables rules
community.general.iptables_state:
state: restored
path: /etc/iptables/rules.v6
ip_version: ipv6
async: "{{ ansible_timeout }}"
poll: 0
- name: Restart Docker
ansible.builtin.systemd_service:
name: docker.service
state: restarted
- name: Docker Compose Up - Certbot
community.docker.docker_compose_v2:
project_src: /docker/certbot
state: present
recreate: auto
remove_orphans: true
when: "'certbot' in ansible_tags"
listen: "Docker Compose Up"
- name: Docker Compose Up - Monitoring
community.docker.docker_compose_v2:
project_src: /docker/monitoring
state: present
recreate: auto
remove_orphans: true
when: "'monitoring' in ansible_tags"
listen: "Docker Compose Up"
- name: Docker Compose Up - Matrix
community.docker.docker_compose_v2:
project_src: /docker/matrix
state: present
recreate: auto
remove_orphans: true
when: "'matrix' in ansible_tags"
listen: "Docker Compose Up"
- name: Docker Compose Up - Mail
community.docker.docker_compose_v2:
project_src: /docker/mail
state: present
recreate: auto
remove_orphans: true
when: "'mailserver' in ansible_tags"
listen: "Docker Compose Up"