Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add key_file path option #222

Open
djdanielsson opened this issue Jul 20, 2023 · 5 comments
Open

add key_file path option #222

djdanielsson opened this issue Jul 20, 2023 · 5 comments

Comments

@djdanielsson
Copy link

djdanielsson commented Jul 20, 2023

SUMMARY

it would be really helpful if you could add a key_file path option to the modules to point to specific private key file to gain permissions to private repos.

ISSUE TYPE
  • Feature Idea
COMPONENT NAME
ADDITIONAL INFORMATION

to allow easier usage of private key files to access private repos

- name: Commit and Push changes
  ansible.scm.git_publish:
    path: "{{ git_path }}"
    user:
      name: "David Danielsson"
    key_file: "{{ lookup('env', 'MY_CERT_FILE_PATH') }}"
@cidrblock
Copy link
Collaborator

It would seem the best way to do this would be:

If the key_file was provided, run:

git config core.sshCommand 'ssh -i private_key_file'

The one question I have is would it be enough to only issue the command in the git_retrieve plugin? Or should we support it for both git_retreive and git_publish?

Assuming git_retreive is always used prior to git_publish, the configuration would have already been set for the repo.

Having it in both places may be confusing and preceived as required.....

@djdanielsson
Copy link
Author

If it is in just retrieve I would at least make note in the documentation on publish that it is an option inherited from retrieve

@termlen0
Copy link

termlen0 commented Jan 4, 2024

+1. I'm not sure if I'm missing something in the options documented for the module but how exactly is the key file supplied for this module as implemented right now?

@jmm-repo
Copy link

Was there any solution provided?
this works fine with public repos or using a token with private repos.

@djdanielsson
Copy link
Author

It's been a while since I messed with this but if I remember correctly, if you use the retrieve module there is a way to add a key file info which would be used on publish module

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants