From 1d30a5b2e1dc02f0042d44a35a9682d12e962fd7 Mon Sep 17 00:00:00 2001 From: jurgenhaas <juergen@paragon-es.de> Date: Tue, 18 Jul 2017 15:24:10 +0200 Subject: [PATCH] ansible-inventories/knime#112 Allow external users to access some of MySQL --- tasks/mysql.yml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/tasks/mysql.yml b/tasks/mysql.yml index 2409ba4..4bcdd41 100644 --- a/tasks/mysql.yml +++ b/tasks/mysql.yml @@ -4,6 +4,8 @@ - set_fact: db='{{ drupal_domain.db }}' extra={{ drupal_domain.db.extra|default([]) }} + external={{ drupal_domain.db.external|default([]) }} + external_hosts={{ drupal_domain.db.external_hosts|default([]) }} tags: always - name: "Ensure Database" @@ -60,3 +62,20 @@ - ['localhost', '127.0.0.1', '::1'] when: item.0.username is defined and item.0.username != 'root' ignore_errors: true + +- name: "Create external MySQL Users" + mysql_user: + user='{{ item.0.username|default("root") }}' + password='{{ item.0.password|default(mysql_root_password|default("root")) }}' + host='{{ item.1 }}' + check_implicit_admin=yes + priv='{{ item.0.priv }}' + login_user='root' + login_password='{{ mysql_root_password|default("root") }}' + login_host='127.0.0.1' + login_port='{{ item.0.port|default('3306') }}' + with_nested: + - '{{ external }}' + - '{{ external_hosts }}' + when: item.0.username is defined and item.0.username != 'root' + ignore_errors: true -- GitLab