Create User Using Ansible with Authenticate Pem File
I suspect what is happening here is you are trying to insert the private key into the authorized_keys file, which is invalid as only the public key is required on the target machine.

What you need to do is extract the public key from the private key:

- name: Generate an OpenSSL public key with a passphrase protected private key
  openssl_publickey:
    path: /tmp/key-{{ item.username }}.pub
    privatekey_path: {{ item.pem_file_path }}
    privatekey_passphrase: ansible
    format: OpenSSH
  with_items:
    - "{{ users }}"


and then use the public key:

- name: Set Authorized key token from the file
  become: true
  authorized_key:
    user: "{{ item.username }}"
    state: present
    key: "{{ lookup('file', '/tmp/key-{{ item.username }}.pub') }}"
  with_items:
    - "{{ users }}"