64 lines
2.5 KiB
YAML
64 lines
2.5 KiB
YAML
---
|
|
- name: ensure packages required for resultsdb are installed (yum)
|
|
yum: name={{ item }} state=present
|
|
when: deployment_type == 'prod' or deployment_type == 'local'
|
|
with_items:
|
|
- resultsdb
|
|
- mod_wsgi
|
|
- python-psycopg2
|
|
- libsemanage-python
|
|
|
|
- name: ensure packages required for resultsdb are installed (dnf)
|
|
dnf: name={{ item }} state=present enablerepo={{ extra_enablerepos }}
|
|
when: ansible_distribution_major_version|int > 21 and ansible_cmdline.ostree is not defined
|
|
with_items:
|
|
- resultsdb
|
|
- mod_wsgi
|
|
- python-psycopg2
|
|
- libsemanage-python
|
|
|
|
- name: ensure database is created
|
|
delegate_to: "{{ resultsdb_db_host_machine }}"
|
|
sudo_user: postgres
|
|
sudo: true
|
|
postgresql_db: db={{ resultsdb_db_name }}
|
|
|
|
- name: ensure resultsdb db user has access to database
|
|
when: deployment_type == 'dev' or deployment_type == 'local'
|
|
delegate_to: "{{ resultsdb_db_host_machine }}"
|
|
sudo_user: postgres
|
|
sudo: true
|
|
postgresql_user: db={{ resultsdb_db_name }} user={{ resultsdb_db_user }} password={{ resultsdb_db_password }} role_attr_flags=NOSUPERUSER
|
|
|
|
- name: ensure stg resultsdb db user has access to stg database
|
|
when: deployment_type == 'stg'
|
|
delegate_to: "{{ resultsdb_db_host }}"
|
|
sudo_user: postgres
|
|
sudo: true
|
|
postgresql_user: db={{ resultsdb_db_name }} user={{ stg_resultsdb_db_user }} password={{ stg_resultsdb_db_password }} role_attr_flags=NOSUPERUSER
|
|
|
|
- name: ensure prod resultsdb db user has access to prod database
|
|
when: deployment_type == 'prod'
|
|
delegate_to: "{{ resultsdb_db_host }}"
|
|
sudo_user: postgres
|
|
sudo: true
|
|
postgresql_user: db={{ resultsdb_db_name }} user={{ prod_resultsdb_db_user }} password={{ prod_resultsdb_db_password }} role_attr_flags=NOSUPERUSER
|
|
|
|
- name: ensure selinux lets httpd talk to postgres
|
|
seboolean: name=httpd_can_network_connect_db persistent=yes state=yes
|
|
|
|
- name: generate resultsdb config
|
|
template: src=settings.py.j2 dest=/etc/resultsdb/settings.py owner=root group=root mode=0644
|
|
notify:
|
|
- reload httpd
|
|
|
|
- name: generate resultsdb apache config
|
|
template: src=resultsdb.conf.j2 dest=/etc/httpd/conf.d/resultsdb.conf owner=root group=root mode=0644
|
|
notify:
|
|
- reload httpd
|
|
|
|
# this command will clear the exising database and it's now being run every time, regardless of whether
|
|
# /etc/resultsdb-is-init exists or not. We've already lost a lot of data, so commenting this command out
|
|
# while we figure out how to handle the problem
|
|
#- name: initialize resultsdb database
|
|
# shell: PROD='true' resultsdb init_db && touch /etc/resultsdb/db-is-init creates=/etc/resultsdb-is-init
|