Add support to conditionally setup the database.

This commit is contained in:
Dorian 2015-05-12 23:30:39 -04:00
parent ffae28aecc
commit 4cb24dd580
3 changed files with 7 additions and 0 deletions

View File

@ -47,6 +47,9 @@ Role Variables
- The database username for the above specified database.
- password:
- The database username for the above specified database.
- setup_db:
- Flag whether or not to setup the MySQL database directly on the host.
- Default: true
- rookeries_app_name:
- Configures the unique name of the rookeries app.
- Default: rookeries

View File

@ -6,6 +6,7 @@ rookeries_db:
db_name: rookeries
username: rookeries
password: system_admin
setup_db: true
# Name of the rookeries app
rookeries_app_name: rookeries

View File

@ -4,9 +4,12 @@
with_items:
- mysql-server
- python-mysqldb
when: rookeries_db.setup_db
- name: setup MySQL databases for rookeries.
mysql_db: name={{ rookeries_db.db_name }} state=present
when: rookeries_db.setup_db
- name: add MySQL database users for rookeries.
mysql_user: name={{ rookeries_db.username }} password={{ rookeries_db.password }} priv={{ rookeries_db.db_name }}:ALL
when: rookeries_db.setup_db