Add freebsd-update.yml
This commit is contained in:
parent
8f4291721c
commit
b72b07f2ee
62
freebsd-update.yml
Normal file
62
freebsd-update.yml
Normal file
@ -0,0 +1,62 @@
|
|||||||
|
---
|
||||||
|
- hosts: freebsdservers
|
||||||
|
gather_facts: true
|
||||||
|
become: true
|
||||||
|
vars:
|
||||||
|
jails:
|
||||||
|
- aa-torrenting
|
||||||
|
- basejail
|
||||||
|
|
||||||
|
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: Check if updates are ready
|
||||||
|
ansible.builtin.command: freebsd-update updatesready
|
||||||
|
register: updatesready
|
||||||
|
|
||||||
|
- name: Upgrade the system
|
||||||
|
ansible.builtin.command: freebsd-update install
|
||||||
|
register: upgraded
|
||||||
|
when:
|
||||||
|
- updatesready.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: Check if updates are ready in jails
|
||||||
|
ansible.builtin.command: "freebsd-update updatesready -j {{ item }}"
|
||||||
|
register: updatesready_jails
|
||||||
|
with_items: "{{ jails }}"
|
||||||
|
|
||||||
|
- name: Upgrade the jails
|
||||||
|
ansible.builtin.command: "freebsd-update install -j {{ items }}"
|
||||||
|
register: upgraded_jails
|
||||||
|
with_items: "{{ jails }}"
|
||||||
|
when:
|
||||||
|
- updatesready_jails.rc == 0
|
||||||
|
|
||||||
|
- name: Reboot of jail may be necessary
|
||||||
|
ansible.builtin.debug:
|
||||||
|
msg: "A system reboot may be necessary for this jail."
|
||||||
|
when:
|
||||||
|
- upgraded_jails.rc == 0
|
@ -13,6 +13,13 @@ debianservers:
|
|||||||
ansible_host: headscale.headscale.moonshadow.dev
|
ansible_host: headscale.headscale.moonshadow.dev
|
||||||
ansible_python_interpreter: /usr/bin/python3
|
ansible_python_interpreter: /usr/bin/python3
|
||||||
|
|
||||||
|
freebsdservers:
|
||||||
|
hosts:
|
||||||
|
nas:
|
||||||
|
ansible_user: jas
|
||||||
|
ansible_host: nas.headscale.moonshadow.dev
|
||||||
|
ansible_python_interpreter: /usr/local/bin/python3
|
||||||
|
|
||||||
promservers:
|
promservers:
|
||||||
hosts:
|
hosts:
|
||||||
desktop:
|
desktop:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user