OCI: How to Force Reboot a Linux Instance Using Ansible
Applies to:
Oracle Cloud Infrastructure - Version N/A and later
Linux x86-64
Goal
Ansible is being used to manage Linux instances.
To reboot the instances, the ansible reboot module is being used.
But for some instances the normal reboot does not take place and they need to be forcefully rebooted from the OCI console by using the Force checkbox in the OCI instance reboot screen.
The question is, whether something similar be achieved from an Ansible playbook.
Solution
Ansible includes a reboot module since version 2.7 that allows an Ansible playbook to perform a controlled and graceful reboot, and proceed with the next play after the reboot completes without concerns.