From cbc0bf009dc59c483c88ce32a50c016874cd5363 Mon Sep 17 00:00:00 2001
From: Pawel Wieczorek
Date: Tue, 16 Jun 2020 12:05:14 +0200
Subject: Add Ansible roles for OpenStack hosts
Key pair is generated upon host creation and removed after the host is
destroyed.
This patch is based on previous work by:
Krzysztof Opasiak
Issue-ID: INT-1601
Change-Id: I9acd0b68a3ee79a0d710c40e0a1cc8470dfacce5
Signed-off-by: Pawel Wieczorek
---
.../openstack/create_devstack_keypair/tasks/main.yml | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
create mode 100644 deployment/noheat/infra-openstack/ansible/roles/openstack/create_devstack_keypair/tasks/main.yml
(limited to 'deployment/noheat/infra-openstack/ansible/roles/openstack/create_devstack_keypair')
diff --git a/deployment/noheat/infra-openstack/ansible/roles/openstack/create_devstack_keypair/tasks/main.yml b/deployment/noheat/infra-openstack/ansible/roles/openstack/create_devstack_keypair/tasks/main.yml
new file mode 100644
index 000000000..4ac8a48f1
--- /dev/null
+++ b/deployment/noheat/infra-openstack/ansible/roles/openstack/create_devstack_keypair/tasks/main.yml
@@ -0,0 +1,19 @@
+- name: Create keypair
+ os_keypair:
+ state: present
+ name: "{{ keypair.name }}"
+ register: keypair
+
+- name: Create local public key
+ local_action:
+ module: copy
+ content: "{{ keypair.key.public_key }}"
+ dest: "~/.ssh/{{ keypair.key.name }}.pub"
+ mode: 0600
+
+- name: Create local private key
+ local_action:
+ module: copy
+ content: "{{ keypair.key.private_key }}"
+ dest: "~/.ssh/{{ keypair.key.name }}"
+ mode: 0600
--
cgit 1.2.3-korg