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/web/infra/ansible/vars/global.yml
|
||||||
- /srv/private/ansible/vars.yml
|
- /srv/private/ansible/vars.yml
|
||||||
- /srv/web/infra/ansible/vars/{{ ansible_distribution }}.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:
|
handlers:
|
||||||
- import_tasks: "{{ handlers_path }}/restart_services.yml"
|
- import_tasks: "{{ handlers_path }}/restart_services.yml"
|
||||||
|
|
||||||
tasks:
|
tasks:
|
||||||
- shell: oc -n koschei scale dc/build-resolver --replicas=0
|
- name: Stop backend services
|
||||||
- shell: oc -n koschei scale dc/repo-resolver --replicas=0
|
shell: oc -n koschei scale dc/{{item.name}} --replicas=0
|
||||||
- shell: oc -n koschei scale dc/scheduler --replicas=0
|
with_items: "{{ koschei_backend_services }}"
|
||||||
- shell: oc -n koschei scale dc/polling --replicas=0
|
|
||||||
- shell: oc -n koschei scale dc/frontend --replicas=0
|
- name: Stop frontend
|
||||||
- postgresql_db: name=koschei state=absent
|
shell: oc -n koschei scale dc/frontend --replicas=0
|
||||||
|
|
||||||
|
- name: Drop koschei database
|
||||||
|
postgresql_db: name=koschei state=absent
|
||||||
become: yes
|
become: yes
|
||||||
become_user: postgres
|
become_user: postgres
|
||||||
delegate_to: db01.stg.phx2.fedoraproject.org
|
delegate_to: "{{ koschei_pgsql_hostname }}"
|
||||||
- postgresql_db: name=koschei owner=koscheiadmin
|
|
||||||
|
- name: Create empty koschei database
|
||||||
|
postgresql_db: name=koschei owner=koscheiadmin
|
||||||
become: yes
|
become: yes
|
||||||
become_user: postgres
|
become_user: postgres
|
||||||
delegate_to: db01.stg.phx2.fedoraproject.org
|
delegate_to: "{{ koschei_pgsql_hostname }}"
|
||||||
- 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
|
- name: Populate koschei database with schema and initial data
|
||||||
- shell: oc -n koschei delete job/job-db-create
|
include_role: name=openshift-apps/koschei/job
|
||||||
- shell: oc -n koschei scale dc/frontend --replicas=2
|
vars:
|
||||||
- shell: oc -n koschei scale dc/polling --replicas=1
|
name: db-create
|
||||||
- shell: oc -n koschei scale dc/scheduler --replicas=1
|
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"
|
||||||
- shell: oc -n koschei scale dc/repo-resolver --replicas=1
|
|
||||||
- shell: oc -n koschei scale dc/build-resolver --replicas=1
|
- 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] }}"
|
max_cpu: "{{ item.cpu[1] }}"
|
||||||
min_mem: "{{ item.memory[0] }}"
|
min_mem: "{{ item.memory[0] }}"
|
||||||
max_mem: "{{ item.memory[1] }}"
|
max_mem: "{{ item.memory[1] }}"
|
||||||
with_items:
|
with_items: "{{ 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 ] }
|
|
||||||
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"
|
|
||||||
loop_control:
|
loop_control:
|
||||||
label: "{{ item.name }}"
|
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:
|
labels:
|
||||||
service: frontend
|
service: frontend
|
||||||
spec:
|
spec:
|
||||||
replicas: 2
|
replicas: {{koschei_frontend_replicas}}
|
||||||
selector:
|
selector:
|
||||||
service: frontend
|
service: frontend
|
||||||
strategy:
|
strategy:
|
||||||
|
|
|
@ -13,3 +13,11 @@ koschei_bugzilla: bugzilla5.redhat.com
|
||||||
|
|
||||||
koschei_oidc_client_secret: "{{ koschei_oidc_client_secret_stg }}"
|
koschei_oidc_client_secret: "{{ koschei_oidc_client_secret_stg }}"
|
||||||
koschei_oidc_crypto_secret: "{{ koschei_oidc_crypto_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