From 4cb24dd580d6d53d3bcc381bebb7b9cb26ba6e9c Mon Sep 17 00:00:00 2001 From: Dorian Pula Date: Tue, 12 May 2015 23:30:39 -0400 Subject: [PATCH] Add support to conditionally setup the database. --- README.md | 3 +++ defaults/main.yml | 1 + tasks/mysql_db.yaml | 3 +++ 3 files changed, 7 insertions(+) diff --git a/README.md b/README.md index 6867e2d..aab42e8 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/defaults/main.yml b/defaults/main.yml index 6494cb5..5f9b270 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -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 diff --git a/tasks/mysql_db.yaml b/tasks/mysql_db.yaml index 85b48a8..62b2390 100644 --- a/tasks/mysql_db.yaml +++ b/tasks/mysql_db.yaml @@ -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