User Tools

Site Tools


wiki:clone_remote_ansible_git_module_using_ssh_key

Clone remote repository with ansible git module using ssh key

You can use your ssh agent to forward the keys to the remote server, however when running ansible on one remote host and deploying to another, for example when triggering ansible from a Rundeck job easiest is to copy the private key file on the remote host. e.g. in the playbook add task

...
- name: Ensure ssh deploy key is present on the server.
  copy:
    content: "{{ deploy_private_key }}"
    dest: /tmp/deploy_key
    mode: 0600
 ...

- name: 'Delete private key'
  file:
    path: "/tmp/deploy_key"
    state: absent
  tags: deploy_artifact

Tested on

  • Debian 10
  • Bitbucket cloud

See also

References

wiki/clone_remote_ansible_git_module_using_ssh_key.txt · Last modified: 2022/03/14 14:34 by antisa

Except where otherwise noted, content on this wiki is licensed under the following license: CC0 1.0 Universal
CC0 1.0 Universal Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki