refactoring resultsdb to support different credentials for dev/stg/prod
This commit is contained in:
parent
dcec1c12cc
commit
d3d7f2cbea
3 changed files with 32 additions and 5 deletions
|
@ -8,3 +8,5 @@ volgroup: /dev/VirtGuests
|
||||||
eth0_ip: 10.5.124.205
|
eth0_ip: 10.5.124.205
|
||||||
vmhost: virthost-comm02.qa.fedoraproject.org
|
vmhost: virthost-comm02.qa.fedoraproject.org
|
||||||
datacenter: phx2
|
datacenter: phx2
|
||||||
|
|
||||||
|
deployment_type: dev
|
||||||
|
|
|
@ -5,17 +5,32 @@
|
||||||
- mod_wsgi
|
- mod_wsgi
|
||||||
- python-psycopg2
|
- python-psycopg2
|
||||||
|
|
||||||
- name: ensure database is created
|
- name: ensure dev database is created
|
||||||
delegate_to: "{{ resultsdb_db_host }}"
|
delegate_to: "{{ resultsdb_db_host }}"
|
||||||
sudo_user: postgres
|
sudo_user: postgres
|
||||||
sudo: true
|
sudo: true
|
||||||
action: postgresql_db db={{ resultsdb_db_name }}
|
action: postgresql_db db={{ resultsdb_db_name }}
|
||||||
|
|
||||||
- name: ensure resultsdb user has access to database
|
- name: ensure production resultsdb user has access to prod database
|
||||||
|
when: deployment_type == 'prod'
|
||||||
delegate_to: "{{ resultsdb_db_host }}"
|
delegate_to: "{{ resultsdb_db_host }}"
|
||||||
sudo_user: postgres
|
sudo_user: postgres
|
||||||
sudo: true
|
sudo: true
|
||||||
action: postgresql_user db={{ resultsdb_db_name }} user={{ resultsdb_db_user }} password={{ resultsdb_db_password }} role_attr_flags=NOSUPERUSER
|
action: postgresql_user db={{ resultsdb_db_name }} user={{ resultsdb_db_user }} password={{ prod_resultsdb_db_password }} role_attr_flags=NOSUPERUSER
|
||||||
|
|
||||||
|
- name: ensure stg resultsdb user has access to stg database
|
||||||
|
when: deployment_type == 'stg'
|
||||||
|
delegate_to: "{{ resultsdb_db_host }}"
|
||||||
|
sudo_user: postgres
|
||||||
|
sudo: true
|
||||||
|
action: postgresql_user db={{ resultsdb_db_name }} user={{ resultsdb_db_user }} password={{ stg_resultsdb_db_password }} role_attr_flags=NOSUPERUSER
|
||||||
|
|
||||||
|
- name: ensure resultsdb user has access to dev database
|
||||||
|
when: deployment_type == 'dev'
|
||||||
|
delegate_to: "{{ resultsdb_db_host }}"
|
||||||
|
sudo_user: postgres
|
||||||
|
sudo: true
|
||||||
|
action: postgresql_user db={{ resultsdb_db_name }} user={{ resultsdb_db_user }} password={{ dev_resultsdb_db_password }} role_attr_flags=NOSUPERUSER
|
||||||
|
|
||||||
- name: ensure selinux lets httpd talk to postgres
|
- name: ensure selinux lets httpd talk to postgres
|
||||||
seboolean: name=httpd_can_network_connect_db persistent=yes state=yes
|
seboolean: name=httpd_can_network_connect_db persistent=yes state=yes
|
||||||
|
|
|
@ -1,5 +1,15 @@
|
||||||
SECRET_KEY = '{{ resultsdb_secret_key }}'
|
{%- if deployment_type == 'prod' %}
|
||||||
SQLALCHEMY_DATABASE_URI = 'postgresql+psycopg2://{{ resultsdb_db_user }}:{{ resultsdb_db_password }}@{{ resultsdb_db_host }}:{{ resultsdb_db_port }}/{{ resultsdb_db_name }}'
|
SECRET_KEY = '{{ prod_resultsdb_secret_key }}'
|
||||||
|
SQLALCHEMY_DATABASE_URI = 'postgresql+psycopg2://{{ resultsdb_db_user }}:{{ prod_resultsdb_db_password }}@{{ resultsdb_db_host }}:{{ resultsdb_db_port }}/{{ resultsdb_db_name }}'
|
||||||
|
{% endif %}
|
||||||
|
{%- if deployment_type == 'stg' %}
|
||||||
|
SECRET_KEY = '{{ stg_resultsdb_secret_key }}'
|
||||||
|
SQLALCHEMY_DATABASE_URI = 'postgresql+psycopg2://{{ resultsdb_db_user }}:{{ stg_resultsdb_db_password }}@{{ resultsdb_db_host }}:{{ resultsdb_db_port }}/{{ resultsdb_db_name }}'
|
||||||
|
{% endif %}
|
||||||
|
{%- if deployment_type == 'dev' %}
|
||||||
|
SECRET_KEY = '{{ dev_resultsdb_secret_key }}'
|
||||||
|
SQLALCHEMY_DATABASE_URI = 'postgresql+psycopg2://{{ resultsdb_db_user }}:{{ dev_resultsdb_db_password }}@{{ resultsdb_db_host }}:{{ resultsdb_db_port }}/{{ resultsdb_db_name }}'
|
||||||
|
{% endif %}
|
||||||
FILE_LOGGING = False
|
FILE_LOGGING = False
|
||||||
LOGFILR = '/var/log/resultsdb/resultsdb.log'
|
LOGFILR = '/var/log/resultsdb/resultsdb.log'
|
||||||
SYSLOG_LOGGING = False
|
SYSLOG_LOGGING = False
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue