ansible.posix icon indicating copy to clipboard operation
ansible.posix copied to clipboard

authorized_key support GITHUB_TOKEN

Open Gibby opened this issue 2 years ago • 4 comments

SUMMARY

Support GITHUB_TOKEN for pulling the key. This will allow using Github Enterprise instances to pull the key from.

ISSUE TYPE
  • Feature Idea
COMPONENT NAME

authorized_key

ADDITIONAL INFORMATION

Gibby avatar Sep 09 '21 14:09 Gibby

+1

mbradleySoftrams avatar Oct 01 '21 13:10 mbradleySoftrams

Hi, thank you for reporting this.

If your request is for GITHUB_TOKEN support when you specified URL as a key parameter like below,

  • https://github.com/ansible-collections/ansible.posix/blob/main/plugins/modules/authorized_key.py#L91-L101

I think you probably need to request it to the ansible core side because authorized_key module is just using fetch_url() method that is defined in urls.py in ansible core:

  • https://github.com/ansible-collections/ansible.posix/blob/main/plugins/modules/authorized_key.py#L558
  • https://github.com/ansible/ansible/blob/devel/lib/ansible/module_utils/urls.py#L1701-L1703

Please let me know if I misunderstood your situation.

saito-hideki avatar Oct 18 '21 05:10 saito-hideki

@saito-hideki correct, looking at https://github.com/ansible/ansible/blob/8510db4935a27fd190614a2cb7d41628a0f24def/lib/ansible/module_utils/urls.py#L1701 headers are supported, just tested and the following works

curl -H "Authorization: token xxxxxxxxxxxxxxxx" https://github.MYUSERNAME/api/v3/users/MYUSERNAME/keys

Chris-Softrams avatar Nov 04 '21 15:11 Chris-Softrams

I tried doing https://[email protected]/api/v3/users/MYUSERNAME/keys which works with curl, but the response is in JSON

Chris-Softrams avatar Nov 04 '21 18:11 Chris-Softrams