57 lines
1.1 KiB
YAML
57 lines
1.1 KiB
YAML
---
|
|
- name: Update all VMs
|
|
hosts: all
|
|
gather_facts: false
|
|
strategy: free
|
|
become: true
|
|
|
|
tasks:
|
|
- name: Get Package Manager (RPM?)
|
|
stat:
|
|
path: /usr/bin/dnf
|
|
register:
|
|
dnf
|
|
|
|
- name: Get Package Manager (DEB?)
|
|
stat:
|
|
path: /usr/bin/apt
|
|
register:
|
|
apt
|
|
|
|
- name: Get Package Manager (BSD?)
|
|
stat:
|
|
path: /usr/sbin/pkg
|
|
register:
|
|
bsd
|
|
|
|
- name: Get Package Manager (PAC?)
|
|
stat:
|
|
path: /usr/bin/pacman
|
|
register:
|
|
pac
|
|
|
|
- name: Update RPM systems
|
|
dnf:
|
|
name: "*"
|
|
state: latest
|
|
update_cache: true
|
|
when: dnf.stat.isdir is defined
|
|
|
|
- name: Update DEB systems
|
|
apt:
|
|
name: "*"
|
|
state: latest
|
|
update_cache: yes
|
|
when: apt.stat.isdir is defined
|
|
|
|
- name: Update BSD systems
|
|
shell: "pkg update && pkg upgrade -y"
|
|
when: bsd.stat.isdir is defined
|
|
|
|
- name: Update PAC systems
|
|
shell: "pacman -Syu --noconfirm"
|
|
when: pac.stat.isdir is defined
|
|
|
|
#- name: Reboot systems (Linux)
|
|
#reboot:
|
|
|