From d49537538a226b6521d04821673e713ab155de12 Mon Sep 17 00:00:00 2001 From: Chris Hines <chris.hines@monash.edu> Date: Fri, 30 Oct 2015 10:00:58 +1100 Subject: [PATCH] allows the mysql server to take a group of hosts to authorize users on instead of a single host --- roles/mysql/tasks/mysql_server.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/roles/mysql/tasks/mysql_server.yml b/roles/mysql/tasks/mysql_server.yml index a5066a34..1d2d054f 100644 --- a/roles/mysql/tasks/mysql_server.yml +++ b/roles/mysql/tasks/mysql_server.yml @@ -33,3 +33,9 @@ - name: "Giving priviliges to user" mysql_user: name={{ mysql_user_name }} host={{ mysql_user_host }} password={{ mysql_user_password }} login_user=root login_password={{ mysql_root_password }} priv={{ mysql_user_db_name }}.*:ALL state=present + when: mysql_user_host is defined + +- name: "Giving priviliges to user" + mysql_user: name={{ mysql_user_name }} host={{ hostvars[item].ansible_fqdn }} password={{ mysql_user_password }} login_user=root login_password={{ mysql_root_password }} priv={{ mysql_user_db_name }}.*:ALL state=present + with_items: mysql_user_hosts_group + when: mysql_user_hosts_group is defined -- GitLab