Skip to content

Instantly share code, notes, and snippets.

@keeth
Last active August 29, 2015 14:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save keeth/0c9b9b628041c63ea381 to your computer and use it in GitHub Desktop.
Save keeth/0c9b9b628041c63ea381 to your computer and use it in GitHub Desktop.
{{ pillar['git_deploy_keys'][repo][type] }}
{% for repo in pillar.get('git_deploy_keys', {}) %}
{% for type in ['private'] %}
git-deploy-key-{{ repo }}-{{ type }}-pem:
file.managed:
- name: /root/.ssh/id_rsa_{{ repo }}.{{ type }}
- source: salt://files/git_deploy_key.pem
- template: jinja
- user: root
- group: root
- mode: 600
- defaults:
repo: {{ repo }}
type: {{ type }}
{% endfor %}
{% endfor %}
git_deploy_keys:
cms:
private: |
-----BEGIN RSA PRIVATE KEY-----
-----END RSA PRIVATE KEY-----
salt:
private: |
-----BEGIN RSA PRIVATE KEY-----
-----END RSA PRIVATE KEY-----
secrets:
private: |
-----BEGIN RSA PRIVATE KEY-----
-----END RSA PRIVATE KEY-----
ssh:
aliases:
github-salt:
HostName: github.com
User: git
IdentityFile: /root/.ssh/id_rsa_salt.private
github-cms:
HostName: github.com
User: git
IdentityFile: /root/.ssh/id_rsa_cms.private
github-secrets:
HostName: github.com
User: git
IdentityFile: /root/.ssh/id_rsa_secrets.private
{%- set hosts = salt['pillar.get']('ssh:aliases') -%}
{%- if hosts %}
{%- for host, options in hosts.items() %}
Host {{ host }}
{%- for k, v in options.items() %}
{{ k }} {{ v }}
{%- endfor %}
{% endfor %}
{%- endif -%}
ssh_config:
file.managed:
- name: /root/.ssh/config
- source: salt://files/ssh_config.jinja
- template: jinja
- user: root
- group: root
- mode: 600
github.com:
ssh_known_hosts:
- present
- user: root
- fingerprint: 16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment