This article provides an example of how database and database users can be managed via the edX configuration repository
Step-by-step guide
- This guide assumes that you have cloned the edX configuration repository and installed the python requirements.
Change to the configuration/playbooks /edx-east directory.
Create a database configuration file named, say db-config.yml, with the following structure. You will need to customize this for your own purposes including adding strong passwords. This also assumes that you already have a root account on the MySQL instance you will be using.
Code Block |
---|
---
database_connection: &default_connection
login_host: "localhost"
login_user: "root"
login_password: "secret"
DEFAULT_ENCODING: "utf8"
databases:
edxapp:
state: "present"
encoding: "{{ DEFAULT_ENCODING }}"
<<: *default_connection
dashboard:
state: "present"
encoding: "{{ DEFAULT_ENCODING }}"
<<: *default_connection
database_users:
migrate:
state: "present"
password: "migrate_secret"
host: "%"
privileges:
- "edxapp%.*:SELECT,INSERT,UPDATE,DELETE,ALTER,CREATE,DROP,INDEX"
- "dashboard%.*:SELECT,INSERT,UPDATE,DELETE,ALTER,CREATE,DROP,INDEX"
<<: *default_connection
dash:
state: "present"
password: "dash_secret"
host: "%"
privileges:
- "dashboard.*:SELECT,INSERT,UPDATE,DELETE"
<<: *default_connection |
Run ansible as follows
Code Block |
---|
ansible-playbook -i 'localhost,' create_db_and_users.yml -e@/path/to/db-config.yml --ask-sudo-pass |
Related articles
Filter by label (Content by label) |
---|
showLabels | false |
---|
max | 5 |
---|
spaces | DEVOPS |
---|
showSpace | false |
---|
sort | modified |
---|
reverse | true |
---|
type | page |
---|
cql | label = "kb-how-to-article" and type = "page" and space = "DEVOPS" |
---|
labels | kb-how-to-article |
---|
|