# Ansible SSH  "stderr": "reboot: Need to be root"

**URL:** <https://forum.ansible.com/t/ansible-ssh-stderr-reboot-need-to-be-root/26863>\
**Category:** Ansible Project\
**Created:** [February 28, 2018, 5:10am UTC](https://forum.ansible.com/t/ansible-ssh-stderr-reboot-need-to-be-root/26863 "2018-02-28T05:10:08Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Hemant\_Kulkarni](https://avatars.discourse-cdn.com/v4/letter/h/aeb1de/32.png) [@Hemant\_Kulkarni](https://forum.ansible.com/u/Hemant_Kulkarni)\
**Post date:** [February 28, 2018, 5:10am UTC](https://forum.ansible.com/t/ansible-ssh-stderr-reboot-need-to-be-root/26863/1 "2018-02-28T05:10:08Z")

</div>

Hello Team,

I need to reboot my servers using ansible ,my Problem is i dont have sudo user , i have normal user and root password …

admin = normal user

here is my simple playbook …

- hosts: unix  
tasks:
- name: reboot servers  
command: /sbin/reboot

as of now I tried below Option

ansible-playbook packge\_install.yum -i hosts --su-user=root --ask-su-pass

ansible-playbook packge\_install.yum -i hosts --user=admin --ask-pass --su --ask-su-pass

but its not working … any idea How to achieve this ?

regards…Hemant

---

<div class="post-metadata">

**Author:** ![Kai\_Stian\_Olstad](https://avatars.discourse-cdn.com/v4/letter/k/e19adc/32.png) [@Kai\_Stian\_Olstad](https://forum.ansible.com/u/Kai_Stian_Olstad)\
**Post date:** [February 28, 2018, 8:04am UTC](https://forum.ansible.com/t/ansible-ssh-stderr-reboot-need-to-be-root/26863/2 "2018-02-28T08:04:26Z")

</div>

> I need to reboot my servers using ansible ,my Problem is i dont have sudo  
> user , i have normal user and root password ..
> 
> admin = normal user
> 
> here is my simple playbook ...
> 
> - hosts: unix  
> &nbsp;&nbsp;tasks:  
> &nbsp;&nbsp;- name: reboot servers  
> &nbsp;&nbsp;&nbsp;&nbsp;command: /sbin/reboot

You could change your playbook to

- hosts: unix  
&nbsp;&nbsp;&nbsp;become: yes  
&nbsp;&nbsp;&nbsp;become\_method: su  
&nbsp;&nbsp;&nbsp;tasks:  
&nbsp;&nbsp;&nbsp;- name: reboot servers  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;command: /sbin/reboot

Then you can run

ansible-playbook packge\_install.yum -i hosts --ask-become-pass

> as of now I tried below Option
> 
> ansible-playbook packge\_install.yum -i hosts --su-user=root --ask-su-pass  
> ansible-playbook packge\_install.yum -i hosts --user=admin --ask-pass --su  
> --ask-su-pass
> 
> but its not working ... any idea How to achieve this ?

If you would like to keep the playbook as is, this should work

ansible-playbook packge\_install.yum -i hosts --become-method=su --become --ask-become-pass

You also have the short version of the options, check  
anible-playbook -h

---

<div class="post-metadata">

**Author:** ![Hemant\_Kulkarni](https://avatars.discourse-cdn.com/v4/letter/h/aeb1de/32.png) [@Hemant\_Kulkarni](https://forum.ansible.com/u/Hemant_Kulkarni)\
**Post date:** [February 28, 2018, 12:48pm UTC](https://forum.ansible.com/t/ansible-ssh-stderr-reboot-need-to-be-root/26863/3 "2018-02-28T12:48:35Z")

</div>

Thanks for your Views … I tried that but it seem same error …

below is my playbook

.

---

<div class="post-metadata">

**Author:** ![Hemant\_Kulkarni](https://avatars.discourse-cdn.com/v4/letter/h/aeb1de/32.png) [@Hemant\_Kulkarni](https://forum.ansible.com/u/Hemant_Kulkarni)\
**Post date:** [February 28, 2018, 4:29pm UTC](https://forum.ansible.com/t/ansible-ssh-stderr-reboot-need-to-be-root/26863/4 "2018-02-28T16:29:28Z")

</div>

Hello,

Just an Update , I did small change in my Play boot …
