[](https://travis-ci.org/robertdebock/ansible-role-reboot
The purpose of this role is to reboot your system.
[Unit tests](https://travis-ci.org/robertdebock/ansible-role-reboot are done on every commit and periodically.
If you find issues, please register them in GitHub
To test this role locally please use Molecule:
pip install molecule molecule test
There are many scenarios available, please have a look in the molecule/
directory.
This role is a part of many compatible roles. Have a look at the documentation of these roles for further information.
Here is an overview of related roles:
reboot_delay: How long to wait in seconds before sending a reboot. [default: 4]
reboot_up_delay: Number of seconds to wait before checking if the machine is up. [default: 8]
reboot_message: Include a personalized message that will be stored in logs. [default: see defaults/main.yml
]
This role has been tested against the following distributions and Ansible version:
distribution | ansible 2.4 | ansible 2.5 | ansible 2.6 | ansible-2.7 | ansible-devel |
---|---|---|---|---|---|
alpine-edge* | yes | yes | yes | yes | yes* |
alpine-latest | yes | yes | yes | yes | yes* |
archlinux | yes | yes | yes | yes | yes* |
centos-6 | yes | yes | yes | yes | yes* |
centos-latest | yes | yes | yes | yes | yes* |
debian-latest | yes | yes | yes | yes | yes* |
debian-stable | yes | yes | yes | yes | yes* |
debian-unstable* | yes | yes | yes | yes | yes* |
fedora-latest | yes | yes | yes | yes | yes* |
fedora-rawhide* | yes | yes | yes | yes | yes* |
gentoo | yes | yes | yes | yes | yes* |
opensuse-leap | yes | yes | yes | yes | yes* |
opensuse-tumbleweed | yes | yes | yes | yes | yes* |
ubuntu-artful | yes | yes | yes | yes | yes* |
ubuntu-devel* | yes | yes | yes | yes | yes* |
ubuntu-latest | yes | yes | yes | yes | yes* |
The star means the build may fail, it's marked as an experimental build.
--- - name: reboot hosts: all gather_facts: no become: yes roles: - role: robertdebock.bootstrap - role: robertdebock.reboot
You can also include a role when something changed.
- name: reboot hosts: all gather_facts: no become: yes tasks: - name: do something that requires a reboot. sestatus: state: disabled register do_something - name: include reboot role include_role: name: robertdebock.reboot when: - do_something.changed
Normally a notify
using handlers is perfect for changed tasks, but the module include_role
can't be used in a handler.
Linting will suggest to move that include_role
to a handler. To instruct ansible-lint to ignore this issue, use one of these two methods:
playbook.yml
:- name: include reboot role include_role: name: robertdebock.reboot when: - do_something.changed tags: - skip_ansible_lint
provisioner: name: ansible lint: name: ansible-lint options: x: - ANSIBLE0016
To install this role: - Install this role individually using `ansible-galaxy install robertdebock.reboot
Sample roles/requirements.yml: (install with `ansible-galaxy install -r roles/requirements.yml
--- - name: robertdebock.bootstrap - name: robertdebock.reboot
Apache License, Version 2.0