Loop through database hosts

This commit is contained in:
phil 2024-01-04 10:25:54 +01:00
parent 82012ccb99
commit 0f809c7799
2 changed files with 7 additions and 4 deletions

View file

@ -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:

View file

@ -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 %}