Merge "Switch to reboot module"
This commit is contained in:
commit
4a6bc785cd
@ -24,36 +24,16 @@
|
|||||||
set_fact:
|
set_fact:
|
||||||
is_local: "{{ lookup('pipe', 'hostname') in [ansible_hostname, ansible_nodename] }}"
|
is_local: "{{ lookup('pipe', 'hostname') in [ansible_hostname, ansible_nodename] }}"
|
||||||
|
|
||||||
# Any SSH connection errors cause ansible to fail the task. We therefore
|
|
||||||
# perform a manual SSH connection and allow the command to fail.
|
|
||||||
- name: Reboot the system to apply SELinux changes (remote)
|
|
||||||
local_action:
|
|
||||||
# Use -tt to force a pseudo tty.
|
|
||||||
module: >
|
|
||||||
command
|
|
||||||
ssh -tt {{ ansible_user }}@{{ ansible_host | default(inventory_hostname) }}
|
|
||||||
sudo shutdown -r now "Applying SELinux changes"
|
|
||||||
register: reboot_result
|
|
||||||
failed_when:
|
|
||||||
- reboot_result is failed
|
|
||||||
- "'closed by remote host' not in reboot_result.stderr"
|
|
||||||
when: not is_local | bool
|
|
||||||
|
|
||||||
- name: Reboot the system to apply SELinux changes (local)
|
- name: Reboot the system to apply SELinux changes (local)
|
||||||
command: shutdown -r now "Applying SELinux changes"
|
command: shutdown -r now "Applying SELinux changes"
|
||||||
become: True
|
become: True
|
||||||
when: is_local | bool
|
when: is_local | bool
|
||||||
|
|
||||||
# If we're running this locally we won't get here.
|
- name: Reboot the machine to apply SELinux
|
||||||
- name: Wait for the system to boot up (remote)
|
reboot:
|
||||||
local_action:
|
reboot_timeout: "{{ disable_selinux_reboot_timeout }}"
|
||||||
module: wait_for
|
msg: Applying SELinux changes
|
||||||
host: "{{ ansible_host | default(inventory_hostname) }}"
|
become: true
|
||||||
port: 22
|
|
||||||
state: started
|
|
||||||
# Wait for 10 seconds before polling to ensure the node has shutdown.
|
|
||||||
delay: 10
|
|
||||||
timeout: "{{ disable_selinux_reboot_timeout }}"
|
|
||||||
when: not is_local | bool
|
when: not is_local | bool
|
||||||
when:
|
when:
|
||||||
- disable_selinux_do_reboot | bool
|
- disable_selinux_do_reboot | bool
|
||||||
|
@ -0,0 +1,6 @@
|
|||||||
|
---
|
||||||
|
fixes:
|
||||||
|
- |
|
||||||
|
Fixes an issue where custom SSH arguments, such as when setting
|
||||||
|
``ansible_ssh_extra_args``, were not being respected when rebooting
|
||||||
|
a host to disable selinux.
|
Loading…
Reference in New Issue
Block a user