Add a playbook to sync prod bodhi with staging (and it works\!)
This commit is contained in:
parent
fd9a42222e
commit
8200101ff9
1 changed files with 71 additions and 0 deletions
71
playbooks/manual/staging-sync/bodhi.yml
Normal file
71
playbooks/manual/staging-sync/bodhi.yml
Normal file
|
@ -0,0 +1,71 @@
|
|||
# This playbook syncs the production bodhi instance with staging.
|
||||
|
||||
|
||||
- name: bring staging services down (httpd)
|
||||
hosts: bodhi2-stg
|
||||
user: root
|
||||
vars_files:
|
||||
- /srv/web/infra/ansible/vars/global.yml
|
||||
- "/srv/private/ansible/vars.yml"
|
||||
- /srv/web/infra/ansible/vars/{{ ansible_distribution }}.yml
|
||||
|
||||
tasks:
|
||||
- service: name=httpd state=stopped
|
||||
|
||||
- name: bring staging services down (fedmsg-hub)
|
||||
hosts: bodhi-backend-stg
|
||||
user: root
|
||||
vars_files:
|
||||
- /srv/web/infra/ansible/vars/global.yml
|
||||
- "/srv/private/ansible/vars.yml"
|
||||
- /srv/web/infra/ansible/vars/{{ ansible_distribution }}.yml
|
||||
|
||||
tasks:
|
||||
- service: name=fedmsg-hub state=stopped
|
||||
|
||||
# Here's the meaty part in the middle
|
||||
- name: drop and re-create the staging db entirely
|
||||
hosts: db01.stg.phx2.fedoraproject.org
|
||||
user: root
|
||||
become: yes
|
||||
become_user: postgres
|
||||
become_method: sudo
|
||||
|
||||
vars_files:
|
||||
- /srv/web/infra/ansible/vars/global.yml
|
||||
- "/srv/private/ansible/vars.yml"
|
||||
- /srv/web/infra/ansible/vars/{{ ansible_distribution }}.yml
|
||||
handlers:
|
||||
- include: "{{ handlers }}/restart_services.yml"
|
||||
|
||||
tasks:
|
||||
- copy: src=/srv/web/infra/db-dumps/bodhi2.dump.xz dest=/var/tmp/bodhi2.dump.xz
|
||||
owner=postgres group=postgres
|
||||
- command: unxz /var/tmp/bodhi2.dump.xz
|
||||
creates=/var/tmp/bodhi2.dump
|
||||
- command: dropdb bodhi2
|
||||
- command: createdb -O bodhi2 bodhi2
|
||||
- name: Import the prod db.
|
||||
shell: cat /var/tmp/bodhi2.dump | psql bodhi2
|
||||
|
||||
- name: bring staging services up (httpd)
|
||||
hosts: bodhi2-stg
|
||||
user: root
|
||||
vars_files:
|
||||
- /srv/web/infra/ansible/vars/global.yml
|
||||
- "/srv/private/ansible/vars.yml"
|
||||
- /srv/web/infra/ansible/vars/{{ ansible_distribution }}.yml
|
||||
|
||||
tasks:
|
||||
- service: name=httpd state=started
|
||||
|
||||
- name: bring staging services up (fedmsg-hub)
|
||||
hosts: bodhi-backend-stg
|
||||
user: root
|
||||
vars_files:
|
||||
- /srv/web/infra/ansible/vars/global.yml
|
||||
- "/srv/private/ansible/vars.yml"
|
||||
- /srv/web/infra/ansible/vars/{{ ansible_distribution }}.yml
|
||||
|
||||
tasks:
|
||||
- service: name=fedmsg-hub state=started
|
Loading…
Add table
Add a link
Reference in a new issue