forked from msvsphere/cloud-images
Also added the "upgrade_and_reboot" role that upgrades all packages and reboots a VM if something has been upgraded.master
parent
eef59510ca
commit
ec903e2a0e
@ -1,2 +1,3 @@
|
||||
.vscode
|
||||
*.box
|
||||
ansible/roles/ezamriy.vbox_guest
|
||||
|
@ -1,3 +1,4 @@
|
||||
---
|
||||
collections: []
|
||||
roles: []
|
||||
roles:
|
||||
- name: ezamriy.vbox_guest
|
||||
|
@ -0,0 +1,13 @@
|
||||
# upgrade_and_reboot
|
||||
|
||||
An Ansible role that upgrades all packages to their latest versions and
|
||||
reboots a host.
|
||||
|
||||
|
||||
## Role Variables
|
||||
|
||||
Role variables and their default values are listed below:
|
||||
|
||||
* `reboot_connect_timeout: 5` - number of seconds to sleep before retrying check.
|
||||
* `reboot_timeout: 600` - maximum number of seconds to wait for a host return.
|
||||
* `reboot_post_reboot_delay: 15` - number of seconds to wait before starting checking.
|
@ -0,0 +1,5 @@
|
||||
---
|
||||
reboot_connect_timeout: 5
|
||||
reboot_pre_reboot_delay: 60
|
||||
reboot_post_reboot_delay: 60
|
||||
reboot_timeout: 600
|
@ -0,0 +1,19 @@
|
||||
galaxy_info:
|
||||
role_name: upgrade_and_reboot
|
||||
author: Eugene Zamriy
|
||||
description: Upgrades all packages, reboots a host and waits for it to return
|
||||
license: MIT
|
||||
|
||||
min_ansible_version: '2.7'
|
||||
|
||||
platforms:
|
||||
- name: EL
|
||||
versions:
|
||||
- '8'
|
||||
- '9'
|
||||
|
||||
galaxy_tags:
|
||||
- reboot
|
||||
- upgrade
|
||||
|
||||
dependencies: []
|
@ -0,0 +1,14 @@
|
||||
---
|
||||
- name: Upgrade packages
|
||||
ansible.builtin.dnf:
|
||||
name: '*'
|
||||
state: latest
|
||||
register: system_upgrade
|
||||
|
||||
- name: Reboot host
|
||||
ansible.builtin.reboot:
|
||||
connect_timeout: "{{ reboot_connect_timeout }}"
|
||||
pre_reboot_delay: "{{ reboot_pre_reboot_delay }}"
|
||||
post_reboot_delay: "{{ reboot_post_reboot_delay }}"
|
||||
reboot_timeout: "{{ reboot_timeout }}"
|
||||
when: system_upgrade.changed
|
Loading…
Reference in new issue