Syncing current state.

This commit is contained in:
2021-12-19 21:32:19 -06:00
parent eb39acaa06
commit 94a4736839
20 changed files with 1599 additions and 180 deletions

View File

@@ -1,15 +1,13 @@
---
# patching.yml
#
# This playbook can be used to patch all the servers in an inventory to the latest on the repo servers
# This playbook can be used to patch all the servers in an inventory to the latest software available.
# Because we typically encrypt our disk storage, we don't wait for the connection to become available again.
# Variables:
# - hosts: the host grouper in the inventory -- default: all
# - action: update or upgrade -- default: update
# - delay: minutes to wait after a reboot -- default 5
#
# - target: the host grouper in the inventory -- default: all
#
# Patch then restart a node
- hosts: "{{ hosts | default('all') }}"
- hosts: "{{ target | default('all') }}"
order: sorted
ignore_unreachable: true
serial: 1
@@ -18,7 +16,7 @@
ansible_become_user: root
ansible_become_method: sudo
vars_files:
- "{{ playbook_dir }}/../.vault"
- "{{ lookup('env', 'ANSIBLE_VAULT_FILE') }}"
tasks:
- name: Check /var free percentage
command: /bin/bash -c "df -m /var | tail -n 1 | awk '{ print $5; }' | sed 's/%//' "
@@ -31,22 +29,22 @@
- 90 > {{ df_output.stdout }}
fail_msg: "Not enough free space"
- name: Patching
- name: Patching all packages (ArchLinux)
ignore_errors: yes
yum:
name: '*'
state: latest
when: ansible_os_family == "Archlinux"
pacman:
upgrade: yes
update_cache: yes
# disablerepo: '*'
enablerepo: rhel-7-server-rpms-nist
register: patching_output
- debug:
msg: "{{ patching_output }}"
- name: Patching all packages (Debian)
ignore_errors: yes
when: ansible_os_family == "Debian"
apt:
upgrade: yes
update_cache: yes
- name: Reboot
ignore_errors: yes
reboot:
- name: Wait for reboot
wait_for_connection:
reboot_timeout: 2