Confused about windows passwords and working with ec2?

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?

have you tried this?

- hosts: windows
  gather_facts: false
  tasks:

    - ec2_win_password: <stuff>
      connection: local

    - set_fact: ansible_ssh_host="{{ ec2_win_password.whatver}}"

    - do_other_stuff

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!

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

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

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