Break it down into two different plays. One to stop and reboot and then a second play to restart
--- - 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 the databases hosts: oracle remote_user: whatever - name: Start Databases command: /home/oracle/scripts/db_start.sh become: true become_method: su become_user: oracle changed_when: False On Wed, Dec 2, 2020 at 11:50 AM harry devine <lifte...@gmail.com> wrote: > Didn't work. I get "incorrect su password " still. > > Harry > > On Wed, Dec 2, 2020, 11:38 AM Daniel Caillibaud <m...@lairdutemps.org> > wrote: > >> Le 02/12/20 à 6h39, "lift...@gmail.com" <lifte...@gmail.com> a écrit : >> > 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". >> >> I'm noob with ansible, but why trying su method (vs sudo) ? >> >> -- >> Daniel >> >> - Tu sais pourquoi Bruce Lee ? >> - Parce qu'on a lui a appris à lire. >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Ansible Project" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to ansible-project+unsubscr...@googlegroups.com. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/ansible-project/20201202173747.09309d12%40quad >> . >> > -- > You received this message because you are subscribed to the Google Groups > "Ansible Project" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to ansible-project+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/ansible-project/CALYKJ24cA6QO8XJRagiFn%3DAANXpFY-0YCpkwugpT%2B728WeHRfg%40mail.gmail.com > <https://groups.google.com/d/msgid/ansible-project/CALYKJ24cA6QO8XJRagiFn%3DAANXpFY-0YCpkwugpT%2B728WeHRfg%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group and stop receiving emails from it, send an email to ansible-project+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CANhJoDxx06jL_A0qvck%3Du_U%2BZQm6FcGHLPB%2BahoUBWL6ZoHStQ%40mail.gmail.com.