tehtbl.reboot
<!-- To get the ID, use: ansible-galaxy info tehtbl.reboot | grep -i "id:" -->
<a href="https://galaxy.ansible.com/tehtbl/reboot"><img src="https://img.shields.io/ansible/role/44922"/></a> <a href="https://galaxy.ansible.com/tehtbl/reboot"><img src="https://img.shields.io/ansible/quality/44922"/></a> <a href="https://travis-ci.org/tehtbl/ansible-role-reboot"><img src="https://travis-ci.org/tehtbl/ansible-role-reboot.svg?branch=master" alt="Build status"/></a>
Role Description
================
This role reboots your system if necessary.
Example Playbook
================
Here is an example Playbook from `molecule/default/converge.yml`. It is tested every time there is a push, pull request, or release.
```yaml
---
- name: Converge
hosts: all
become: true
gather_facts: false
roles:
- role: tehtbl.reboot
Before running this, make sure the machine is prepared. This Playbook ensures everything is ready for the reboot role.
---
- name: Prepare
hosts: all
become: true
gather_facts: false
roles:
- role: tehtbl.bootstrap
Role Variables
These variables are defined in defaults/main.yml
:
---
# ------------------------------------------------------------------------
# Default settings for reboot role
# ------------------------------------------------------------------------
# Some systems can check if a reboot is needed. This setting can force a reboot.
reboot_always: false
# Time to wait before issuing a reboot command.
reboot_delay: 4
# Time to wait before checking if the machine has rebooted.
reboot_up_delay: 8
# You can set a message to log during reboot for easier auditing.
reboot_message: "Reboot triggered by Ansible role tehtbl.reboot"
Requirements
- Access to a repository for downloading packages, usually over the internet.
- A recent version of Ansible (tests are run on the latest, previous, and upcoming Ansible releases).
Context
This role is part of several compatible roles. Check out my other roles for more information.
Compatibility
This role has been tested with these Docker images:
Container | Tag | Allow Failures |
---|---|---|
debian | stable | no |
debian | testing | no |
debian | unstable | yes |
ubuntu | xenial | yes |
ubuntu | bionic | no |
ubuntu | focal | no |
ubuntu | devel | yes |
This role has also been tested with these Ansible versions:
- ansible>=2.8, <2.9
- ansible>=2.9
- git+https://github.com/ansible/ansible.git@devel
Testing Using Tox
Unit tests are executed for every commit, pull request, release, and periodically.
If you encounter any issues, please report them in GitHub.
Testing is done using Tox and Molecule:
Tox tests multiple versions of Ansible. Molecule tests various distributions.
To test using default settings (any installed Ansible version, namespace: tehtbl
, image: ubuntu
, tag: latest
):
molecule test
# Or specify a particular image:
IMAGE="ubuntu" molecule test
# Or specify a specific image and tag:
IMAGE="debian" TAG="stable" tox
You can also test multiple Ansible versions and choose the appropriate images:
Tox allows testing multiple Ansible versions. To run the default tests (namespace: tehtbl
, image: ubuntu
, tag: latest
):
tox
# To run a test with Ubuntu (namespace: `tehtbl`, tag: `latest`)
IMAGE="ubuntu" tox
# To customize further:
IMAGE="debian" TAG="stable" tox -e py37-ansible-current
Testing Using Vagrant
Install vagrant
plugins with:
vagrant plugin install vagrant-reload
Start tests with VirtualBox Provider:
vagrant up
License
MIT License
Author Information
Sources
This work is inspired by the contributions of many people, including Robert de Bock, Jeff Geerling, and Thomas Waldmann. Thank you! ```