Add _oslodb_login_host to db_setup tasks.

The ansible mysql modules defaults to localhost, which means that the
db_setup tasks fail if the mysql processes are bound to the mgmt
interface.

This change adds an extra variable _oslodb_login_host for the db_setup
tasks which is defaulted to _oslodb_setup_host if a specific value is
not defined.

Change-Id: I531109213953f78263be68968f8e9d2dc2fd382a
This commit is contained in:
Jonathan Rosser 2019-07-18 11:40:59 +01:00 committed by Dmitriy Rabotyagov (noonedeadpunk)
parent 60555c925e
commit d4ae89792d

View File

@ -22,12 +22,16 @@
- 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
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
@ -38,5 +42,7 @@
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