-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.yml
108 lines (96 loc) · 2.08 KB
/
main.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
---
- name: Mark oh-my-fish installed with /etc/omf.installed
tags:
- fish
ansible.builtin.file:
path: /etc/omf.installed
mode: "0644"
state: touch
become: true
- name: Restart fail2ban
tags:
- security
- fail2ban
ansible.builtin.service:
name: fail2ban
state: restarted
enabled: true
become: true
listen: start fail2ban
- name: Copy file update-grub
tags:
- grub
ansible.builtin.copy:
src: update-grub
dest: /usr/sbin
owner: root
group: root
mode: "0755"
become: true
listen: update grub
- name: Run update grub
tags:
- grub
ansible.builtin.command: update-grub
become: true
listen: update grub
register: grub_output
changed_when: grub_output.rc != 2
- name: Restart ssh
tags:
- security
- ssh
ansible.builtin.service:
name: sshd
state: restarted
become: true
listen: restart ssh
- name: Restart auditd
tags:
- security
- apparmor
ansible.builtin.service:
name: auditd
state: restarted
enabled: true
become: true
- name: Restart apparmor
tags:
- security
- apparmor
ansible.builtin.service:
name: apparmor
state: restarted
enabled: true
become: true
listen: start apparmor
# Tailscale handlers
- name: Restart tailscale service
tags:
- tailscale
ansible.builtin.service:
name: tailscale
state: restarted
enabled: true
become: true
- name: Fetch Tailscale status
listen: Confirm Tailscale is Connected
ansible.builtin.command: tailscale status --json
changed_when: false
register: tailscale_status
- name: Parse status JSON
listen: Confirm Tailscale is Connected
vars:
status: "{{ tailscale_status.stdout | from_json }}"
ansible.builtin.set_fact:
tailscale_is_online: "{{ status.Self.Online }}"
- name: Tailscale online status
listen: Confirm Tailscale is Connected
ansible.builtin.debug:
msg: "Online: {{ tailscale_is_online }}"
when: verbose
- name: Assert Tailscale is Connected
listen: Confirm Tailscale is Connected
ansible.builtin.assert:
that:
- tailscale_is_online