K
Size: a a a
K
AS
generate_ssh_keys_for_{{ username }}:
cmd.run:
- name: "ssh-keygen -t rsa -q -f {{ home }}/.ssh/id_rsa -P ''"
- creates: {{ home }}/.ssh/id_rsa.pub
- runas: {{ username }}
- require:
- file: {{ home }}/.ssh
{%- if salt['file.file_exists'](home + '/.ssh/id_rsa.pub') %}
{%- set public_key = salt['cmd.shell']('cat ' + home + '/.ssh/id_rsa.pub') %}
{%- else %}
{%- set public_key = '' %}
{%- endif %}
grab_public_key:
grains.present:
- name: backup:ssh_key
- value: {{ public_key }}
- require:
- cmd: generate_ssh_keys_for_{{ username }}
'cat ' + home + '/.ssh/id_rsa.pub'
or something else? not to do execute this states twiceNK
т
NK
NK
K
NK
NK
K
NK
NK
K
K
NK
NK
NK
NK
NK