Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
drupal
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Service Desk
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Ansible
Roles
drupal
Commits
4dcb696e
Commit
4dcb696e
authored
8 years ago
by
jurgenhaas
Browse files
Options
Downloads
Patches
Plain Diff
#3 Use explicit credentials to create dbs and users
parent
e9a0262e
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
tasks/install.yml
+0
-19
0 additions, 19 deletions
tasks/install.yml
tasks/main.yml
+11
-3
11 additions, 3 deletions
tasks/main.yml
tasks/mysql.yml
+37
-0
37 additions, 0 deletions
tasks/mysql.yml
with
48 additions
and
22 deletions
tasks/install.yml
+
0
−
19
View file @
4dcb696e
...
...
@@ -172,24 +172,5 @@
-
crontabs
tags
:
'
cron'
-
name
:
"
Ensure
Database"
mysql_db
:
name='{{ item.db.name }}'
state='present'
with_items
:
'
{{
drupal.domains
}}'
-
name
:
"
Create
MySQL
User"
mysql_user
:
user='{{ item.0.db.username }}'
password='{{ item.0.db.password|default(mysql_root_password|default("root")) }}'
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
}}'
]
when
:
item.0.db.username is defined and item.0.db.username != 'root'
notify
:
"
MySQL
|
Restart
MySQL"
-
name
:
"
Set
Extended
Permissions"
command
:
setfacl -dRm u:{{ apacheUser }}:rwX,g:{{ apacheUser }}:rwX,o::rX {{ webRoot }}/files
This diff is collapsed.
Click to expand it.
tasks/main.yml
+
11
−
3
View file @
4dcb696e
...
...
@@ -19,7 +19,15 @@
when
:
'
"letsencrypt"
not
in
excluded_roles'
-
name
:
"
Install
Drupal"
include
:
install.yml
with_items
:
'
{{
drupal_settings
}}'
-
block
:
-
name
:
"
Install
Drupal"
include
:
install.yml
with_items
:
'
{{
drupal_settings
}}'
-
name
:
"
Install
Drupal
Databases
and
Users"
include
:
mysql.yml
with_subelements
:
-
'
{{
drupal_settings
}}'
-
domains
when
:
'
"drupal"
not
in
excluded_roles
and
drupal_install_drupal'
This diff is collapsed.
Click to expand it.
tasks/mysql.yml
0 → 100644
+
37
−
0
View file @
4dcb696e
---
# file: roles/drupal/tasks/mysql.yml
-
block
:
-
set_fact
:
domain='{{ item.1 }}'
-
set_fact
:
port='3306'
-
set_fact
:
port='{{ hostvars[item.db.host|default(inventory_hostname)]["ssh_tunnel_ports"][0]["local"] }}'
when
:
hostvars[domain.db.host|default(inventory_hostname)]["ssh_tunnel_ports"] is defined
tags
:
always
-
name
:
"
Ensure
Database"
mysql_db
:
name='{{ domain.db.name }}'
login_user='root'
login_password='{{ mysql_root_password|default("root") }}'
login_host='127.0.0.1'
login_port='{{ port }}'
state='present'
-
name
:
"
Create
MySQL
User"
mysql_user
:
user='{{ domain.db.username }}'
password='{{ domain.db.password|default(mysql_root_password|default("root")) }}'
host='{{ item }}'
check_implicit_admin=yes
priv='{{ domain.db.name }}.*:ALL'
login_user='root'
login_password='{{ mysql_root_password|default("root") }}'
login_host='127.0.0.1'
login_port='{{ port }}'
with_items
:
-
'
localhost'
-
'
127.0.0.1'
-
'
::1'
-
'
{{
inventory_hostname
}}'
when
:
domain.db.username is defined and domain.db.username != 'root'
notify
:
"
MySQL
|
Restart
MySQL"
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment