63 lines
1.6 KiB
YAML
63 lines
1.6 KiB
YAML
---
|
|
#- hosts: yumhosts
|
|
# gather_facts: no
|
|
# tasks:
|
|
# - name: Update all installed packages using YUM module
|
|
# ansible.builtin.yum:
|
|
# use_backend: yum3
|
|
# name: '*'
|
|
# state: latest
|
|
# update_cache: yes
|
|
# update_only: yes
|
|
# register: yum_update_status
|
|
|
|
# - name: Remove packages not needed anymore
|
|
# ansible.builtin.yum:
|
|
# use_backend: yum3
|
|
# autoremove: yes
|
|
|
|
# - name: Reboot when packages were updated
|
|
# reboot:
|
|
# when: yum_update_status.changed
|
|
|
|
- hosts: debianhosts
|
|
gather_facts: no
|
|
tasks:
|
|
# - name: Update apt package cache
|
|
# ansible.builtin.apt:
|
|
# update_cache: yes
|
|
# cache_valid_time: 3600 # Update cache if it's older than 1 hour (3600 seconds)
|
|
|
|
# - name: Upgrade all packages to the latest version
|
|
# ansible.builtin.apt:
|
|
# upgrade: dist # Equivalent to apt-get dist-upgrade
|
|
# force_apt_get: yes # Ensure apt-get is used instead of aptitud
|
|
|
|
# - name: Clean up unused dependencies
|
|
# ansible.builtin.apt:
|
|
# autoremove: yes
|
|
- name: Check if a file exists
|
|
ansible.builtin.stat:
|
|
path: /var/run/reboot-required
|
|
register: reboot_required_file
|
|
|
|
- name: Reboot if required
|
|
ansible.builtin.reboot:
|
|
reboot_timeout: 120 # Adjust timeout as needed
|
|
when: reboot_required_file.stat.exists
|
|
|
|
#- hosts: apkhosts
|
|
# tasks:
|
|
# - name: Update the Package Repositories
|
|
# apk:
|
|
# update_cache: yes
|
|
# - name: Upgrade Packages
|
|
# apk:
|
|
# available: yes
|
|
# upgrade: yes
|
|
#- hosts: ipkg
|
|
# tasks:
|
|
# - name: Update the Packages installed on Diskstation
|
|
# command: /opt/bin/ipkg update && /opt/bin/ipkg upgrade
|
|
#
|