Albirew/nyaa-pantsu
Archivé
1
0
Bifurcation 0

Restore db and populate es from playbook

Cette révision appartient à :
tomleb 2017-05-17 18:18:03 -04:00
Parent d757a9006a
révision f398e936e4
2 fichiers modifiés avec 27 ajouts et 0 suppressions

Voir le fichier

@ -0,0 +1,13 @@
- name: Populate elasticsearch index from database
hosts: dbs
roles:
- common
- postgresql
- elasticsearch
tasks:
- name: Index the database into elasticsearch
command: python "{{ nyaapantsu_directory }}/index_nyaapantsu.py"
environment:
PANTSU_DBPARAMS: "host=localhost port={{ nyaapantsu_pgpool_port }} user={{ nyaapantsu_user }} dbname={{ nyaapantsu_dbname }} sslmode=disable password={{ nyaapantsu_password }}"
PANTSU_ELASTICSEARCH_INDEX: "{{ nyaapantsu_elasticsearch_index }}"

Voir le fichier

@ -0,0 +1,14 @@
- name: Restore database
hosts: dbs
roles:
- common
- postgresql
tasks:
- name: Copy backup database
copy:
src: ../../nyaa_psql.backup
dest: "{{ nyaapantsu_directory }}"
- name: Restore database from backup
command: pg_restore -U "{{ nyaapantsu_user }}" -d "{{ nyaapantsu_dbname }}" "{{ nyaapantsu_directory }}/nyaa_psql.backup"