Koschei: refactor staging sync playbook
This commit is contained in:
parent
58f195b511
commit
4eff6615bf
5 changed files with 50 additions and 36 deletions
|
@ -13,28 +13,40 @@
|
|||
- /srv/web/infra/ansible/vars/global.yml
|
||||
- /srv/private/ansible/vars.yml
|
||||
- /srv/web/infra/ansible/vars/{{ ansible_distribution }}.yml
|
||||
- /srv/web/infra/ansible/roles/openshift-apps/koschei/vars/main.yml
|
||||
- /srv/web/infra/ansible/roles/openshift-apps/koschei/vars/{{ env }}.yml
|
||||
handlers:
|
||||
- import_tasks: "{{ handlers_path }}/restart_services.yml"
|
||||
|
||||
tasks:
|
||||
- shell: oc -n koschei scale dc/build-resolver --replicas=0
|
||||
- shell: oc -n koschei scale dc/repo-resolver --replicas=0
|
||||
- shell: oc -n koschei scale dc/scheduler --replicas=0
|
||||
- shell: oc -n koschei scale dc/polling --replicas=0
|
||||
- shell: oc -n koschei scale dc/frontend --replicas=0
|
||||
- postgresql_db: name=koschei state=absent
|
||||
- name: Stop backend services
|
||||
shell: oc -n koschei scale dc/{{item.name}} --replicas=0
|
||||
with_items: "{{ koschei_backend_services }}"
|
||||
|
||||
- name: Stop frontend
|
||||
shell: oc -n koschei scale dc/frontend --replicas=0
|
||||
|
||||
- name: Drop koschei database
|
||||
postgresql_db: name=koschei state=absent
|
||||
become: yes
|
||||
become_user: postgres
|
||||
delegate_to: db01.stg.phx2.fedoraproject.org
|
||||
- postgresql_db: name=koschei owner=koscheiadmin
|
||||
delegate_to: "{{ koschei_pgsql_hostname }}"
|
||||
|
||||
- name: Create empty koschei database
|
||||
postgresql_db: name=koschei owner=koscheiadmin
|
||||
become: yes
|
||||
become_user: postgres
|
||||
delegate_to: db01.stg.phx2.fedoraproject.org
|
||||
- shell: oc -n koschei apply -f /etc/openshift_apps/koschei/db-create-job.yml
|
||||
- shell: oc -n koschei wait job/job-db-create --for condition=complete
|
||||
- shell: oc -n koschei delete job/job-db-create
|
||||
- shell: oc -n koschei scale dc/frontend --replicas=2
|
||||
- shell: oc -n koschei scale dc/polling --replicas=1
|
||||
- shell: oc -n koschei scale dc/scheduler --replicas=1
|
||||
- shell: oc -n koschei scale dc/repo-resolver --replicas=1
|
||||
- shell: oc -n koschei scale dc/build-resolver --replicas=1
|
||||
delegate_to: "{{ koschei_pgsql_hostname }}"
|
||||
|
||||
- name: Populate koschei database with schema and initial data
|
||||
include_role: name=openshift-apps/koschei/job
|
||||
vars:
|
||||
name: db-create
|
||||
command: "koschei-admin create-db && koschei-admin create-collection f29 --display-name 'Fedora Rawhide' --target f29 --bugzilla-product Fedora --bugzilla-version rawhide && koschei-admin create-group php"
|
||||
|
||||
- name: Start frontend
|
||||
shell: oc -n koschei scale dc/frontend --replicas={{koschei_frontend_replicas}}
|
||||
|
||||
- name: Start backend services
|
||||
shell: oc -n koschei scale dc/{{item.name}} --replicas=1
|
||||
with_items: "{{ koschei_backend_services }}"
|
||||
|
|
|
@ -47,24 +47,7 @@
|
|||
max_cpu: "{{ item.cpu[1] }}"
|
||||
min_mem: "{{ item.memory[0] }}"
|
||||
max_mem: "{{ item.memory[1] }}"
|
||||
with_items:
|
||||
- { name: polling, cpu: [ 1000, 1500 ], memory: [ 256, 512 ] }
|
||||
- { name: scheduler, cpu: [ 200, 500 ], memory: [ 64, 128 ] }
|
||||
- { name: build-resolver, cpu: [ 1000, 1500 ], memory: [ 1024, 4096 ] }
|
||||
- { name: repo-resolver, cpu: [ 2000, 8000 ], memory: [ 1024, 4096 ] }
|
||||
loop_control:
|
||||
label: "{{ item.name }}"
|
||||
|
||||
- name: Apply Job
|
||||
include_role: name=openshift/object
|
||||
vars:
|
||||
template: job.yml
|
||||
objectname: "{{ item.name }}-job.yml"
|
||||
name: "{{ item.name }}"
|
||||
command: "{{ item.command }}"
|
||||
with_items:
|
||||
- name: db-create
|
||||
command: "koschei-admin create-db && koschei-admin create-collection f29 --display-name 'Fedora Rawhide' --target f29 --bugzilla-product Fedora --bugzilla-version rawhide && koschei-admin create-group php"
|
||||
with_items: "{{ koschei_backend_services }}"
|
||||
loop_control:
|
||||
label: "{{ item.name }}"
|
||||
|
||||
|
|
11
roles/openshift-apps/koschei/job/tasks/main.yml
Normal file
11
roles/openshift-apps/koschei/job/tasks/main.yml
Normal file
|
@ -0,0 +1,11 @@
|
|||
- name: Start job
|
||||
include_role: name=openshift/object
|
||||
vars:
|
||||
template: job.yml
|
||||
objectname: job-{{name}}.yml
|
||||
|
||||
- name: Wait for job to complete
|
||||
shell: oc -n koschei wait job/job-{{name}} --for condition=complete
|
||||
|
||||
- name: Delete job
|
||||
shell: oc -n koschei delete job/job-{{name}}
|
|
@ -6,7 +6,7 @@ metadata:
|
|||
labels:
|
||||
service: frontend
|
||||
spec:
|
||||
replicas: 2
|
||||
replicas: {{koschei_frontend_replicas}}
|
||||
selector:
|
||||
service: frontend
|
||||
strategy:
|
||||
|
|
|
@ -13,3 +13,11 @@ koschei_bugzilla: bugzilla5.redhat.com
|
|||
|
||||
koschei_oidc_client_secret: "{{ koschei_oidc_client_secret_stg }}"
|
||||
koschei_oidc_crypto_secret: "{{ koschei_oidc_crypto_secret_stg }}"
|
||||
|
||||
koschei_frontend_replicas: 2
|
||||
|
||||
koschei_backend_services:
|
||||
- { name: polling, cpu: [ 1000, 1500 ], memory: [ 256, 512 ] }
|
||||
- { name: scheduler, cpu: [ 200, 500 ], memory: [ 64, 128 ] }
|
||||
- { name: build-resolver, cpu: [ 1000, 1500 ], memory: [ 1024, 4096 ] }
|
||||
- { name: repo-resolver, cpu: [ 2000, 8000 ], memory: [ 1024, 4096 ] }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue