Add Manila key generation and distribution

Change-Id: I2515dc4abf93f2d30157a376c8a9a497c865aaf5
This commit is contained in:
Mohammed Naser 2020-02-20 15:32:30 +01:00 committed by Dmitriy Rabotyagov
parent 3a7d20720a
commit a045397c57
3 changed files with 33 additions and 1 deletions

View File

@ -288,3 +288,11 @@ manila_api_uwsgi_ini_overrides: {}
manila_environment_overrides:
Service:
Environment: "PATH={{ manila_bin }}:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
# Manila keypair
#
# The following path ontains the keypair which will be used for SSH. It requires that
# the same file with a trailing .pub exists as well if using an existing key. If this
# is set and a key cannot be found it will generate one.
#
# manila_keypair_path: /etc/openstack_deploy/id_rsa

View File

@ -115,7 +115,14 @@
tags:
- manila-config
- import_tasks: manila_db_sync.yml
- import_tasks: manila_keys.yml
when:
- manila_keypair_path is defined
- manila_services['manila-share']['group'] in group_names
tags:
- manila-config
- include_tasks: manila_db_sync.yml
when:
- _manila_is_first_play_host
tags:

17
tasks/manila_keys.yml Normal file
View File

@ -0,0 +1,17 @@
---
- name: Create SSH keypair
run_once: true
delegate_to: localhost
openssh_keypair:
path: "{{ manila_keypair_path }}"
- name: Distribute SSH keypair
copy:
src: "{{ item }}"
dest: "/etc/manila/{{ item | basename }}"
owner: "{{ manila_system_user_name }}"
group: "{{ manila_system_group_name }}"
mode: 0600
loop:
- "{{ manila_keypair_path }}.pub"
- "{{ manila_keypair_path }}"