gchq / stroom-ansible

A home for all stroom related ansible playbooks, roles, etc.
Apache License 2.0
4 stars 6 forks source link

Minimise rebooting when updating nodes #6

Closed burnalting closed 4 years ago

burnalting commented 4 years ago

In the yum update playbook (stroom-ansible-master/stroom/roles/setup/yum_update/tasks/main.yml) it would be better to only reboot if there is a need as per

---
- name: "Do a YUM update on all installed packages"
  become: true
  yum:
    name: "*"
    state: latest
  tags:
    - never # Task won't run unless one of the other tags is set
    - yum_update
  register: upgraded

# The next three tasks will ONLY run if you supply the allow_reboot tag
- name: restart system to reboot to newest kernel
  become: true
  shell: "sleep 5 && reboot"
  async: 1
  poll: 0
  tags:
    - never
    - allow_reboot
  when: upgraded.changed
  register: reboot

- name: wait for 10 seconds
  pause:
    seconds: 10
  tags:
    - never
    - allow_reboot
  when: reboot.changed

- name: wait for the system to reboot
  wait_for_connection:
    connect_timeout: 20
    sleep: 3
    delay: 0
    timeout: 120
  tags:
    - never
    - allow_reboot
  when: reboot.changed
at055612 commented 4 years ago

Thanks for this. Added it in d4096f6c3c4742b814327c8317fc70aecababf9a