1 #####################################
2 ### someone's ansible provisioner ###
3 #####################################
4 # Part of: https://git.somenet.org/root/pub/somesible.git
5 # 2017-2024 by someone <someone@somenet.org>
8 # The aggressive mode should be followed by or part of a full somesible run.
11 - name: cleanup /var/ansible/.ansible
13 path: "/var/ansible/.ansible"
18 - name: cleanup apt download cache (TEMP)
19 include_tasks: run-command.yml
22 when: 'cleanup_level|int >= 2'
25 - name: cleanup old logfiles (543210 min = 377.23 days)
26 include_tasks: run-command.yml
28 cmd: 'find /var/log/ -type f -mmin +543210 -print -delete'
29 when: 'cleanup_level|int >= 3'
32 - name: cleanup old dist-files
33 include_tasks: run-command.yml
35 cmd: 'find /etc \( -name "*.dpkg-*" -o -name "*.ucf-*" -o -name "*.merge-error" \) -print -delete'
36 when: 'cleanup_level|int >= 5'
39 - name: cleanup old anope db files (543210 min = 377.23 days)
40 include_tasks: run-command.yml
42 cmd: 'find /srv/anope/db/backups -type f -mmin +543210 -print -delete'
43 when: 'cleanup_level|int >= 5'
46 ###################################################
47 # cleanup possibly stale configs generated by us. #
48 ###################################################
49 - name: remove systemd presets
50 include_tasks: run-command.yml
52 cmd: 'rm -vf /etc/systemd/system-preset/*-somesible-*'
53 when: 'cleanup_level|int >= 6'
56 # level 7 can cause issues by skipping over stuff if run at the wrong time.
58 - name: remove all awstat configs
59 include_tasks: run-command.yml
61 cmd: 'rm -vf /etc/awstats/awstats.*.conf'
62 when: 'cleanup_level|int >= 7'
65 # level 9 is expected to cause downtimes + the need to run multiple times/manually start (now/temp.) broken services.
67 - name: remove all vhost configs
68 include_tasks: run-command.yml
70 cmd: 'rm -vf /etc/nginx/sites-enabled/*.vhost'
71 when: 'cleanup_level|int >= 9'