diff --git a/deploy/ansible/populate_elasticsearch_index.yml b/deploy/ansible/populate_elasticsearch_index.yml new file mode 100644 index 00000000..fe3720d2 --- /dev/null +++ b/deploy/ansible/populate_elasticsearch_index.yml @@ -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 }}" diff --git a/deploy/ansible/restore_database.yml b/deploy/ansible/restore_database.yml new file mode 100644 index 00000000..af1e96e5 --- /dev/null +++ b/deploy/ansible/restore_database.yml @@ -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"