# Is it possible to use ask-pass option in a playbook just for the first play?

**URL:** <https://forum.ansible.com/t/is-it-possible-to-use-ask-pass-option-in-a-playbook-just-for-the-first-play/13263>\
**Category:** Ansible Project\
**Created:** [August 6, 2013, 4:57pm UTC](https://forum.ansible.com/t/is-it-possible-to-use-ask-pass-option-in-a-playbook-just-for-the-first-play/13263 "2013-08-06T16:57:14Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![lars\_svenson](https://avatars.discourse-cdn.com/v4/letter/l/b782af/32.png) [@lars\_svenson](https://forum.ansible.com/u/lars_svenson)\
**Post date:** [August 6, 2013, 4:57pm UTC](https://forum.ansible.com/t/is-it-possible-to-use-ask-pass-option-in-a-playbook-just-for-the-first-play/13263/1 "2013-08-06T16:57:14Z")

</div>

Hello community,

I’ve written a playbook which looks like this:

main.yml:

> - hosts: $hosts

> user: root

> roles: - add\_ansible\_user

> - hosts: $hosts

> user: ansible

> sudo: yes

> roles: - do\_stuff2

I run this playbook like this:

ansible-playbook -e hosts=foobar -k

First part is working well. Second part is failing, because ansible still uses the password I set with -k and not the it’s ssh-key.

Is there a possibility to use -k option just for the first part of the playbook?

Any ideas?

Thanx in advance

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan2](https://avatars.discourse-cdn.com/v4/letter/m/da6949/32.png) [@Michael\_DeHaan2](https://forum.ansible.com/u/Michael_DeHaan2)\
**Post date:** [August 6, 2013, 9:49pm UTC](https://forum.ansible.com/t/is-it-possible-to-use-ask-pass-option-in-a-playbook-just-for-the-first-play/13263/2 "2013-08-06T21:49:27Z")

</div>

–ask-pass currently applies to all plays.

I think you would want to split it in two plays in this case.

You could keep on using the password for the rest of the play I would think.
