Skip to content
Snippets Groups Projects
Commit 315ad4fe authored by jurgenhaas's avatar jurgenhaas
Browse files

ansible-inventories/arocom#28 Implement site specific mysql users and password as an option

parent 8231a9d8
No related branches found
No related tags found
No related merge requests found
......@@ -177,5 +177,18 @@
state='present'
with_items: '{{ drupal.domains }}'
# TODO: We should also do the below user config for all extra db's of each domain if present.
- name: "Create MySQL User"
mysql_user:
user='{{ item.0.db.username|default("root") }}'
password='{{ item.0.db.password|default(mysql_root_password) }}'
host='{{ item.1 }}'
check_implicit_admin=yes
priv='{{ item.0.db.name }}.*:ALL'
with_nested:
- '{{ drupal.domains }}'
- ['localhost', '127.0.0.1', '::1', '{{ inventory_hostname }}']
notify: "MySQL | Restart MySQL"
- name: "Set Extended Permissions"
command: setfacl -dRm u:{{ apacheUser }}:rwX,g:{{ apacheUser }}:rwX,o::rX {{ webRoot }}/files
<?php
$db_url = 'mysql://root:{{ mysql_root_password }}@127.0.0.1/{{ item.db.name }}';
$db_url = 'mysql://{{ item.db.username|default("root") }}:{{ item.db.password|default(mysql_root_password) }}@127.0.0.1/{{ item.db.name }}';
$db_prefix = '{{ item.db.prefix|default("") }}';
$update_free_access = FALSE;
......
......@@ -5,8 +5,8 @@ $databases = array (
'default' => array (
'driver' => '{{ item.db.driver|default("mysql") }}',
'database' => '{{ item.db.name }}',
'username' => 'root',
'password' => '{{ mysql_root_password }}',
'username' => '{{ item.db.username|default("root") }}',
'password' => '{{ item.db.password|default(mysql_root_password) }}',
'host' => '{{ item.db.host|default("127.0.0.1") }}',
'port' => '{{ hostvars[item.db.host|default(inventory_hostname)]["ssh_tunnel_ports"][0]["local"] }}',
),
......@@ -16,8 +16,8 @@ $databases = array (
'default' => array (
'driver' => '{{ db.driver|default("mysql") }}',
'database' => '{{ db.name }}',
'username' => 'root',
'password' => '{{ mysql_root_password }}',
'username' => '{{ db.username|default(item.db.username|default("root")) }}',
'password' => '{{ db.password|default(item.db.password|default(mysql_root_password)) }}',
'host' => '{{ item.db.host|default("127.0.0.1") }}',
'port' => '{{ hostvars[item.db.host|default(inventory_hostname)]["ssh_tunnel_ports"][0]["local"] }}',
),
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment