diff options
author | Pawel Wieczorek <p.wieczorek2@samsung.com> | 2020-12-21 11:23:31 +0100 |
---|---|---|
committer | Bartek Grzybowski <b.grzybowski@partner.samsung.com> | 2021-01-07 10:34:50 +0000 |
commit | 5aaa9b4c5474879f316f2007e460bfb60c11948c (patch) | |
tree | 33ec456e52f0f0d5cfa4e34500b35500fb22b32f /deployment/noheat | |
parent | 798ff6d6f39bf8038f1b1391ccaf2223514adf78 (diff) |
Add local private key guard
Private key can be retrieved from OpenStack during keypair creation
only. Subsequent attempts to do so will result in getting an empty
string. If private key already exists on the local machine and there is
no guard local private key will be overwritten with an empty file.
This patch adds local private key guard which allows subsequent runs of
"create.yml" playbook without erasing local private key.
Issue-ID: INT-1601
Change-Id: If3b3bb088bc8a2f9494e21e1826ac68adcc7a2cb
Signed-off-by: Pawel Wieczorek <p.wieczorek2@samsung.com>
Diffstat (limited to 'deployment/noheat')
-rw-r--r-- | deployment/noheat/infra-openstack/ansible/roles/openstack/create_devstack_keypair/tasks/main.yml | 6 |
1 files changed, 6 insertions, 0 deletions
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 index 4ac8a48f1..a330875d8 100644 --- 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 @@ -11,9 +11,15 @@ dest: "~/.ssh/{{ keypair.key.name }}.pub" mode: 0600 +- name: Check if local private key exists + stat: + path: "~/.ssh/{{ keypair.key.name }}" + register: local_private_key + - name: Create local private key local_action: module: copy content: "{{ keypair.key.private_key }}" dest: "~/.ssh/{{ keypair.key.name }}" mode: 0600 + when: local_private_key.stat.exists == False |