Playbooks I use for my homelab
1---
2- hosts: freebsdservers
3 gather_facts: true
4 become: true
5 vars:
6 jails:
7 - aa-torrenting
8
9 tasks:
10 - name: Update all installed packages
11 community.general.pkgng:
12 name: "*"
13 state: latest
14
15 - name: Update all installed packages in jails
16 community.general.pkgng:
17 name: "*"
18 state: latest
19 jail: "{{ item }}"
20 with_items: "{{ jails }}"
21
22 - name: Fetch and install updates
23 ansible.builtin.shell: freebsd-update fetch install
24 register: updated
25 changed_when: '"No updates are available to install." not in updated.stdout'
26
27 - name: Fetch and install updates in aa-torrenting jail
28 ansible.builtin.shell: freebsd-update -j aa-torrenting fetch install
29 register: updated_aa_torrenting
30 changed_when: '"No updates are available to install." not in updated_aa_torrenting.stdout'