noheat: Upgrades, refactor, deploy Devstack
[integration.git] / deployment / noheat / infra-openstack / ansible / roles / create_keypair / tasks / main.yml
1 - name: Create keypair
2   os_keypair:
3     state: present
4     name: "{{ keypair.name }}"
5   register: keypair
6
7 - name: Create local public key
8   copy:
9     content: "{{ keypair.key.public_key }}"
10     dest: "~/.ssh/{{ keypair.key.name }}.pub"
11     mode: 0600
12   delegate_to: localhost
13
14 - name: Check if local private key exists
15   stat:
16     path: "~/.ssh/{{ keypair.key.name }}"
17   register: local_private_key
18
19 - name: Create local private key
20   copy:
21     content: "{{ keypair.key.private_key }}"
22     dest: "~/.ssh/{{ keypair.key.name }}"
23     mode: 0600
24   delegate_to: localhost
25   when: not local_private_key.stat.exists