From 297758e3eaabc219a09cb833c216f5e8e3ab7fa6 Mon Sep 17 00:00:00 2001 From: Jakub Czajka Date: Mon, 4 Dec 2023 10:44:57 +0100 Subject: [PATCH] Recreate the database before configuring other services. --- install/database.yaml | 8 ++++++++ turnup.yaml | 9 ++------- 2 files changed, 10 insertions(+), 7 deletions(-) create mode 100644 install/database.yaml diff --git a/install/database.yaml b/install/database.yaml new file mode 100644 index 0000000..5f246e7 --- /dev/null +++ b/install/database.yaml @@ -0,0 +1,8 @@ +# Copyright (c) 2023 Jakub Czajka +# License: GPL-3.0 or later. + +- name: Execute postgres playbook + shell: /usr/bin/ansible-playbook --connection=local \ + /srv/git/server.git/postgres.yaml +- name: Restore database from backup + command: /usr/bin/psql --username=postgres --file=/tmp/database diff --git a/turnup.yaml b/turnup.yaml index 5b0dd6e..e27d997 100644 --- a/turnup.yaml +++ b/turnup.yaml @@ -23,6 +23,8 @@ - include_tasks: install/certify.yaml with_items: "{{ certificates }}" - include_tasks: install/environment.yaml + - include_tasks: install/database.yaml + - find: paths: "/srv/git" file_type: file @@ -32,12 +34,5 @@ - name: Execute configuration playbook shell: /usr/bin/ansible-playbook --connection=local {{ item.path }} with_items: "{{ post_receive_scripts.files }}" - - name: Restart postgresql - service: - name: postgresql - state: restarted - become: yes - - name: Restore database from backup - command: /usr/bin/psql --username=postgres --file=/tmp/database - include_tasks: install/ssh_public_keys.yaml with_items: "{{ users }}" -- 2.39.5