Add check-updates script
This commit is contained in:
parent
1bc3805ded
commit
7b6edbfe44
2 changed files with 39 additions and 0 deletions
23
playbooks/manual/check-updates.yml
Normal file
23
playbooks/manual/check-updates.yml
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
---
|
||||||
|
- hosts: all
|
||||||
|
gather_facts: true
|
||||||
|
tasks:
|
||||||
|
- name: Check updates (Linux)
|
||||||
|
ansible.builtin.command:
|
||||||
|
argv:
|
||||||
|
- dnf
|
||||||
|
- -q
|
||||||
|
- check-update
|
||||||
|
register: result
|
||||||
|
changed_when: result.rc == 100
|
||||||
|
failed_when: result.rc not in [0, 100]
|
||||||
|
when: ansible_os_family == "RedHat"
|
||||||
|
|
||||||
|
- name: Check updates (OpenBSD)
|
||||||
|
ansible.builtin.command:
|
||||||
|
argv:
|
||||||
|
- syspatch
|
||||||
|
- -c
|
||||||
|
register: result
|
||||||
|
changed_when: result.stdout != ""
|
||||||
|
when: ansible_os_family == "OpenBSD"
|
16
scripts/check-updates
Executable file
16
scripts/check-updates
Executable file
|
@ -0,0 +1,16 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
set -eu
|
||||||
|
|
||||||
|
if [ $# -eq 1 ]; then
|
||||||
|
limit="$1"
|
||||||
|
elif [ $# -ne 0 ]; then
|
||||||
|
echo "Usage: $(basename "$0") [hostname]" 1>&2
|
||||||
|
exit 1
|
||||||
|
else
|
||||||
|
limit="all"
|
||||||
|
fi
|
||||||
|
|
||||||
|
cd "$(dirname "$0")/.."
|
||||||
|
|
||||||
|
ansible-playbook playbooks/manual/check-updates.yml -l "$limit"
|
Loading…
Add table
Add a link
Reference in a new issue