From 3d3ab570d6903f95ee48f141b19b158dfcf533d8 Mon Sep 17 00:00:00 2001 From: Dorian Pula Date: Tue, 24 Mar 2015 08:10:20 -0400 Subject: [PATCH] Migrate setup and configuration of environment variables into role. --- config/rookeries_webapp_config.cfg | 21 --------------------- defaults/main.yml | 23 +++++++++++++++++++++++ meta/main.yml | 3 ++- tasks/mysql_db.yaml | 3 +-- 4 files changed, 26 insertions(+), 24 deletions(-) delete mode 100644 config/rookeries_webapp_config.cfg diff --git a/config/rookeries_webapp_config.cfg b/config/rookeries_webapp_config.cfg deleted file mode 100644 index 4646799..0000000 --- a/config/rookeries_webapp_config.cfg +++ /dev/null @@ -1,21 +0,0 @@ -# Basic environmental -ENVIRONMENTAL_NAME = "Vagrant" -TESTING = False -DEBUG = True - -# Password salts + secrets -PASSWORD_SALT = "secret" -SECRET_KEY = "development" -USER_REGISTRATION_INVITE_KEY = None - -# Database -DATABASE_URI = "mysql+mysqlconnector://rookeries:penguin2013flight@localhost:3306/rookeries?charset=utf8" - -# Mail server configuration -MAIL_SERVER = "localhost" -MAIL_PORT = 25 -MAIL_USERNAME = "admin@rookeri.es" -MAIL_PASSWORD = "password" -MAIL_DEFAULT_SENDER = "admin@rookeri.es" -MAIL_USE_TLS = False -MAIL_USE_SSL = False diff --git a/defaults/main.yml b/defaults/main.yml index 8b497b3..b7fd83d 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -12,3 +12,26 @@ rookeries_app_name: rookeries # The mode of the setup. Setting to "dev" enables the use of a SMTP fake server to help with development. rookeries_environ_type: dev + +# The default configuration for running rookeries +rookeries_app_config: + + # Basic environmental + rookeries_environmental_name: "Vagrant" + rookeries_debug: true + + # Password salts + secrets + rookeries_password_salt: "secret" + rookeries_secret_key: "development" + + # Database + rookeries_database_uri: "mysql+mysqlconnector://{{ rookeries_db. username}}:{{ rookeries_db.password }}@localhost:3306/{{ rookeries_db.db_name }}?charset=utf8" + + # Mail server configuration + rookeries_mail_server: "localhost" + rookeries_mail_port: 25 + rookeries_mail_username: "" + rookeries_mail_password: "" + rookeries_mail_default_sender: "admin@local_rookeries_install.localhost.net" + rookeries_mail_use_tls: false + rookeries_mail_use_ssl: false diff --git a/meta/main.yml b/meta/main.yml index cedc1fc..5a974a8 100644 --- a/meta/main.yml +++ b/meta/main.yml @@ -125,4 +125,5 @@ dependencies: app_name: "{{ rookeries_app_name }}", app_nginx_hostname: localhost, app_uwsgi_port: 8001, - app_uwsgi_executable: "rookeries:make_rookeries_app()" } + app_uwsgi_executable: "rookeries:make_rookeries_app()", + app_uwsgi_envs: "{{ rookeries_app_config }}"} diff --git a/tasks/mysql_db.yaml b/tasks/mysql_db.yaml index 117f233..85b48a8 100644 --- a/tasks/mysql_db.yaml +++ b/tasks/mysql_db.yaml @@ -6,8 +6,7 @@ - python-mysqldb - name: setup MySQL databases for rookeries. - mysql_db: name={{ item.key }} state=present - with_dict: databases + mysql_db: name={{ rookeries_db.db_name }} state=present - name: add MySQL database users for rookeries. mysql_user: name={{ rookeries_db.username }} password={{ rookeries_db.password }} priv={{ rookeries_db.db_name }}:ALL