0
0
ssh-key-rotation-role/tasks/generate_key.yml
Thomas Nyambati af016b1ec1 ft(ssh): deployment key
- add capability to add seperate deployment key
- add capability to not generate new key
2017-02-22 15:52:01 +03:00

18 lines
545 B
YAML

# tasks file for ssh-key-rotation
- name: Generate a new ssh Key
command:
ssh-keygen
-t rsa
-b {{ ssh_key_bits }}
-N "{{ passphrase }}" -q
-f {{ lookup('env','HOME')}}/{{ ssh_key_path }}
-C {{ ssh_key_comment }}
when: inventory_hostname == play_hosts[0]
args:
creates: "{{ lookup('env','HOME') + '/' + ssh_key_path }}"
delegate_to: localhost
- name: Store then value of the ssh key path
set_fact:
ssh_connection_key: "{{ lookup('file', lookup('env','HOME') + '/' + ssh_key_path + '.pub') }}"