# Using 2 different users in one playbook

**URL:** <https://forum.ansible.com/t/using-2-different-users-in-one-playbook/34273>\
**Category:** Ansible Project\
**Created:** [December 2, 2020, 2:39pm UTC](https://forum.ansible.com/t/using-2-different-users-in-one-playbook/34273 "2020-12-02T14:39:57Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![harry\_devine](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/harry_devine/32/5293_2.png) [@harry\_devine](https://forum.ansible.com/u/harry_devine)\
**Post date:** [December 2, 2020, 2:39pm UTC](https://forum.ansible.com/t/using-2-different-users-in-one-playbook/34273/1 "2020-12-02T14:39:57Z")

</div>

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”.

---

<div class="post-metadata">

**Author:** ![Daniel\_Caillibaud](https://avatars.discourse-cdn.com/v4/letter/d/2acd7d/32.png) [@Daniel\_Caillibaud](https://forum.ansible.com/u/Daniel_Caillibaud)\
**Post date:** [December 2, 2020, 4:37pm UTC](https://forum.ansible.com/t/using-2-different-users-in-one-playbook/34273/2 "2020-12-02T16:37:47Z")

</div>

I'm noob with ansible, but why trying su method (vs sudo) ?

---

<div class="post-metadata">

**Author:** ![harry\_devine](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/harry_devine/32/5293_2.png) [@harry\_devine](https://forum.ansible.com/u/harry_devine)\
**Post date:** [December 2, 2020, 4:49pm UTC](https://forum.ansible.com/t/using-2-different-users-in-one-playbook/34273/3 "2020-12-02T16:49:30Z")

</div>

Didn’t work. I get "incorrect su password " still.

Harry

---

<div class="post-metadata">

**Author:** ![Joseph\_Alexander](https://avatars.discourse-cdn.com/v4/letter/j/6a8cbe/32.png) [@Joseph\_Alexander](https://forum.ansible.com/u/Joseph_Alexander)\
**Post date:** [December 2, 2020, 5:16pm UTC](https://forum.ansible.com/t/using-2-different-users-in-one-playbook/34273/4 "2020-12-02T17:16:07Z")

</div>

Break it down into two different plays. One to stop and reboot and then a second play to restart

---

<div class="post-metadata">

**Author:** ![harry\_devine](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/harry_devine/32/5293_2.png) [@harry\_devine](https://forum.ansible.com/u/harry_devine)\
**Post date:** [December 2, 2020, 7:49pm UTC](https://forum.ansible.com/t/using-2-different-users-in-one-playbook/34273/5 "2020-12-02T19:49:48Z")

</div>

That seemed to take care of it. Thanks for the suggestion!

Thanks,  
Harry
