A try at a playbook to sync a subset of prod lookaside to stg.

This commit is contained in:
Ralph Bean 2015-06-29 15:31:37 +00:00
parent 9232a74ba6
commit 984a62390f

View file

@ -0,0 +1,67 @@
# This playbook syncs a *subset* of the production lookaside cache to stg.
# bochecha asked for this in 2015 -- implemented by ralph.
#
# Presently, we only do the packages that start with 'a', because there's just
# too much data otherwise.
- name: tar up a subset of the prod lookaside cache
hosts: pkgs
user: root
vars_files:
- /srv/web/infra/ansible/vars/global.yml
- "/srv/private/ansible/vars.yml"
- /srv/web/infra/ansible/vars/{{ ansible_distribution }}.yml
vars:
tarball: /var/tmp/prod-lookaside-subset.tar.xz
intermediary: /var/tmp/prod-lookaside
target: /srv/cache/lookaside/pkgs
tasks:
- shell: tar -cJvf {{tarball}} {{target}}/a*
creates={{tarball}}
- fetch: src={{tarball}}
dest={{intermediary}}
fail_on_missing=yes
- name: copy and expand that subset to staging lookaside
hosts: pkgs-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
vars:
tarball: /var/tmp/prod-lookaside-subset.tar.xz
intermediary: /var/tmp/prod-lookaside
target: /srv/cache/lookaside/pkgs
tasks:
- unarchive: src={{intermediary}}/pkgs02.phx2.fedoraproject.org/{{tarball}}
dest={{target}}
#- copy: src={{intermediary}}/pkgs02.phx2.fedoraproject.org/{{tarball}}
# dest={{tarball}}
#- command: tar -xJvf {{tarball}}
# chdir={{target}}
#- name: clean up the tarball we copied there
# file: dest={{tarball}} state=absent
- name: finish cleaning up after ourselves
hosts: lockbox;pkgs;pkgs-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
vars:
tarball: /var/tmp/prod-lookaside-subset.tar.xz
intermediary: /var/tmp/prod-lookaside
target: /srv/cache/lookaside/pkgs
tasks:
- file: dest={{intermediary}} state=absent
- file: dest={{tarball}} state=absent