-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathsystem_update.yml
40 lines (40 loc) · 1.4 KB
/
system_update.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
- hosts: all
gather_facts: yes
become: true
tasks:
- name: Update Arch Linux
pacman:
update_cache: yes
upgrade: yes
when:
- ansible_facts['distribution'] == "Archlinux"
- name: Update APT packages
apt:
upgrade: dist
update_cache: yes
autoclean: yes
when:
- ansible_facts['distribution'] == "Ubuntu"
- name: Update docker-compose stack
shell: docker-compose pull --ignore-pull-failures && docker-compose build --no-cache --pull && docker-compose up -d --force-recreate
args:
chdir: /var/cache/{{ 'chaotic-mirror' if 'mirrors' in group_names else 'garuda-' + (inventory_hostname | lower) }}
when: docker_compose | default(false) == true
- name: Prune unused Docker resources
shell: docker system prune -fa
when: docker_compose | default(false) == true
- import_role:
name: update_repos
- name: Refresh Letsencrypt certificates
docker_container:
image: certbot/dns-cloudflare:latest
name: letsencrypt
auto_remove: true
recreate: yes
container_default_behavior: no_defaults
volumes:
- "{{ letsencrypt_data }}/etc:/etc/letsencrypt"
- "{{ letsencrypt_data }}/var:/var/lib/letsencrypt"
- "/root/.cloudflare:/root/.cloudflare"
command: "certbot renew"
when: letsencrypt_domain is defined