Updating Ubiqtorate
This commit is contained in:
62
playbooks/geth-major-patch.yml
Normal file
62
playbooks/geth-major-patch.yml
Normal file
@@ -0,0 +1,62 @@
|
||||
---
|
||||
# patching.yml
|
||||
#
|
||||
# This playbook can be used to patch all the servers in an inventory to the latest on the repo servers
|
||||
# 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
|
||||
#
|
||||
#
|
||||
# Patch then restart a node
|
||||
- hosts: "{{ targetlist | default('all') }}"
|
||||
order: sorted
|
||||
ignore_unreachable: true
|
||||
serial: 1
|
||||
vars:
|
||||
ansible_become: yes
|
||||
ansible_become_user: root
|
||||
ansible_become_method: sudo
|
||||
oldmajor: stretch
|
||||
newmajor: buster
|
||||
tasks:
|
||||
- name: Check /var free percentage
|
||||
command: /bin/bash -c "df -m /var | tail -n 1 | awk '{ print $5; }' | sed 's/%//' "
|
||||
become: no
|
||||
register: df_output
|
||||
|
||||
- name: Verify /var space
|
||||
assert:
|
||||
that:
|
||||
- 90 > {{ df_output.stdout }}
|
||||
fail_msg: "Not enough free space"
|
||||
|
||||
- apt:
|
||||
name: python-apt
|
||||
state: present
|
||||
|
||||
- name: apt dist-upgrade
|
||||
apt:
|
||||
update_cache: yes
|
||||
upgrade: dist
|
||||
ignore_errors: yes
|
||||
|
||||
- name: Replace repo
|
||||
command: "sed -i 's/{{ oldmajor }}/{{ newmajor }}/g' /etc/apt/sources.list"
|
||||
become: yes
|
||||
|
||||
- name: Update packages
|
||||
apt:
|
||||
upgrade: full
|
||||
update_cache: yes
|
||||
autoremove: yes
|
||||
autoclean: yes
|
||||
ignore_errors: yes
|
||||
|
||||
# - name: Perform firmware-update
|
||||
# command: rpi-update
|
||||
# become: yes
|
||||
|
||||
- reboot:
|
||||
|
||||
- wait_for_connection:
|
||||
Reference in New Issue
Block a user