Skip to content

Instantly share code, notes, and snippets.

@SebastienElet
Created December 8, 2015 11:48
Show Gist options
  • Select an option

  • Save SebastienElet/92919a2faf7f0bf903b4 to your computer and use it in GitHub Desktop.

Select an option

Save SebastienElet/92919a2faf7f0bf903b4 to your computer and use it in GitHub Desktop.
ansible install ssh keys
- name: install ssh keys
copy:
content: "{{ item.value }}"
dest: /home/www/.ssh/{{ item.key }}
mode: 0600
owner: www
with_dict: github_ssh_keys
no_log: True
- name: install ssh key
copy:
content: "{{ github_ssh_key }}"
dest: /home/www/.ssh/github_rsa
mode: 0600
owner: www
with_dict: github_ssh_key
no_log: True
- name: clone repo
git:
repo=git@github.com:*****/*****.git
dest=/home/www/myrepo
accept_hostkey=true
key_file=/home/www/.ssh/github_rsa
sudo: yes
sudo_user: www
register: git_clone
---
github_ssh_key: |
-----BEGIN RSA PRIVATE KEY-----
...
-----END RSA PRIVATE KEY-----
github_ssh_keys:
project1: |
-----BEGIN RSA PRIVATE KEY-----
...
-----END RSA PRIVATE KEY-----
frontend: |
-----BEGIN RSA PRIVATE KEY-----
...
-----END RSA PRIVATE KEY-----
@SebastienElet

Copy link
Copy Markdown
Author

The file vars.yml should be vaulted ofc

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment