# \-b and password prompting in ansible 1.9

**URL:** <https://forum.ansible.com/t/b-and-password-prompting-in-ansible-1-9/17853>\
**Category:** Ansible Project\
**Created:** [March 26, 2015, 4:06pm UTC](https://forum.ansible.com/t/b-and-password-prompting-in-ansible-1-9/17853 "2015-03-26T16:06:21Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Anand\_Buddhdev2](https://avatars.discourse-cdn.com/v4/letter/a/48db29/32.png) [@Anand\_Buddhdev2](https://forum.ansible.com/u/Anand_Buddhdev2)\
**Post date:** [March 26, 2015, 4:06pm UTC](https://forum.ansible.com/t/b-and-password-prompting-in-ansible-1-9/17853/1 "2015-03-26T16:06:21Z")

</div>

I usually use ansible with the “-sK” flags (use sudo, and ask for sudo password). Now I’ve noticed the new “-b” flag. So I wanted to use it, but I’m told I can’t use “-b” and “-K” together. So I have to type:

-b --ask-become-pass

Is there a plan to introduce a short form for --ask-become-pass?

Regards,  
Anand

---

<div class="post-metadata">

**Author:** ![Brian\_Coca](https://avatars.discourse-cdn.com/v4/letter/b/6de8d8/32.png) [@Brian\_Coca](https://forum.ansible.com/u/Brian_Coca)\
**Post date:** [March 26, 2015, 4:18pm UTC](https://forum.ansible.com/t/b-and-password-prompting-in-ansible-1-9/17853/2 "2015-03-26T16:18:02Z")

</div>

I was actually planning to soften the restriction and allow -K to work with -b

---

<div class="post-metadata">

**Author:** ![Vince\_Skahan](https://avatars.discourse-cdn.com/v4/letter/v/5e9695/32.png) [@Vince\_Skahan](https://forum.ansible.com/u/Vince_Skahan)\
**Post date:** [March 29, 2015, 2:29am UTC](https://forum.ansible.com/t/b-and-password-prompting-in-ansible-1-9/17853/3 "2015-03-29T02:29:46Z")

</div>

> I was actually planning to soften the restriction and allow -K to work with -b

That would be helpful.

The new syntax is unclear to me, and I’m not understanding why you deprecated the old clear/concise syntax.

Consider a raspberry pi where you login as user ‘pi’ and sudo your commends:

> old:  
> -k -u pi --sudo  
> new:  
> -k -u pi -b --become-user=root --become-method=sudo

Or do your defaults mean that the new way would just be:  
-k -u pi -b

(in which case, what value was replacing a nice and clear/concise --sudo with a cryptic -b where we need to know the defaults for which user and method) ?

---

<div class="post-metadata">

**Author:** ![Brian\_Coca](https://avatars.discourse-cdn.com/v4/letter/b/6de8d8/32.png) [@Brian\_Coca](https://forum.ansible.com/u/Brian_Coca)\
**Post date:** [March 29, 2015, 6:38am UTC](https://forum.ansible.com/t/b-and-password-prompting-in-ansible-1-9/17853/4 "2015-03-29T06:38:59Z")

</div>

First, the sudo and su options continue to work, so you can continue  
to run the commands as you did before.

The new 'become' is to have a single way to deal with the expanding  
privilege escalation methods (pbrun, pfexec, runas, etc).

Sadly making something more flexible tends to add complexity, a 3rd  
parameter in this case 'become\_method'. Sudo is set as the default for  
this, but you can change this in ansible.cfg to suit your needs.

---

<div class="post-metadata">

**Author:** ![Anand\_Buddhdev2](https://avatars.discourse-cdn.com/v4/letter/a/48db29/32.png) [@Anand\_Buddhdev2](https://forum.ansible.com/u/Anand_Buddhdev2)\
**Post date:** [March 29, 2015, 7:35am UTC](https://forum.ansible.com/t/b-and-password-prompting-in-ansible-1-9/17853/5 "2015-03-29T07:35:36Z")

</div>

The new syntax is unclear to me, and I'm not understanding why you

> deprecated the old clear/concise syntax.

Actually, I think the new -b option makes sense in general. It avoids the  
need to add new command-line parameters for additional privilege escalation  
methods. However, I was just concerned that I needed to type  
--ask-become-pass each time, instead of a short option. So either allowing  
-K to keep working, or introducing a new short option for password  
prompting would be good.

I notice that lowercase 'p' is still unused. How about making '-p' short  
for --ask-become-password? Then, ansible would figure out the become  
method, and prompt accordingly. So I could type:

ansible -bp

and ansible would prompt:  
sudo password:

If I also add --become-method=su (or set it in ansible.cfg), then ansible  
would prompt for the "su" password.

Anand

---

<div class="post-metadata">

**Author:** ![Brian\_Coca](https://avatars.discourse-cdn.com/v4/letter/b/6de8d8/32.png) [@Brian\_Coca](https://forum.ansible.com/u/Brian_Coca)\
**Post date:** [March 29, 2015, 2:00pm UTC](https://forum.ansible.com/t/b-and-password-prompting-in-ansible-1-9/17853/6 "2015-03-29T14:00:00Z")

</div>

Sadly -p is taken for roles path, which does not currently affect  
ansible-playbook, but will be added in v2. My current candidate is -w.

---

<div class="post-metadata">

**Author:** ![Anand\_Buddhdev2](https://avatars.discourse-cdn.com/v4/letter/a/48db29/32.png) [@Anand\_Buddhdev2](https://forum.ansible.com/u/Anand_Buddhdev2)\
**Post date:** [March 29, 2015, 2:43pm UTC](https://forum.ansible.com/t/b-and-password-prompting-in-ansible-1-9/17853/7 "2015-03-29T14:43:01Z")

</div>

Sadly -p is taken for roles path, which does not currently affect

> ansible-playbook, but will be added in v2. My current candidate is -w.

Oh shame. I guess Dutch people will find it easier to remember though  
(password is wachtwoord in Dutch) 🙂

Anand

---

<div class="post-metadata">

**Author:** ![Brian\_Coca](https://avatars.discourse-cdn.com/v4/letter/b/6de8d8/32.png) [@Brian\_Coca](https://forum.ansible.com/u/Brian_Coca)\
**Post date:** [March 29, 2015, 2:44pm UTC](https://forum.ansible.com/t/b-and-password-prompting-in-ansible-1-9/17853/8 "2015-03-29T14:44:41Z")

</div>

I wonder if that is why that is the switch for password on ldap tools ....

---

<div class="post-metadata">

**Author:** ![Jan-Piet\_Mens](https://avatars.discourse-cdn.com/v4/letter/j/34f0e0/32.png) [@Jan-Piet\_Mens](https://forum.ansible.com/u/Jan-Piet_Mens)\
**Post date:** [March 29, 2015, 3:55pm UTC](https://forum.ansible.com/t/b-and-password-prompting-in-ansible-1-9/17853/9 "2015-03-29T15:55:28Z")

</div>

> I wonder if that is why that is the switch for password on ldap tools ....

passWord because it came after `p'ort IIRC 😉

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-JP
