# pass sudo password in playbook command

**URL:** <https://forum.ansible.com/t/pass-sudo-password-in-playbook-command/13763>\
**Category:** Ansible Project\
**Created:** [October 24, 2013, 10:14am UTC](https://forum.ansible.com/t/pass-sudo-password-in-playbook-command/13763 "2013-10-24T10:14:13Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![cpatanaik](https://avatars.discourse-cdn.com/v4/letter/c/cdc98d/32.png) [@cpatanaik](https://forum.ansible.com/u/cpatanaik)\
**Post date:** [October 24, 2013, 10:14am UTC](https://forum.ansible.com/t/pass-sudo-password-in-playbook-command/13763/1 "2013-10-24T10:14:13Z")

</div>

Hi,

I have a playbook(test.yml) which installs some packages on a server.

- name: playbook to install lamp stack  
hosts: test  
user: root  
sudo: yes  
tasks:
- name: Install Apache  
action: apt pkg=apache2 state=present

Now when I run the playbook using “ansible-playbook -v -i inventory\_test test.yml --ask-pass”, It asks me for root password and when I give the pass, it works fine.  
I would like to know whether there is a way to pass the password in the command itself and not use --ask-pass option.

Thanks,

---

<div class="post-metadata">

**Author:** ![James\_Cammarata1](https://avatars.discourse-cdn.com/v4/letter/j/d26b3c/32.png) [@James\_Cammarata1](https://forum.ansible.com/u/James_Cammarata1)\
**Post date:** [October 24, 2013, 5:17pm UTC](https://forum.ansible.com/t/pass-sudo-password-in-playbook-command/13763/2 "2013-10-24T17:17:15Z")

</div>

Using --ask-sudo-pass will prompt for a different password specific to sudo.
