From 0f809c77997e3f43bad62f985e124afe68818d8a Mon Sep 17 00:00:00 2001 From: phil Date: Thu, 4 Jan 2024 10:25:54 +0100 Subject: [PATCH] Loop through database hosts --- tasks/configuration.yml | 6 ++++-- templates/pma.php.j2 | 5 +++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/tasks/configuration.yml b/tasks/configuration.yml index 3e56623..1d474f7 100644 --- a/tasks/configuration.yml +++ b/tasks/configuration.yml @@ -5,7 +5,8 @@ state: present login_unix_socket: "{{ mysql_socket }}" login_user: root - delegate_to: "{{ phpmyadmin_database_host }}" + delegate_to: "{{ item }}" + loop: "{{ phpmyadmin_database_host }}" - name: "Configuration | Create database user" community.mysql.mysql_user: @@ -17,7 +18,8 @@ login_unix_socket: "{{ mysql_socket }}" login_user: root update_password: on_create - delegate_to: "{{ phpmyadmin_database_host }}" + delegate_to: "{{ item }}" + loop: "{{ phpmyadmin_database_host }}" - name: "Configuration | Copy configuration" ansible.builtin.template: diff --git a/templates/pma.php.j2 b/templates/pma.php.j2 index 1e07a92..9a83044 100644 --- a/templates/pma.php.j2 +++ b/templates/pma.php.j2 @@ -22,9 +22,10 @@ foreach ($hosts as $verbose => $host) { $cfg['Servers'][$i]['extension'] = 'mysqli'; $cfg['Servers'][$i]['compress'] = FALSE; $cfg['Servers'][$i]['auth_type'] = 'cookie'; + $cfg['Servers'][$i]['pmadb'] = '{{ phpmyadmin_database }}'; $cfg['Servers'][$i]['controlhost'] = $host; $cfg['Servers'][$i]['controlport'] = '3306'; - $cfg['Servers'][$i]['controluser'] = '{{ phpmyadmin_dbuser }}'; - $cfg['Servers'][$i]['controlpass'] = '{{ phpmyadmin_dbpass }}'; + $cfg['Servers'][$i]['controluser'] = '{{ phpmyadmin_database }}'; + $cfg['Servers'][$i]['controlpass'] = '{{ phpmyadmin_database_password }}'; } {% endif %}