Restore db and populate es from playbook
Cette révision appartient à :
Parent
d757a9006a
révision
f398e936e4
2 fichiers modifiés avec 27 ajouts et 0 suppressions
13
deploy/ansible/populate_elasticsearch_index.yml
Fichier normal
13
deploy/ansible/populate_elasticsearch_index.yml
Fichier normal
|
@ -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 }}"
|
14
deploy/ansible/restore_database.yml
Fichier normal
14
deploy/ansible/restore_database.yml
Fichier normal
|
@ -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"
|
Référencer dans un nouveau ticket