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

Am Mittwoch den 01. Juli 2020 schrieb Rafael Tomelin:

> 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.
> 
> 
> On Tue, Jun 30, 2020 at 4:53 PM John Petro <[email protected]> wrote:
> 
> > Are you using ansible to apply updates and reboot now?  If so, what does
> > your current process look like?
> >
> > --john
> >
> > On Mon, Jun 29, 2020 at 3:26 PM Rafael Tomelin <[email protected]>
> > wrote:
> >
> >>
> >> 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?
> >>
> >>
> >> --
> >> Atenciosamente,
> >>
> >> Rafael Tomelin
> >> Tel.: 51-984104084
> >> Skype: rafael.tomelin
> >>
> >> LPI ID: LPI000191271
> >> Red Hat Certified Engineer
> >> Puppet Professional 2017 Certification
> >>
> >> --
> >> You received this message because you are subscribed to the Google Groups
> >> "Ansible Project" group.
> >> To unsubscribe from this group and stop receiving emails from it, send an
> >> email to [email protected].
> >> To view this discussion on the web visit
> >> https://groups.google.com/d/msgid/ansible-project/CAGEUqbAwBVcpuWsULocMZ2ts4-298wqjmkkEvhRhRSDaFdnHPQ%40mail.gmail.com
> >> <https://groups.google.com/d/msgid/ansible-project/CAGEUqbAwBVcpuWsULocMZ2ts4-298wqjmkkEvhRhRSDaFdnHPQ%40mail.gmail.com?utm_medium=email&utm_source=footer>
> >> .
> >>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Ansible Project" group.
> > To unsubscribe from this group and stop receiving emails from it, send an
> > email to [email protected].
> > To view this discussion on the web visit
> > https://groups.google.com/d/msgid/ansible-project/CAPAjob-WzDS9BXVnGCvhS%3DXS%2B179f7mf-nJEbMQA-5-4_kZtmA%40mail.gmail.com
> > <https://groups.google.com/d/msgid/ansible-project/CAPAjob-WzDS9BXVnGCvhS%3DXS%2B179f7mf-nJEbMQA-5-4_kZtmA%40mail.gmail.com?utm_medium=email&utm_source=footer>
> > .
> >
> 
> 
> -- 
> Atenciosamente,
> 
> Rafael Tomelin
> Tel.: 51-984104084
> Skype: rafael.tomelin
> 
> LPI ID: LPI000191271
> Red Hat Certified Engineer
> Puppet Professional 2017 Certification
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected].
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/ansible-project/CAGEUqbCehhAhS6c-H40Dx5bPLfX5mJEF9Zkc%2BdocnpKnpYB8SQ%40mail.gmail.com.

-- 
                           <\         __@  __@
                             \ __   _-\<, -\<,_
http://www.tandemblog.ch     0<==`-(-)/---|/-(_)

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/20200702111940.GA3727695%40moturau.office.itds.ch.

Reply via email to