Skip to content
Snippets Groups Projects
Commit 80cb0645 authored by James Graham's avatar James Graham
Browse files

Set DB password in Ansible script from .env file - #19

parent bfcd9884
No related branches found
No related tags found
No related merge requests found
...@@ -139,6 +139,11 @@ DATABASES = { ...@@ -139,6 +139,11 @@ DATABASES = {
), ),
} }
DATABASES['default'].update({
'USER': config('DATABASE_USER'),
'PASSWORD': config('DATABASE_PASSWORD'),
})
mongoengine.register_connection( mongoengine.register_connection(
host=config( host=config(
'PROV_DATABASE_URL', 'PROV_DATABASE_URL',
......
...@@ -140,13 +140,21 @@ ...@@ -140,13 +140,21 @@
name: 'pedasi' name: 'pedasi'
state: present state: present
- name: Create DB user - name: Create DB user - dev settings
mysql_user: mysql_user:
name: 'pedasi' name: "{{ lookup('ini', 'DATABASE_USER type=properties file=deploy/.env.dev') }}"
# TODO generate a real password password: "{{ lookup('ini', 'DATABASE_PASSWORD type=properties file=deploy/.env.dev') }}"
password: 'pedasi'
state: present state: present
priv: 'pedasi.*:ALL' priv: 'pedasi.*:ALL'
when: production is not defined
- name: Create DB user - prod settings
mysql_user:
name: "{{ lookup('ini', 'DATABASE_USER type=properties file=deploy/.env.prod') }}"
password: "{{ lookup('ini', 'DATABASE_PASSWORD type=properties file=deploy/.env.prod') }}"
state: present
priv: 'pedasi.*:ALL'
when: production is defined
- name: Set permissions on project directory - name: Set permissions on project directory
file: file:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment