| --- |
| - name: Refresh setup facts |
| setup: |
| |
| - name: Set restart_needed |
| set_fact: |
| restart_needed: "{{ ansible_selinux.status | lower != 'disabled' | bool }}" |
| |
| - name: Permanently disable SELINUX |
| selinux: state=disabled |
| when: restart_needed |
| |
| - name: Restart node |
| debug: |
| msg: 'SELinux MUST be disabled, selinux has been updated, restarting node now...' |
| when: restart_needed |
| |
| - name: Restarting node now |
| ignore_errors: yes |
| become: yes |
| shell: 'reboot now' |
| when: restart_needed |
| async: 0 |
| poll: 0 |
| |
| - name: Waiting for server to complete restarting |
| become: no |
| local_action: wait_for host='{{ ansible_host }}' state=started delay=60 timeout='{{ server_restart_timeout | d(720) }}' |
| when: restart_needed |
| |
| - name: Server usually needs a little more time ... |
| become: no |
| local_action: wait_for host='{{ ansible_host }}' state=started delay=60 |
| when: restart_needed |