ansible-collections / community.aws

Ansible Collection for Community AWS
GNU General Public License v3.0
189 stars 398 forks source link

EC2 Get Windows Password 'unable to parse key data' #1646

Open davidthong opened 1 year ago

davidthong commented 1 year ago

Summary

Getting unable to parse key data when running. The key data the string other private key in pem format

I'm thinking this is very similar to :+1: https://github.com/ansible/ansible/issues/67275

Where it was a python 2-->3 problem though I'm sure it was updated here.

Issue Type

Bug Report

Component Name

ec2_win_password

Ansible Version

$ ansible --version

ansible [core 2.13.6]\n config file = /etc/ansible/ansible.cfg\n configured module search path = ['/home/runner/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']\n ansible python module location = /usr/lib/python3.9/site-packages/ansible\n ansible collection location = /runner/requirements_collections:/home/runner/.ansible/collections:/usr/share/ansible/collections\n executable location = /usr/bin/ansible\n python version = 3.9.13 (main, Nov 9 2022, 13:16:24) [GCC 8.5.0 20210514 (Red Hat 8.5.0-15)]\n jinja version = 3.0.3\n libyaml = True

Collection Versions

$ ansible-galaxy collection list

/usr/share/ansible/collections/ansible_collections\nCollection Version\n----------------------- -------\namazon.aws 3.2.0 \nansible.controller 4.2.1 \nansible.netcommon 3.1.1 \nansible.network 1.2.0 \nansible.posix 1.3.0 \nansible.security 1.0.0 \nansible.utils 2.6.1 \nansible.windows 1.9.0 \nansible.yang 1.0.0 \narista.eos 5.0.0 \nawx.awx 21.10.0\nazure.azcollection 1.14.0 \ncisco.asa 3.0.0 \ncisco.ios 3.0.0 \ncisco.iosxr 3.0.0 \ncisco.nxos 3.0.0 \ncloud.common 2.1.1 \ncommunity.general 6.1.0 \ncommunity.vmware 3.2.0 \ncommunity.windows 1.11.1 \nfrr.frr 2.0.0 \nibm.qradar 2.0.0 \njunipernetworks.junos 3.0.0 \nkubernetes.core 2.2.3 \nopenvswitch.openvswitch 2.1.0 \nredhat.insights 1.0.7 \nredhat.openshift 2.1.0 \nredhat.rhv 1.6.5 \nredhat.satellite 3.3.0 \nservicenow.itsm 1.3.3 \nsplunk.es 2.0.0 \ntrendmicro.deepsec 2.0.0 \nvmware.vmware_rest 2.1.5 \nvyos.vyos 3.0.0 \n\n# /runner/requirements_collections/ansible_collections\nCollection Version\n---------------- -------\namazon.aws 5.1.0 \ncommunity.aws 5.1.0 \nredhat.satellite 3.7.0 ",

AWS SDK versions

$ pip show boto boto3 botocore

Name: boto Version: 2.49.0 Summary: Amazon Web Services Library Home-page: https://github.com/boto/boto/ Author: Mitch Garnaat Author-email: mitch@garnaat.com License: MIT Location: /usr/local/lib/python3.9/site-packages Requires: Required-by:

Name: boto3 Version: 1.26.25 Summary: The AWS SDK for Python Home-page: https://github.com/boto/boto3 Author: Amazon Web Services Author-email: None License: Apache License 2.0 Location: /usr/local/lib/python3.9/site-packages Requires: s3transfer, jmespath, botocore Required-by:

Name: botocore Version: 1.29.25 Summary: Low-level, data-driven core of boto 3. Home-page: https://github.com/boto/botocore Author: Amazon Web Services Author-email: None License: Apache License 2.0 Location: /usr/local/lib/python3.9/site-packages Requires: jmespath, python-dateutil, urllib3 Required-by: s3transfer, boto3

Configuration

$ ansible-config dump --only-changed

OS / Environment

RHEL8 Execution Environment from Red Hat

Steps to Reproduce

Expected Results

TASK [Get the Windows Password of the administrator] *** task path: /tmp/awx_569_zbjol32w/project/aws_create_vm.yml:53 changed: [localhost] => {"changed": true, "elapsed": 117, "win_password": "zgRkSd5r231q;.oUWlD13dkC;euT7ar{aS"}

Actual Results

TASK [Get the Windows Password of the administrator] *** task path: /tmp/awx_565_m93qwf3b/project/aws_create_vm.yml:53 fatal: [localhost]: FAILED! => {"changed": false, "msg": "unable to parse key data"}

Code of Conduct

ansibullbot commented 1 year ago

Files identified in the description:

If these files are inaccurate, please update the component name section of the description or use the !component bot command.

click here for bot help

ansibullbot commented 1 year ago

cc @jillr @markuman @rickmendes @s-hertel @tremble click here for bot help

tremble commented 1 year ago

@davidthong,

Thanks for taking the time to open this issue. Looking at the ansible/ansible issue you found I suspect that the suggested fix was never applied, and was only closed as a side effect of the Ansible Collections split.

Could you try the fix suggested in https://github.com/ansible/ansible/issues/67275 and see if it fixes the issue you're seeing?

Unfortunately the unit tests we have for the module specifically return the data as a string rather than retrieving the information directly from AWS, so an encoding issue like this would probably be overlooked.