# Confused about windows passwords and working with ec2?

**URL:** <https://forum.ansible.com/t/confused-about-windows-passwords-and-working-with-ec2/19208>\
**Category:** Ansible Project\
**Tags:** windows\
**Created:** [September 8, 2015, 6:16pm UTC](https://forum.ansible.com/t/confused-about-windows-passwords-and-working-with-ec2/19208 "2015-09-08T18:16:30Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Frank\_Perks](https://avatars.discourse-cdn.com/v4/letter/f/90ced4/32.png) [@Frank\_Perks](https://forum.ansible.com/u/Frank_Perks)\
**Post date:** [September 8, 2015, 6:16pm UTC](https://forum.ansible.com/t/confused-about-windows-passwords-and-working-with-ec2/19208/1 "2015-09-08T18:16:30Z")

</div>

Hi,

I am unsure exactly how i am supposed to handle and work with windows passwords when working with EC2 and inventories. I know i can query the passwords by using ec2\_win\_password, however i am unsure exactly how i can use this value to set the ansible\_ssh\_pass. For that connection.

For example:

`

- hosts: windows  
connection: local  
gather\_facts: false  
tasks:  
ec2\_win\_password: 

`

Unfortunately this play will never work because all hosts in the windows group need to know their password. Manually defining all the windows passwords in hosts seems like a really really awful idea, but i am unsure exactly what i can do in this case. I can do a localhost play before this play to grab all the associated passwords using ec2\_win\_password, however that doesn’t actually fix anything because i can’t seem to find a way to set the ansible\_ssh\_pass fact using set\_fact.

I am lost and tired. What exactly am i supposed to do?

---

<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:** [September 8, 2015, 8:51pm UTC](https://forum.ansible.com/t/confused-about-windows-passwords-and-working-with-ec2/19208/2 "2015-09-08T20:51:39Z")

</div>

have you tried this?

- hosts: windows  
&nbsp;&nbsp;gather\_facts: false  
&nbsp;&nbsp;tasks:

&nbsp;&nbsp;&nbsp;&nbsp;- ec2\_win\_password: \<stuff\>  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;connection: local

&nbsp;&nbsp;&nbsp;&nbsp;- set\_fact: ansible\_ssh\_host="{{ ec2\_win\_password.whatver}}"

&nbsp;&nbsp;&nbsp;&nbsp;- do\_other\_stuff

---

<div class="post-metadata">

**Author:** ![Frank\_Perks](https://avatars.discourse-cdn.com/v4/letter/f/90ced4/32.png) [@Frank\_Perks](https://forum.ansible.com/u/Frank_Perks)\
**Post date:** [September 9, 2015, 11:30am UTC](https://forum.ansible.com/t/confused-about-windows-passwords-and-working-with-ec2/19208/3 "2015-09-09T11:30:25Z")

</div>

I didn’t realize you can specify the ansible connection on a per task level!

That completely changes stuff!

I will give this a shot!

---

<div class="post-metadata">

**Author:** ![Frank\_Perks](https://avatars.discourse-cdn.com/v4/letter/f/90ced4/32.png) [@Frank\_Perks](https://forum.ansible.com/u/Frank_Perks)\
**Post date:** [September 9, 2015, 1:58pm UTC](https://forum.ansible.com/t/confused-about-windows-passwords-and-working-with-ec2/19208/4 "2015-09-09T13:58:51Z")

</div>

This does not actually work, i get

`  
FAILED! =\> {“failed”: true, “msg”: “ERROR! The module ec2\_win\_password was not found in configured module paths”}

`

I am assuming this is related to this issue:  
[https://groups.google.com/forum/#!topic/ansible-project/PqwMiIHV0js](https://groups.google.com/forum/#!topic/ansible-project/PqwMiIHV0js)

---

<div class="post-metadata">

**Author:** ![Trond\_Hindenes](https://avatars.discourse-cdn.com/v4/letter/t/96bed5/32.png) [@Trond\_Hindenes](https://forum.ansible.com/u/Trond_Hindenes)\
**Post date:** [September 9, 2015, 2:26pm UTC](https://forum.ansible.com/t/confused-about-windows-passwords-and-working-with-ec2/19208/5 "2015-09-09T14:26:14Z")

</div>

I’ve been bitten by “Connection: local” aswell. Could you try delegate\_to: localhost instead and see if that works better for you?

---

<div class="post-metadata">

**Author:** ![Chris\_Church1](https://avatars.discourse-cdn.com/v4/letter/c/ac8455/32.png) [@Chris\_Church1](https://forum.ansible.com/u/Chris_Church1)\
**Post date:** [September 9, 2015, 6:51pm UTC](https://forum.ansible.com/t/confused-about-windows-passwords-and-working-with-ec2/19208/6 "2015-09-09T18:51:58Z")

</div>

You may also want to check out my win-ec2 role as an example of fetching the passwords, adding them to inventory and generating a static inventory file:

[https://github.com/cchurch/ansible-role-win-ec2/blob/master/tasks/main.yml#L79](https://github.com/cchurch/ansible-role-win-ec2/blob/master/tasks/main.yml#L79)
