Use common service setup tasks from a collection rather than in-role

Change-Id: I643e9a6bb14538cee1e8d235c55bca408cc031f0
This commit is contained in:
Marc Gariepy 2022-05-05 09:56:34 -04:00
parent 1fc98a9dfb
commit 1a63052a9b
2 changed files with 8 additions and 52 deletions

View File

@ -1,48 +0,0 @@
---
# Copyright 2019, VEXXHOST, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# WARNING:
# This file is maintained in the openstack-ansible-tests repository.
# https://git.openstack.org/cgit/openstack/openstack-ansible-tests/tree/sync/tasks/db_setup.yml
# If you need to modify this file, update the one in the openstack-ansible-tests
# repository. Once it merges there, the changes will automatically be proposed to
# all the repositories which use it.
- name: Setup Database Service (MariaDB)
delegate_to: "{{ _oslodb_setup_host }}"
vars:
ansible_python_interpreter: "{{ _oslodb_ansible_python_interpreter }}"
tags:
- common-mariadb
block:
- name: Create database for service
community.mysql.mysql_db:
name: "{{ item.name }}"
login_host: "{{ _oslodb_setup_endpoint | default(omit) }}"
login_port: "{{ _oslodb_setup_port | default(omit) }}"
loop: "{{ _oslodb_databases }}"
no_log: true
- name: Grant access to the database for the service
community.mysql.mysql_user:
name: "{{ item.1.username }}"
password: "{{ item.1.password }}"
host: "{{ item.1.host | default('%') }}"
priv: "{{ item.0.name }}.*:{{ item.1.priv | default('ALL') }}"
append_privs: yes
login_host: "{{ _oslodb_setup_endpoint | default(omit) }}"
login_port: "{{ _oslodb_setup_port | default(omit) }}"
loop: "{{ _oslodb_databases | subelements('users') }}"
no_log: true

View File

@ -25,8 +25,13 @@
tags:
- always
- import_tasks: db_setup.yml
when: inventory_hostname == groups['utility_all'][0]
- include_role:
name: openstack.osa.db_setup
apply:
tags:
- common-db
- rally-config
vars:
_oslodb_setup_host: "{{ rally_db_setup_host }}"
_oslodb_ansible_python_interpreter: "{{ rally_db_setup_python_interpreter }}"
@ -38,8 +43,7 @@
- username: "{{ rally_galera_user }}"
password: "{{ rally_galera_password }}"
tags:
- common-db
- rally-config
- always
- include_tasks: rally_pre_install.yml
tags: