Delegate share type creation to setup host

Instead of running manilaclient on manila host, we're delegating
execution to service_setup_host. This reduce
complexity and remove some requirements for manila hosts.

With that we also replace usage of manilaclient
with openstackclient.

Depends-On: https://review.opendev.org/c/openstack/openstack-ansible/+/845998
Change-Id: Ie04d9e1690e0f053e86e28e0bf1d6c3aa43774b0
This commit is contained in:
Dmitriy Rabotyagov 2022-06-15 12:18:06 +02:00 committed by Dmitriy Rabotyagov
parent 4bff5b4352
commit 0db9f1f959
2 changed files with 25 additions and 30 deletions

View File

@ -223,7 +223,6 @@ manila_service_in_ldap: "{{ service_ldap_backend_enabled | default(False) }}"
# Common pip packages # Common pip packages
manila_pip_packages: manila_pip_packages:
- "git+{{ manila_git_repo }}@{{ manila_git_install_branch }}#egg=manila" - "git+{{ manila_git_repo }}@{{ manila_git_install_branch }}#egg=manila"
- python-manilaclient
- cryptography - cryptography
- ecdsa - ecdsa
- httplib2 - httplib2
@ -231,7 +230,6 @@ manila_pip_packages:
- osprofiler - osprofiler
- PyMySQL - PyMySQL
- pymemcache - pymemcache
- python-openstackclient
- python-memcached - python-memcached
- systemd-python - systemd-python

View File

@ -13,33 +13,30 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
- name: Ensure manila api is available - name: Create share types from setup_host
uri: delegate_to: "{{ manila_service_setup_host }}"
url: "{{ manila_service_internaluri }}" vars:
status_code: 200,300 ansible_python_interpreter: "{{ manila_service_setup_host_python_interpreter }}"
validate_certs: "{{ manila_service_internaluri_insecure | bool }}" block:
register: api_status
until: api_status is success
retries: 10
delay: 10
# TODO(odyssey4me): - name: Ensure manila api is available
# Once these tasks can be replaced by using Ansible modules instead, uri:
# we should do that and use the delegation to the service setup host url: "{{ manila_service_internaluri }}"
# so that we can remove the openrc file from the target host. status_code: 200,300
- name: Implement openrc/clouds.yaml validate_certs: "{{ manila_service_internaluri_insecure | bool }}"
include_role: register: api_status
name: "openstack_openrc" until: api_status is success
retries: 10
delay: 10
- name: Add in manila devices types - name: Add in manila devices types
shell: | shell: |
. {{ ansible_facts['env']['HOME'] }}/openrc . {{ ansible_facts['env']['HOME'] }}/openrc
CLI_OPTIONS="--endpoint-type internalURL {{ ((keystone_service_adminuri_insecure | bool) or (manila_service_internaluri_insecure | bool)) | ternary('--insecure','') }}" CLI_OPTIONS="--os-interface internal {{ ((keystone_service_adminuri_insecure | bool) or (manila_service_internaluri_insecure | bool)) | ternary('--insecure','') }}"
if ! {{ manila_bin }}/manila ${CLI_OPTIONS} type-list | grep -q "{{ item.key }}"; then if ! openstack ${CLI_OPTIONS} share type list | grep -q "{{ item.key }}"; then
{{ manila_bin }}/manila ${CLI_OPTIONS} type-create "{{ item.key }}" "{{ item.value.driver_handles_share_servers }}" openstack ${CLI_OPTIONS} share type create "{{ item.key }}" "{{ item.value.driver_handles_share_servers }}" --extra-specs "share_backend_name={{ item.value.share_backend_name }}"
{{ manila_bin }}/manila ${CLI_OPTIONS} type-key "{{ item.key }}" set "share_backend_name={{ item.value.share_backend_name }}" fi
fi args:
args: executable: /bin/bash
executable: /bin/bash with_dict: "{{ _manila_backends | default({}) }}"
with_dict: "{{ _manila_backends | default({}) }}" changed_when: false
changed_when: false