blob: 5194230e6fdb6bc263af2e20e8973842ec8dce2a [file] [log] [blame]
David K. Bainbridge8b179042016-11-30 15:38:42 -08001---
2- name: Ensure key pair storage
3 become: yes
4 local_action: file path=/etc/maas/.ssh owner=root group=root mode="0755" state=directory
5
6- name: Validate existing key pair
7 become: yes
8 local_action: stat path=/etc/maas/.ssh/cord_rsa
9 register: key_pair
10
11- name: Generate key pair
12 become: yes
13 local_action: command ssh-keygen -b 2048 -t rsa -N "" -C cord@cord.lab -f /etc/maas/.ssh/cord_rsa
14 when: not key_pair.stat.exists
15
16- name: Ensure privacy of key pair
17 become: yes
18 local_action: file path="/etc/maas/.ssh/{{item.name}}" mode="{{item.mode}}" owner=root group=root
19 with_items:
20 - { "name": "cord_rsa", "mode": "0644" }
21 - { "name": "cord_rsa.pub", "mode": "0644" }