I use the “authorized_key” module (https://docs.ansible.com/ansible/authorized_key_module.html), for adding SSH keys to the admins of our boxes.
Today I had to use one of my playbooks against a box that only has Python3. I learned about the “ansible_python_interpreter=/usr/bin/python3” variable I had to set, and my playbook worked through everything until I got to the “authorized_key” where it failed. I tried the same playbook against an Ubuntu box that still has Python2.7 and it worked fine. So it seems to be only the Python3.
Here is the task:
- name: Add SSH keys for the administrators
authorized_key:
user: bhuddleston
key: https://github.com/bhuddleston.keys
state: present
Here is the Error:
{
“changed”: false,
“failed”: true,
“module_stderr”: “Shared connection to collector.oitd.net closed.\r\n”,
“module_stdout”: “Traceback (most recent call last):\r\n File "/tmp/ansible__ftramx6/ansible_module_authorized_key.py", line 527, in \r\n main()\r\n File "/tmp/ansible__ftramx6/ansible_module_authorized_key.py", line 523, in main\r\n results = enforce_state(module, module.params)\r\n File "/tmp/ansible__ftramx6/ansible_module_authorized_key.py", line 433, in enforce_state\r\n key = [s for s in key.splitlines() if s and not s.startswith(‘#’)]\r\n File "/tmp/ansible__ftramx6/ansible_module_authorized_key.py", line 433, in \r\n key = [s for s in key.splitlines() if s and not s.startswith(‘#’)]\r\nTypeError: startswith first arg must be bytes or a tuple of bytes, not str\r\n”,
“msg”: “MODULE FAILURE”
}
Is this the place to mention this or can I be directed to the correct support channel/group?