# Setup-passwords from ansible script

**URL:** <https://discuss.elastic.co/t/setup-passwords-from-ansible-script/123515>\
**Category:** Elasticsearch\
**Created:** [March 12, 2018, 9:35am UTC](https://discuss.elastic.co/t/setup-passwords-from-ansible-script/123515 "2018-03-12T09:35:19Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![dao](https://avatars.discourse-cdn.com/v4/letter/d/a6a055/32.png) [@dao](https://discuss.elastic.co/u/dao)\
**Post date:** [March 12, 2018, 9:35am UTC](https://discuss.elastic.co/t/setup-passwords-from-ansible-script/123515/1 "2018-03-12T09:35:19Z")

</div>

Hey,

I'd like to automate my cluster provisionning (ansible). I am stucked on the password setup. How can I set my elastic, kibana and logstash passwords from a script, without prompting? I don't want to use the `setup-password auto` because I want to decide for my passwords.

I'd like to pass them as a parameter or as stdin

---

<div class="post-metadata">

**Author:** ![ikakavas](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ikakavas/32/34430_2.png) [@ikakavas](https://discuss.elastic.co/u/ikakavas)\
**Post date:** [March 12, 2018, 9:45am UTC](https://discuss.elastic.co/t/setup-passwords-from-ansible-script/123515/2 "2018-03-12T09:45:35Z")

</div>

Hi Olivier,

`setup-password` is not meant to be scriptable or used as part of a deployment script. It basically wraps a number of calls to the `_password` API and you should do the same in your ansible playbook.

@TimV has written some useful instructions [here](https://discuss.elastic.co/t/how-to-set-passwords-for-built-in-users-in-batch-mode/119655/6) on how to make use of the API and the `bootstrap.password` that might come in handy

---

<div class="post-metadata">

**Author:** ![dao](https://avatars.discourse-cdn.com/v4/letter/d/a6a055/32.png) [@dao](https://discuss.elastic.co/u/dao)\
**Post date:** [March 12, 2018, 9:51am UTC](https://discuss.elastic.co/t/setup-passwords-from-ansible-script/123515/3 "2018-03-12T09:51:09Z")

</div>

OK, switching to this thread

thank's

---

<div class="post-metadata">

**Author:** ![michael.russell](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/michael.russell/32/27889_2.png) [@michael.russell](https://discuss.elastic.co/u/michael.russell)\
**Post date:** [March 13, 2018, 12:40pm UTC](https://discuss.elastic.co/t/setup-passwords-from-ansible-script/123515/4 "2018-03-13T12:40:05Z")

</div>

Hi Olivier,

The official [ansible-elasticsearch](https://github.com/elastic/ansible-elasticsearch/blob/eb82e1b055ddcac2ee9d9c1b38bcf9b093962a95/tasks/xpack/security/elasticsearch-security-native.yml#L51) playbook also handles it by making requests directly to the `_password` api.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [April 10, 2018, 12:40pm UTC](https://discuss.elastic.co/t/setup-passwords-from-ansible-script/123515/5 "2018-04-10T12:40:11Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
