Skip to content

Instantly share code, notes, and snippets.

@keeth
Last active Aug 29, 2015
Embed
What would you like to do?
{{ 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