I'm trying to use this github_key
community module to add an SSH publickey to a Github account.
(I installed the community module with ansible-galaxy collection install community.general
)
In my task list, I -
- Read the
publickey
- Call
github_key
(withlocal_action
) to add that key to the Github account
- name: Read SSH key for jeeves@github.com
shell: 'cat /home/jeeves/.ssh/jeeves@github.com.pub'
register: ssh_pub_key
- name: Upload SSH key for jeeves@github.com
local_action:
module: github_key
name: 'Key for jeeves@my-server.dev'
token: '{{ github_token }}'
pubkey: '{{ ssh_pub_key.stdout }}'
force: yes
When I run it get this error (in module_stderr
output):
[sudo via ansible, key=<REDACTED>] password:
sudo: no password was provided
sudo: 1 incorrect password attempt
I guess it can't find my sudo
password for the user.
But I am providing a sudo
password, and there are 30+ other tasks before this (not shown here) where it was able to successfully execute commands. In fact in my playbook definition I use become
:
- hosts: all
become: yes
become_method: sudo
become_user: root
gather_facts: yes
#...
I think the issue is caused by local_action
since it's having trouble even executing the module itself.
Thanks!