Ansible reboot Linux machine or server with playbooks

ht‮//:spt‬www.lautturi.com
Ansible reboot Linux machine or server with playbooks

To reboot a Linux machine or server using Ansible and playbooks, you can use the reboot module.

Here is an example playbook that reboots a Linux system:

---
- name: Reboot a Linux system
  hosts: all
  become: true
  tasks:
  - name: Reboot the system
    reboot:

In this playbook, the reboot module is used to reboot the system. The become keyword is used to run the task with superuser privileges, and the hosts: all directive applies the task to all hosts in the inventory.

To run this playbook, you can use the ansible-playbook command, as shown below:

ansible-playbook -i <inventory_file> <playbook_file>

where <inventory_file> is the path to your Ansible inventory file and <playbook_file> is the path to the playbook file.

Keep in mind that this is just an example playbook and the exact steps may vary depending on your specific needs and configuration. It is always a good idea to refer to the official Ansible documentation for detailed instructions and further information.

Created Time:2017-10-16 14:38:35  Author:lautturi