--- /dev/null
+{%- set key_type = salt['pillar.get']('git:deploy:priv-key-type', 'RSA') -%}
+{%- set key_val = salt['pillar.get']('git:deploy:priv-key-val', 'bla').strip() -%}
+-----BEGIN {{ key_type }} PRIVATE KEY-----
+{{ key_val }}
+-----END {{ key_type }} PRIVATE KEY-----
--- /dev/null
+{%- set key_type = salt['pillar.get']('git:deploy:pub-key-type', 'ssh-rsa') -%}
+{%- set key_val = salt['pillar.get']('git:deploy:pub-key-val', 'bla').replace(' ', '').strip() -%}
+{%- set key_comment = salt['pillar.get']('git:deploy:pub-key-comment', 'Git deploy') -%}
+{{ key_type }} {{ key_val }} {{ key_comment }}
--- /dev/null
+{%- set key_type = salt['pillar.get']('git:deploy:pub-key-type', 'ssh-rsa').replace('ssh-', '') -%}
+
+root-ssh-dir:
+ file.directory:
+ - name: /root/.ssh
+ - user: root
+ - group: root
+ - dir_mode: 700
+
+root-git-deploy-key-priv:
+ file.managed:
+ - name: /root/.ssh/id_{{ key_type }}.git-deploy
+ - source: salt://utils/files/id-git-deploy.priv
+ - user: root
+ - group: root
+ - mode: 600
+ - backup: minion
+ - template: jinja
+ - backup: minion
+ - require:
+ - file: root-ssh-dir
+
+root-git-deploy-key-pub:
+ file.managed:
+ - name: /root/.ssh/id_{{ key_type }}.git-deploy.pub
+ - source: salt://utils/files/id-git-deploy.pub
+ - user: root
+ - group: root
+ - mode: 644
+ - backup: minion
+ - template: jinja
+ - backup: minion
+ - require:
+ - file: root-ssh-dir