52 lines
1.3 KiB
YAML
52 lines
1.3 KiB
YAML
---
|
|
- hosts: freebsdservers
|
|
gather_facts: true
|
|
become: true
|
|
vars:
|
|
jails:
|
|
- aa-torrenting
|
|
|
|
tasks:
|
|
- name: Update all installed packages
|
|
community.general.pkgng:
|
|
name: "*"
|
|
state: latest
|
|
|
|
- name: Update all installed packages in jails
|
|
community.general.pkgng:
|
|
name: "*"
|
|
state: latest
|
|
jail: "{{ item }}"
|
|
with_items: "{{ jails }}"
|
|
|
|
- name: Run freebsd-update fetch
|
|
ansible.builtin.command: freebsd-update fetch
|
|
|
|
- name: Upgrade the system
|
|
ansible.builtin.command: freebsd-update install
|
|
register: upgraded
|
|
changed_when: upgraded.rc == 0
|
|
|
|
- name: Reboot may be necessary
|
|
ansible.builtin.debug:
|
|
msg: "A system reboot may be necessary."
|
|
when:
|
|
- upgraded.rc == 0
|
|
|
|
- name: Run freebsd-update fetch on jails
|
|
ansible.builtin.command: "freebsd-update fetch -j {{ item }}"
|
|
with_items: "{{ jails }}"
|
|
|
|
- name: Upgrade the jails
|
|
ansible.builtin.command: "freebsd-update install -j {{ item }}"
|
|
register: upgraded_jails
|
|
changed_when: upgraded_jails.item.rc == 0
|
|
with_items: "{{ jails }}"
|
|
|
|
- name: Reboot of jail may be necessary
|
|
ansible.builtin.debug:
|
|
msg: "A system reboot may be necessary for this jail."
|
|
when:
|
|
- upgraded_jails.item.rc == 0
|
|
with_items: "{{ jails }}"
|