From e483d0f19c6ac9c34023e8111a8940493c9f555d Mon Sep 17 00:00:00 2001 From: Alexander Dahl Date: Thu, 15 Sep 2022 21:42:32 +0200 Subject: [PATCH] :ok_hand: pottwal: Check prosody data dir exists Suggested-by: Stefan Haun --- pottwal.yml | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/pottwal.yml b/pottwal.yml index 9108a29..b74d14b 100644 --- a/pottwal.yml +++ b/pottwal.yml @@ -12,7 +12,7 @@ shlink_host_port: 8083 shlink_domain_name: sl.n39.eu - prosody_data: "{{ data_dir }}/prosody" + prosody_data_dir: "{{ data_dir }}/prosody" prosody_domain_name: jabber.n39.eu jabber_host_port: 8086 @@ -127,6 +127,15 @@ site_name: "{{ shlink_domain_name }}" proxy_port: "{{ shlink_host_port }}" + - name: Check if prosody data dir exists + ansible.builtin.stat: + path: "{{ prosody_data_dir }}" + register: prosody_dir + - name: Fail if prosody data dir does not exist + ansible.builtin.fail: + msg: "prosody data dir is missing, please restore from the backup!" + when: not prosody.stat.exists + - name: Ensure container for prosody XMPP server is running docker_container: name: prosody @@ -140,9 +149,9 @@ - 5222:5222 # xmpp-client - 5269:5269 # xmpp-server volumes: - - "{{ prosody_data }}/etc/prosody:/etc/prosody:rw" - - "{{ prosody_data }}/var/lib/prosody:/var/lib/prosody:rw" - - "{{ prosody_data }}/var/log/prosody:/var/log/prosody:rw" + - "{{ prosody_data_dir }}/etc/prosody:/etc/prosody:rw" + - "{{ prosody_data_dir }}/var/lib/prosody:/var/lib/prosody:rw" + - "{{ prosody_data_dir }}/var/log/prosody:/var/log/prosody:rw" - "{{ dehydrated_certs_dir }}/{{ prosody_domain_name }}:/var/lib/dehydrated/certs/{{ prosody_domain_name }}:ro" - name: Ensure container for static XMPP website is running @@ -160,7 +169,7 @@ ports: - "127.0.0.1:{{ jabber_host_port }}:80" volumes: - - "{{ prosody_data }}/var/www:/public:ro" + - "{{ prosody_data_dir }}/var/www:/public:ro" - name: Setup proxy site {{ prosody_domain_name }} # point to static website for now