mirror of
https://pagure.io/fedora-infra/ansible.git
synced 2026-03-20 03:57:02 +08:00
135 lines
3.4 KiB
YAML
135 lines
3.4 KiB
YAML
---
|
|
- name: Prepare setting up the database
|
|
hosts: apps_dbserver:apps_dbserver_stg
|
|
gather_facts: no
|
|
user: root
|
|
|
|
tasks:
|
|
- name: Install psycopg2 for the postgresql ansible modules
|
|
ansible.builtin.package:
|
|
name: python3-psycopg2
|
|
state: present
|
|
tags:
|
|
- packages
|
|
|
|
- name: Setup PROD database
|
|
hosts: apps_dbserver
|
|
gather_facts: no
|
|
become: yes
|
|
become_user: postgres
|
|
vars_files:
|
|
- /srv/web/infra/ansible/vars/global.yml
|
|
- "/srv/private/ansible/vars.yml"
|
|
- "/srv/web/infra/ansible/vars/{{ ansible_distribution }}.yml"
|
|
|
|
tasks:
|
|
- name: Create the database user
|
|
community.postgresql.postgresql_user:
|
|
name: "{{ kanban_db_user }}"
|
|
password: "{{ kanban_db_pass }}"
|
|
- name: Create the database itself
|
|
community.postgresql.postgresql_db:
|
|
name: "{{ kanban_db_name }}"
|
|
owner: "{{ kanban_db_user }}"
|
|
encoding: UTF-8
|
|
- name: Test the database creation
|
|
community.postgresql.postgresql_db:
|
|
name: "{{ kanban_db_name }}"
|
|
owner: "{{ kanban_db_user }}"
|
|
encoding: UTF-8
|
|
|
|
- name: Setup STG database
|
|
hosts: apps_dbserver_stg
|
|
gather_facts: no
|
|
become: yes
|
|
become_user: postgres
|
|
vars_files:
|
|
- /srv/web/infra/ansible/vars/global.yml
|
|
- "/srv/private/ansible/vars.yml"
|
|
- "/srv/web/infra/ansible/vars/{{ ansible_distribution }}.yml"
|
|
|
|
tasks:
|
|
- name: Create the database user
|
|
community.postgresql.postgresql_user:
|
|
name: "{{ kanban_db_user }}"
|
|
password: "{{ kanban_db_pass_stg }}"
|
|
- name: Create the database itself
|
|
community.postgresql.postgresql_db:
|
|
name: "{{ kanban_db_name }}"
|
|
owner: "{{ kanban_db_user }}"
|
|
encoding: UTF-8
|
|
- name: Test the database creation
|
|
community.postgresql.postgresql_db:
|
|
name: "{{ kanban_db_name }}"
|
|
owner: "{{ kanban_db_user }}"
|
|
encoding: UTF-8
|
|
|
|
- name: Make the app be real
|
|
hosts: os_control[0]:os_control_stg[0]
|
|
user: root
|
|
gather_facts: false
|
|
|
|
vars_files:
|
|
- /srv/web/infra/ansible/vars/global.yml
|
|
- "/srv/private/ansible/vars.yml"
|
|
- /srv/web/infra/ansible/vars/{{ ansible_distribution }}.yml
|
|
|
|
roles:
|
|
- role: openshift/project
|
|
project_app: kanban
|
|
project_description: kanban
|
|
project_appowners:
|
|
- frantisekz
|
|
- jskladan
|
|
- lbrabec
|
|
- kparal
|
|
project_alert_users:
|
|
- frantisekz
|
|
tags:
|
|
- apply-appowners
|
|
|
|
- role: openshift/object
|
|
object_app: kanban
|
|
object_template: buildconfig.yml.j2
|
|
object_objectname: buildconfig.yml
|
|
|
|
- role: openshift/object
|
|
object_app: kanban
|
|
object_template: deployment.yml.j2
|
|
object_objectname: deployment.yml
|
|
|
|
- role: openshift/object
|
|
object_app: kanban
|
|
object_template: imagestream.yml.j2
|
|
object_objectname: imagestream.yml
|
|
|
|
- role: openshift/object
|
|
object_app: kanban
|
|
object_file: service.yml
|
|
object_objectname: service.yml
|
|
|
|
- role: openshift/object
|
|
object_app: kanban
|
|
object_template: secret.yml.j2
|
|
object_objectname: secret.yml
|
|
|
|
- role: openshift/object
|
|
object_app: kanban
|
|
object_template: cron.yml.j2
|
|
object_objectname: cron.yml
|
|
|
|
- role: openshift/route
|
|
route_app: kanban
|
|
route_name: kanban
|
|
route_host: "kanban.qa{{ env_suffix }}.fedoraproject.org"
|
|
route_serviceport: 8080-tcp
|
|
route_servicename: kanban-web
|
|
|
|
- role: openshift/start-build
|
|
start_build_app: kanban
|
|
start_build_buildname: kanban-build
|
|
start_build_objectname: kanban-build
|
|
tags:
|
|
- never
|
|
- build
|