Reboot servers strategy.

Hi Guys,
I have periodic updates on all RedHat servers at the same time, I need to create a strategy to restart my clusters because I can’t stop my application and services.

How to create the reboot strategy server-per-server in clusters?

Are you using ansible to apply updates and reboot now? If so, what does your current process look like?

–john

Hi,

I get all servers from Azure and created inventory in memory by ansible.
After get server and created inventory, connect in all servers collection facts and execute update of servers. This moment I need to create a process to reboot my servers by custom facts.

Hmm… I have seen where someone put a delay in the task that does the reboot. So you could probably do something like that, to make sure that the node is back up before moving on, or you could do some sort of check and register a variable, so that a node would only reboot if that node is set.

Hi,

on our setup we reboot our servers groupwise.
With serial: 1 is ensured only one server is rebooted a time.
The reboot is only performed if /var/run/reboot-required exists. This
might be Debian specific. This 'when' condition could give you an idea
how to handle server specific facts.

--8<--------------------------------
- hosts:
    - sensu_servers
    - build_servers
    - db_servers
    - lamp_servers
    - app_servers
    - mail_servers
    - web_servers
  become: true
  serial: 1
  tasks:
    - name: check if reboot-required exists
      stat:
        path: /var/run/reboot-required
      register: reboot_required
    - name: reboot
      reboot:
      when: reboot_required.stat.exists
--8<--------------------------------

Check out the reboot module for further parameters like
'post_reboot_delay' or 'test_command':
https://docs.ansible.com/ansible/latest/modules/reboot_module.html

I hope this helps.

-- Moritz