From 9897d4f8661dc0b860d79dce80a427aca8569edd Mon Sep 17 00:00:00 2001 From: "ladislav.dusa" Date: Wed, 6 Dec 2023 17:56:21 +0100 Subject: [PATCH 1/4] work --- playbooks/start_containers.yaml | 2 +- playbooks/stop_containers.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/playbooks/start_containers.yaml b/playbooks/start_containers.yaml index c17d698..33c5f81 100644 --- a/playbooks/start_containers.yaml +++ b/playbooks/start_containers.yaml @@ -1,5 +1,5 @@ --- - name: Start mailu containers - command: "docker start nginx-app-1 heimdall mailu2-admin-1 mailu2-antispam-1 mailu2-antivirus-1 mailu2-fetchmail-1 mailu2-front-1 mailu2-imap-1 mailu2-oletools-1 mailu2-redis-1 mailu2-resolver-1 mailu2-smtp-1 mailu2-webdav-1 mailu2-webmail-1 HomeAssistant mosquitto-mosquitto-1" + command: "docker start gitlab semaphore-db-1 semaphore-app-1 nginx-app-1 heimdall mailu2-admin-1 mailu2-antispam-1 mailu2-antivirus-1 mailu2-fetchmail-1 mailu2-front-1 mailu2-imap-1 mailu2-oletools-1 mailu2-redis-1 mailu2-resolver-1 mailu2-smtp-1 mailu2-webdav-1 mailu2-webmail-1 HomeAssistant mosquitto-mosquitto-1" become: true ignore_errors: true \ No newline at end of file diff --git a/playbooks/stop_containers.yaml b/playbooks/stop_containers.yaml index 9dce13b..dc2d7e1 100644 --- a/playbooks/stop_containers.yaml +++ b/playbooks/stop_containers.yaml @@ -1,5 +1,5 @@ --- - name: Stop mailu containers - command: "docker stop nginx-app-1 heimdall mailu2-admin-1 mailu2-antispam-1 mailu2-antivirus-1 mailu2-fetchmail-1 mailu2-front-1 mailu2-imap-1 mailu2-oletools-1 mailu2-redis-1 mailu2-resolver-1 mailu2-smtp-1 mailu2-webdav-1 mailu2-webmail-1 HomeAssistant mosquitto-mosquitto-1" + command: "docker stop gitlab semaphore-db-1 semaphore-app-1 nginx-app-1 heimdall mailu2-admin-1 mailu2-antispam-1 mailu2-antivirus-1 mailu2-fetchmail-1 mailu2-front-1 mailu2-imap-1 mailu2-oletools-1 mailu2-redis-1 mailu2-resolver-1 mailu2-smtp-1 mailu2-webdav-1 mailu2-webmail-1 HomeAssistant mosquitto-mosquitto-1" become: true ignore_errors: true \ No newline at end of file From 93745dd1a49fcdbd780fbac1e0c6d347629b923d Mon Sep 17 00:00:00 2001 From: "ladislav.dusa" Date: Wed, 6 Dec 2023 17:57:38 +0100 Subject: [PATCH 2/4] work --- playbooks/start_containers.yaml | 2 +- playbooks/stop_containers.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/playbooks/start_containers.yaml b/playbooks/start_containers.yaml index 33c5f81..e843b01 100644 --- a/playbooks/start_containers.yaml +++ b/playbooks/start_containers.yaml @@ -1,5 +1,5 @@ --- - name: Start mailu containers - command: "docker start gitlab semaphore-db-1 semaphore-app-1 nginx-app-1 heimdall mailu2-admin-1 mailu2-antispam-1 mailu2-antivirus-1 mailu2-fetchmail-1 mailu2-front-1 mailu2-imap-1 mailu2-oletools-1 mailu2-redis-1 mailu2-resolver-1 mailu2-smtp-1 mailu2-webdav-1 mailu2-webmail-1 HomeAssistant mosquitto-mosquitto-1" + command: "docker start gitlab semaphore-db-1 semaphore-app-1 nginx-app-1 heimdall mailu2-admin-1 mailu2-antispam-1 mailu2-antivirus-1 mailu2-fetchmail-1 mailu2-front-1 mailu2-imap-1 mailu2-oletools-1 mailu2-redis-1 mailu2-resolver-1 mailu2-smtp-1 mailu2-webdav-1 mailu2-webmail-1 HomeAssistant mosquitto-mosquitto-1 webhub-web-1" become: true ignore_errors: true \ No newline at end of file diff --git a/playbooks/stop_containers.yaml b/playbooks/stop_containers.yaml index dc2d7e1..ba9b93a 100644 --- a/playbooks/stop_containers.yaml +++ b/playbooks/stop_containers.yaml @@ -1,5 +1,5 @@ --- - name: Stop mailu containers - command: "docker stop gitlab semaphore-db-1 semaphore-app-1 nginx-app-1 heimdall mailu2-admin-1 mailu2-antispam-1 mailu2-antivirus-1 mailu2-fetchmail-1 mailu2-front-1 mailu2-imap-1 mailu2-oletools-1 mailu2-redis-1 mailu2-resolver-1 mailu2-smtp-1 mailu2-webdav-1 mailu2-webmail-1 HomeAssistant mosquitto-mosquitto-1" + command: "docker stop gitlab semaphore-db-1 semaphore-app-1 nginx-app-1 heimdall mailu2-admin-1 mailu2-antispam-1 mailu2-antivirus-1 mailu2-fetchmail-1 mailu2-front-1 mailu2-imap-1 mailu2-oletools-1 mailu2-redis-1 mailu2-resolver-1 mailu2-smtp-1 mailu2-webdav-1 mailu2-webmail-1 HomeAssistant mosquitto-mosquitto-1 webhub-web-1" become: true ignore_errors: true \ No newline at end of file From 9cc98053c1d80a21e928a9425a932fc5a9cd5f86 Mon Sep 17 00:00:00 2001 From: "ladislav.dusa" Date: Wed, 6 Dec 2023 19:45:10 +0100 Subject: [PATCH 3/4] work --- playbooks/sync_all.yaml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/playbooks/sync_all.yaml b/playbooks/sync_all.yaml index 31d4641..fc1d231 100644 --- a/playbooks/sync_all.yaml +++ b/playbooks/sync_all.yaml @@ -22,6 +22,25 @@ - pw.sectorq.eu - semaphore.sectorq.eu when: inventory_hostname in groups['raspberrypi5'] + - name: Get relevant configs + ansible.builtin.shell: 'egrep -l "# ha.sectorq.eu|# pw.sectorq.eu|# semaphore.sectorq.eu|# sectorq.eu|# gitlab.sectorq.eu|# ha.sectorq.eu" /share/docker_data/nginx/data/nginx/proxy_host/*' + ignore_errors: yes + become: yes + register: result + when: inventory_hostname in groups['raspberrypi5'] + + - debug: + msg: "{{ result.stdout_lines }}" + when: inventory_hostname in groups['raspberrypi5'] + - name: Replace ip + ansible.builtin.lineinfile: + path: "{{ item }}" + regexp: '^\s+set \$server\s+\"\w+.\w+.\w+.\w+\";' + line: " set $server \"192.168.77.238\";" + become: yes + with_items: + - "{{ result.stdout_lines }}" + when: inventory_hostname in groups['raspberrypi5'] - include_tasks: reconfigure_heimdall.yaml name: Reconfigure heimdall From 78bb785e0da354ea18b880360d8ed85440c404eb Mon Sep 17 00:00:00 2001 From: "ladislav.dusa" Date: Thu, 7 Dec 2023 08:59:21 +0100 Subject: [PATCH 4/4] ole --- hosts.yml | 4 ++-- playbooks/mailu_switch_to_second2.yaml | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/hosts.yml b/hosts.yml index ae30af7..32aea02 100644 --- a/hosts.yml +++ b/hosts.yml @@ -64,7 +64,7 @@ datacenter: vars: ansible_python_interpreter: /opt/bin/python ansible_user: admin - ansible_pass: l4c1j4yd33Du5lo + ansible_pass: l4c1!j4yd33?Du5lo raspberry: hosts: 192.168.77.246 @@ -88,5 +88,5 @@ datacenter: 192.168.77.106: vars: ansible_user: admin - ansible_pass: l4c1j4yd33Du5lo + ansible_pass: l4c1!j4yd33?Du5lo ansible_python_interpreter: /share/ZFS530_DATA/.qpkg/QPython39/bin/python3 \ No newline at end of file diff --git a/playbooks/mailu_switch_to_second2.yaml b/playbooks/mailu_switch_to_second2.yaml index 8f7ad3b..e8bc53a 100644 --- a/playbooks/mailu_switch_to_second2.yaml +++ b/playbooks/mailu_switch_to_second2.yaml @@ -68,6 +68,11 @@ - name: Restart firewall command: service restart_firewall when: inventory_hostname in groups['router'] + - name: Stop containers + command: "docker stop {{ containers | join(' ') }}" + become: true + ignore_errors: true + when: inventory_hostname in groups['nas']