community.aws icon indicating copy to clipboard operation
community.aws copied to clipboard

community.aws.ec2_win_password "unable to parse key data" - Ansible Automation Platform Controller 4.4.2

Open ericcames opened this issue 10 months ago • 1 comments

Summary

I am migrating from "Ansible Automation Platform Controller 4.1.2" -> "Ansible Automation Platform Controller 4.4.2" and am not able to use the community.aws.ec2_win_password on the new platform. I have ensured that I am using the same version of the Execution Environment on both platforms. I have also ensured that I am using the same version of the community.aws collection.

Issue Type

Bug Report

Component Name

community.aws.ec2_win_password

Ansible Version

$ ansible --version

Not working ansible [core 2.14.2] config file = /etc/ansible/ansible.cfg configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules'] ansible python module location = /usr/lib/python3.11/site-packages/ansible ansible collection location = /root/.ansible/collections:/usr/share/ansible/collections executable location = /bin/ansible python version = 3.11.2 (main, May 24 2023, 00:00:00) [GCC 11.3.1 20221121 (Red Hat 11.3.1-4)] (/usr/bin/python3.11) jinja version = 3.1.2 libyaml = True

Working ansible [core 2.12.6] config file = /etc/ansible/ansible.cfg configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules'] ansible python module location = /usr/lib/python3.8/site-packages/ansible ansible collection location = /root/.ansible/collections:/usr/share/ansible/collections executable location = /bin/ansible python version = 3.8.12 (default, Sep 16 2021, 10:46:05) [GCC 8.5.0 20210514 (Red Hat 8.5.0-3)] jinja version = 2.10.3 libyaml = True



### Collection Versions

```- name: community.aws
    version: "6.1.0"

AWS SDK versions

$ pip show boto boto3 botocore

Configuration

CONFIG_FILE() = /etc/ansible/ansible.cfg

OS / Environment

Working on RHEL 8 Not Working on RHEL 9

Steps to Reproduce

      register: admin_passwd
      community.aws.ec2_win_password:
        instance_id: "{{ instance_info.instances[0].instance_id }}"
        region: "{{ region }}"
        key_data: "{{ zigfreed_private_key }}"
        wait: true
        wait_timeout: 45

[https://github.com/ericcames/Windows/blob/main/AWS/get_instance_info.yml](url)

Expected Results

{ "win_password": "=1!@hoWM(OdSL$OJQlsBeVHpeGVUXx@p", "changed": false, "elapsed": 0, "invocation": { "module_args": { "instance_id": "i-0c64f4684ec0e7a00", "region": "us-west-1", "key_data": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER", "wait": true, "wait_timeout": 45, "access_key": "OMITTED", "secret_key": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER", "validate_certs": true, "debug_botocore_endpoint_logs": false, "session_token": null, "profile": null, "endpoint_url": null, "aws_ca_bundle": null, "aws_config": null, "key_file": null, "key_passphrase": null } }, "warnings": [ "botocore < 1.25.0 is not supported or tested. Some features may not work.", "boto3 < 1.22.0 is not supported or tested. Some features may not work." ], "_ansible_no_log": false }

Actual Results

  "msg": "unable to parse key data",
  "exception": "  File \"/tmp/ansible_community.aws.ec2_win_password_payload_332yxndk/ansible_community.aws.ec2_win_password_payload.zip/ansible_collections/community/aws/plugins/modules/ec2_win_password.py\", line 191, in ec2_win_password\n  File \"/usr/lib64/python3.8/site-packages/cryptography/hazmat/primitives/serialization/base.py\", line 16, in load_pem_private_key\n    return backend.load_pem_private_key(data, password)\n  File \"/usr/lib64/python3.8/site-packages/cryptography/hazmat/backends/openssl/backend.py\", line 1085, in load_pem_private_key\n    return self._load_key(\n  File \"/usr/lib64/python3.8/site-packages/cryptography/hazmat/backends/openssl/backend.py\", line 1315, in _load_key\n    self._handle_key_loading_error()\n  File \"/usr/lib64/python3.8/site-packages/cryptography/hazmat/backends/openssl/backend.py\", line 1373, in _handle_key_loading_error\n    raise ValueError(\"Could not deserialize key data.\")\n",
  "invocation": {
    "module_args": {
      "instance_id": "i-01ab28292d221d962",
      "region": "us-west-1",
      "key_data": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
      "wait": true,
      "wait_timeout": 45,
      "access_key": "OMITTED",
      "secret_key": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
      "validate_certs": true,
      "debug_botocore_endpoint_logs": false,
      "session_token": null,
      "profile": null,
      "endpoint_url": null,
      "aws_ca_bundle": null,
      "aws_config": null,
      "key_file": null,
      "key_passphrase": null
    }
  },
  "warnings": [
    "botocore < 1.25.0 is not supported or tested.  Some features may not work.",
    "boto3 < 1.22.0 is not supported or tested.  Some features may not work."
  ],
  "_ansible_no_log": false,
  "changed": false
}

Code of Conduct

  • [X] I agree to follow the Ansible Code of Conduct

ericcames avatar Sep 01 '23 20:09 ericcames