ec2_win_password comes back empty

57 views
Skip to first unread message

David O'Brien

unread,
Mar 30, 2016, 3:11:36 AM3/30/16
to Ansible Project
Hi all,

I'm running Ansible 2.0.1 and I'm trying to get a newly provisioned EC2 instance's Windows password. However, something is off. Anybody got an idea?

TASK [cube : get the Administrator password] ***********************************
task path
: /container/ansible/roles/cube/tasks/main.yml:41
[DEPRECATION WARNING]: Using bare variables is deprecated. Update your
playbooks so that the environment value uses the full variable syntax
('{{ec2.instances}}'). This feature will be removed in a future release.
Deprecation warnings can be disabled by setting deprecation_warnings=False in
ansible
.cfg.
ESTABLISH LOCAL CONNECTION FOR USER
: root
localhost EXEC
/bin/sh -c '( umask 22 && mkdir -p "` echo $HOME/.ansible/tmp/ansible-tmp-1459321164.25-261062373083330 `" && echo "` echo $HOME/.ansible/tmp/ansible-tmp-1459321164.25-261062373083330 `" )'
localhost PUT
/tmp/tmp7xNU1U TO /root/.ansible/tmp/ansible-tmp-1459321164.25-261062373083330/ec2_win_password
localhost EXEC
/bin/sh -c 'LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 /usr/bin/python /root/.ansible/tmp/ansible-tmp-1459321164.25-261062373083330/ec2_win_password; rm -rf "/root/.ansible/tmp/ansible-tmp-1459321164.25-261062373083330/" > /dev/null 2>&1'
ok
: [localhost] => (item={u'kernel': None, u'root_device_type': u'ebs', u'private_dns_name': u'ip-10-178-72-174.ap-southeast-2.compute.internal', u'public_ip': None, u'private_ip': u'10.178.72.174', u'id': u'i-c517131a', u'ebs_optimized': False, u'state': u'running', u'virtualization_type': u'hvm', u'architecture': u'x86_64', u'ramdisk': None, u'block_device_mapping': {u'/dev/sda1': {u'status': u'attached', u'delete_on_termination': True, u'volume_id': u'vol-66070bac'}}, u'key_name': u'ansible-temp', u'image_id': u'ami-e0260583', u'tenancy': u'default', u'groups': {u'sg-e60bc882': u'sg-nonprod'}, u'public_dns_name': u'', u'state_code': 16, u'tags': {u'App': u'bla'}, u'placement': u'ap-southeast-2a', u'ami_launch_index': u'0', u'dns_name': u'', u'region': u'ap-southeast-2', u'launch_time': u'2016-03-30T06:57:19.000Z', u'instance_type': u't2.medium', u'root_device_name': u'/dev/sda1', u'hypervisor': u'xen'}) => {"changed": false, "invocation": {"module_args": {"aws_access_key": null, "aws_secret_key": null, "ec2_url": null, "instance_id": "i-c517131a", "key_file": "~/aws-creds/ec2key.pem", "key_passphrase": null, "profile": null, "region": null, "security_token": null, "validate_certs": true, "wait": false, "wait_timeout": 120}, "module_name": "ec2_win_password"}, "item": {"ami_launch_index": "0", "architecture": "x86_64", "block_device_mapping": {"/dev/sda1": {"delete_on_termination": true, "status": "attached", "volume_id": "vol-66070bac"}}, "dns_name": "", "ebs_optimized": false, "groups": {"sg-e60bc882": "sg-nonprod"}, "hypervisor": "xen", "id": "i-c517131a", "image_id": "ami-e0260583", "instance_type": "t2.medium", "kernel": null, "key_name": "ansible-temp", "launch_time": "2016-03-30T06:57:19.000Z", "placement": "ap-southeast-2a", "private_dns_name": "ip-10-178-72-174.ap-southeast-2.compute.internal", "private_ip": "10.178.72.174", "public_dns_name": "", "public_ip": null, "ramdisk": null, "region": "ap-southeast-2", "root_device_name": "/dev/sda1", "root_device_type": "ebs", "state": "running", "state_code": 16, "tags": {"App": "bla"}, "tenancy": "default", "virtualization_type": "hvm"}, "win_password": ""}


Shouldn't win_password have a value?
Any takers?

Cheers
David

David O'Brien

unread,
Mar 30, 2016, 5:26:39 AM3/30/16
to Ansible Project
Solution, wait for the resource to come back with a password:

- name: obtain initial passwords for win ec2 instances
  ec2_win_password
:
    instance_id
: "{{ item.id }}"
    key_file
: "~/aws-creds/ec2key.pem"
    wait
: yes
    wait_timeout
: 600
  with_items
: win_ec2_instances.instances
 
register: win_ec2_passwords


Reply all
Reply to author
Forward
0 new messages