Commit 5218e2de by Jason Bau

add tasks that create phpmyadmin control role

parent 7d48bcab
......@@ -7,6 +7,8 @@ FPM_LISTENER: "127.0.0.1:19010"
INSTALL_PHPMYADMIN: true
MYSQL_SERVER_HOST: '127.0.0.1'
MYSQL_SERVER_PORT: 3307
MYSQL_SERVER_USER: 'root' # used only to create the PHPMYADMIN_CONTROL_USER
MYSQL_SERVER_PASS: '' # used only to create the PHPMYADMIN_CONTROL_USER
PHPMYADMIN_DBS_SHOWN:
- 'edxapp'
......
# Installs PHPMYADMIN
---
- name: installs phpmyadmin
apt: pkg=phpmyadmin state=present
- name: installs phpmyadmin (and python-mysqldb for later ansible tasks)
apt: pkg=phpmyadmin,python-mysqldb state=present
tags:
- php
- phpmyadmin
......@@ -33,3 +33,53 @@
- php
- phpmyadmin
- name: create phpmyadmin mysql conf user
mysql_user: >
login_host={{ MYSQL_SERVER_HOST }}
login_user={{ MYSQL_SERVER_USER }} login_password={{ MYSQL_SERVER_PASS }}
name={{ PHPMYADMIN_CONTROLUSER }} password={{ PHPMYADMIN_CONTROLPASS }}
state=present
tags:
- php
- phpmyadmin
- name: unzip db creation script that creates phpmyadmin db (so we can manipulate it)
command: gunzip /usr/share/doc/phpmyadmin/examples/create_tables.sql.gz
ignore_errors: true
tags:
- php
- phpmyadmin
- name: write desired phpmyadmin db to script
lineinfile: >
dest=/usr/share/doc/phpmyadmin/examples/create_tables.sql
regexp="^CREATE DATABASE IF NOT EXISTS.*$"
line="CREATE DATABASE IF NOT EXISTS `{{ PHPMYADIN_PMADB }}`"
tags:
- php
- phpmyadmin
- name: use desired phpmyadmin db in script
lineinfile: >
dest=/usr/share/doc/phpmyadmin/examples/create_tables.sql
regexp="^USE.*$"
line="USE `{{ PHPMYADIN_PMADB }}`;"
tags:
- php
- phpmyadmin
- name: run db creation script (creates phpmyadmin db)
shell: "mysql -h {{ MYSQL_SERVER_HOST }} -P {{ MYSQL_SERVER_PORT }} -u{{ MYSQL_SERVER_USER }} -p{{ MYSQL_SERVER_PASS }} < /usr/share/doc/phpmyadmin/examples/create_tables.sql"
tags:
- php
- phpmyadmin
- name: grant all on phpmyadin database to control user
mysql_user: >
login_host={{ MYSQL_SERVER_HOST }}
login_user={{ MYSQL_SERVER_USER }} login_password={{ MYSQL_SERVER_PASS }}
name={{ PHPMYADMIN_CONTROLUSER }}
priv={{ PHPMYADIN_PMADB }}.*:ALL
tags:
- php
- phpmyadmin
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment