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 = {
),
}
DATABASES['default'].update({
'USER': config('DATABASE_USER'),
'PASSWORD': config('DATABASE_PASSWORD'),
})
mongoengine.register_connection(
host=config(
'PROV_DATABASE_URL',
......
......@@ -140,13 +140,21 @@
name: 'pedasi'
state: present
- name: Create DB user
- name: Create DB user - dev settings
mysql_user:
name: 'pedasi'
# TODO generate a real password
password: 'pedasi'
name: "{{ lookup('ini', 'DATABASE_USER type=properties file=deploy/.env.dev') }}"
password: "{{ lookup('ini', 'DATABASE_PASSWORD type=properties file=deploy/.env.dev') }}"
state: present
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
file:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment