We have a playbook we're trying to implement that will stop an Oracle database via a script, reboot the server, then restart Oracle via a script. The stop/start of Oracle needs to be run as the oracle user, and the reboot needs to be done as root.
When we run the playbook, we enter our normal user credentials that has sudo access, but when we try to switch as the oracle user in the playbook, we get "incorrect su password".
---
- hosts: oracle
become: true
become_method: sudo
gather_facts: no
tasks:
- name: Stop Databases
command: /home/oracle/scripts/db_stop.sh
become: true
become_method: su
become_user: oracle
changed_when: False
- name: Reboot Oracle (Wave3) servers
reboot:
- name: Start Databases
command: /home/oracle/scripts/db_start.sh
become: true
become_method: su
become_user: oracle
changed_when: False
Any ideas on how to accomplish this?
Thanks,
Harry