mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2024-11-26 14:41:04 +01:00
Refactored /usr/local/bin
This commit is contained in:
parent
c55344bbd6
commit
186d57f758
@ -81,7 +81,7 @@ docker-compose build &&
|
|||||||
docker-compose -p akaunting up -d --force-recreate
|
docker-compose -p akaunting up -d --force-recreate
|
||||||
|
|
||||||
# recover all volumes
|
# recover all volumes
|
||||||
cd /usr/local/bin/docker-volume-backup &&
|
cd /home/administrator/scripts/docker-volume-backup &&
|
||||||
bash docker-volume-recover.sh akaunting_akaunting-modules ${machine_id:0:64} "$backup_version" &&
|
bash docker-volume-recover.sh akaunting_akaunting-modules ${machine_id:0:64} "$backup_version" &&
|
||||||
bash docker-volume-recover.sh akaunting_akaunting-data ${machine_id:0:64} "$backup_version" &&
|
bash docker-volume-recover.sh akaunting_akaunting-data ${machine_id:0:64} "$backup_version" &&
|
||||||
bash docker-volume-recover.sh akaunting_akaunting-db ${machine_id:0:64} "$backup_version" akaunting-db "$akaunting_db_password" akaunting
|
bash docker-volume-recover.sh akaunting_akaunting-db ${machine_id:0:64} "$backup_version" akaunting-db "$akaunting_db_password" akaunting
|
||||||
|
@ -81,3 +81,4 @@ For update instructions follow:
|
|||||||
- https://github.com/nuxsmin/sysPass/issues/1299
|
- https://github.com/nuxsmin/sysPass/issues/1299
|
||||||
- https://github.com/Mailu/Mailu/issues/1171
|
- https://github.com/Mailu/Mailu/issues/1171
|
||||||
- https://support.plesk.com/hc/en-us/articles/115001264814-Unable-to-log-into-RoundCube-Connection-to-storage-server-failed
|
- https://support.plesk.com/hc/en-us/articles/115001264814-Unable-to-log-into-RoundCube-Connection-to-storage-server-failed
|
||||||
|
- https://github.com/Mailu/Mailu
|
||||||
|
@ -13,7 +13,7 @@ NEXTCLOUD_APPLICATION_DOCKER_CONTAINER=nextcloud-application-1
|
|||||||
To update the nextcloud container execute the following commands on the server:
|
To update the nextcloud container execute the following commands on the server:
|
||||||
```bash
|
```bash
|
||||||
docker exec -it -u www-data $NEXTCLOUD_APPLICATION_DOCKER_CONTAINER /var/www/html/occ maintenance:mode --on
|
docker exec -it -u www-data $NEXTCLOUD_APPLICATION_DOCKER_CONTAINER /var/www/html/occ maintenance:mode --on
|
||||||
sudo python /usr/local/bin/docker-volume-backup/docker-volume-backup.py
|
sudo python /home/administrator/scripts/docker-volume-backup/docker-volume-backup.py
|
||||||
export COMPOSE_HTTP_TIMEOUT=600
|
export COMPOSE_HTTP_TIMEOUT=600
|
||||||
export DOCKER_CLIENT_TIMEOUT=600
|
export DOCKER_CLIENT_TIMEOUT=600
|
||||||
cd /home/administrator/docker-compose/nextcloud && docker-compose down
|
cd /home/administrator/docker-compose/nextcloud && docker-compose down
|
||||||
@ -58,7 +58,7 @@ and disable the not functioning apps.
|
|||||||
cd /home/administrator/docker-compose/nextcloud &&
|
cd /home/administrator/docker-compose/nextcloud &&
|
||||||
docker-compose down &&
|
docker-compose down &&
|
||||||
docker exec -i nextcloud_database_1 mysql -u nextcloud -pPASSWORT nextcloud < "/Backups/$(sha256sum /etc/machine-id | head -c 64)/docker-volume-backup/latest/nextcloud_database/sql/backup.sql" &&
|
docker exec -i nextcloud_database_1 mysql -u nextcloud -pPASSWORT nextcloud < "/Backups/$(sha256sum /etc/machine-id | head -c 64)/docker-volume-backup/latest/nextcloud_database/sql/backup.sql" &&
|
||||||
cd /usr/local/bin/docker-volume-backup &&
|
cd /home/administrator/scripts/docker-volume-backup &&
|
||||||
bash ./docker-volume-recover.sh "nextcloud_data" "$(sha256sum /etc/machine-id | head -c 64)"
|
bash ./docker-volume-recover.sh "nextcloud_data" "$(sha256sum /etc/machine-id | head -c 64)"
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -2,13 +2,17 @@
|
|||||||
pip:
|
pip:
|
||||||
name: psutil
|
name: psutil
|
||||||
|
|
||||||
|
- name: "create {{docker_backups_cleanup}}"
|
||||||
|
file:
|
||||||
|
path: "{{docker_backups_cleanup}}"
|
||||||
|
state: directory
|
||||||
|
mode: 0755
|
||||||
|
|
||||||
- name: create backups-cleanup.py
|
- name: create backups-cleanup.py
|
||||||
template: src=backups-cleanup.py.j2 dest=/usr/local/bin/backups-cleanup.py
|
template: src=backups-cleanup.py.j2 dest={{docker_backups_cleanup}}backups-cleanup.py
|
||||||
|
|
||||||
- name: create backups-cleanup.service
|
- name: create backups-cleanup.service
|
||||||
copy:
|
template: src=backups-cleanup.service.j2 dest=/etc/systemd/system/backups-cleanup.service
|
||||||
src: backups-cleanup.service
|
|
||||||
dest: "/etc/systemd/system/backups-cleanup.service"
|
|
||||||
notify: restart backups-cleanup.service
|
notify: restart backups-cleanup.service
|
||||||
|
|
||||||
- name: create backups-cleanup.timer
|
- name: create backups-cleanup.timer
|
||||||
|
@ -4,4 +4,4 @@ OnFailure=systemd-email@%n.service
|
|||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
Type=oneshot
|
Type=oneshot
|
||||||
ExecStart=/usr/bin/python /usr/local/bin/backups-cleanup.py
|
ExecStart=/usr/bin/python {{docker_backups_cleanup}}/backups-cleanup.py
|
1
roles/native-backups-cleanup/vars/main.yml
Normal file
1
roles/native-backups-cleanup/vars/main.yml
Normal file
@ -0,0 +1 @@
|
|||||||
|
docker_backups_cleanup: "/home/administrator/scripts/backups-cleanup/"
|
@ -1,18 +1,16 @@
|
|||||||
- name: "create /home/administrator/scripts/btrfs-health-check/"
|
- name: "create {{docker_btrfs_health_check_folder}}"
|
||||||
file:
|
file:
|
||||||
path: "/home/administrator/scripts/btrfs-health-check"
|
path: "{{docker_btrfs_health_check_folder}}"
|
||||||
state: directory
|
state: directory
|
||||||
mode: 0755
|
mode: 0755
|
||||||
|
|
||||||
- name: create btrfs-health-check.sh
|
- name: create btrfs-health-check.sh
|
||||||
copy:
|
copy:
|
||||||
src: btrfs-health-check.sh
|
src: btrfs-health-check.sh
|
||||||
dest: "/home/administrator/scripts/btrfs-health-check/btrfs-health-check.sh"
|
dest: "{{docker_btrfs_health_check_folder}}btrfs-health-check.sh"
|
||||||
|
|
||||||
- name: create btrfs-health-check.service
|
- name: create btrfs-health-check.service
|
||||||
copy:
|
template: btrfs-health-check.service.j2 dest=/etc/systemd/system/btrfs-health-check.service
|
||||||
src: btrfs-health-check.service
|
|
||||||
dest: "/etc/systemd/system/btrfs-health-check.service"
|
|
||||||
notify: restart btrfs-health-check.service
|
notify: restart btrfs-health-check.service
|
||||||
|
|
||||||
- name: create btrfs-health-check.timer
|
- name: create btrfs-health-check.timer
|
||||||
|
@ -4,4 +4,4 @@ OnFailure=systemd-email@%n.service
|
|||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
Type=oneshot
|
Type=oneshot
|
||||||
ExecStart=/bin/bash /home/administrator/scripts/btrfs-health-check/btrfs-health-check.sh
|
ExecStart=/bin/bash {{docker_btrfs_health_check_folder}}btrfs-health-check.sh
|
1
roles/native-btrfs-health-check/vars/main.yml
Normal file
1
roles/native-btrfs-health-check/vars/main.yml
Normal file
@ -0,0 +1 @@
|
|||||||
|
docker_btrfs_health_check_folder: "/home/administrator/scripts/btrfs-health-check/"
|
@ -1,18 +1,16 @@
|
|||||||
- name: "create /home/administrator/scripts/docker-health-check/"
|
- name: "create {{docker_health_check_folder}}"
|
||||||
file:
|
file:
|
||||||
path: "/home/administrator/scripts/docker-health-check"
|
path: "{{docker_health_check_folder}}"
|
||||||
state: directory
|
state: directory
|
||||||
mode: 0755
|
mode: 0755
|
||||||
|
|
||||||
- name: create docker-health-check.sh
|
- name: create docker-health-check.sh
|
||||||
copy:
|
copy:
|
||||||
src: docker-health-check.sh
|
src: docker-health-check.sh
|
||||||
dest: "/home/administrator/scripts/docker-health-check/docker-health-check.sh"
|
dest: "{{docker_health_check_folder}}docker-health-check.sh"
|
||||||
|
|
||||||
- name: create docker-health-check.service
|
- name: create docker-health-check.service
|
||||||
copy:
|
template: src=docker-health-check.service.j2 dest=/etc/systemd/system/docker-health-check.service
|
||||||
src: docker-health-check.service
|
|
||||||
dest: "/etc/systemd/system/docker-health-check.service"
|
|
||||||
notify: restart docker-health-check.service
|
notify: restart docker-health-check.service
|
||||||
|
|
||||||
- name: create docker-health-check.timer
|
- name: create docker-health-check.timer
|
||||||
|
@ -4,4 +4,4 @@ OnFailure=systemd-email@%n.service
|
|||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
Type=oneshot
|
Type=oneshot
|
||||||
ExecStart=/bin/bash /home/administrator/scripts/docker-health-check/docker-health-check.sh
|
ExecStart=/bin/bash {{docker_health_check_folder}}docker-health-check.sh
|
1
roles/native-docker-health-check/vars/main.yml
Normal file
1
roles/native-docker-health-check/vars/main.yml
Normal file
@ -0,0 +1 @@
|
|||||||
|
docker_health_check_folder: "/home/administrator/scripts/docker-health-check/"
|
@ -5,20 +5,20 @@
|
|||||||
- name: pull docker-volume-backup.git
|
- name: pull docker-volume-backup.git
|
||||||
git:
|
git:
|
||||||
repo: "https://github.com/kevinveenbirkenbach/docker-volume-backup.git"
|
repo: "https://github.com/kevinveenbirkenbach/docker-volume-backup.git"
|
||||||
dest: "/usr/local/bin/docker-volume-backup"
|
dest: "{{docker_volume_backup_folder}}"
|
||||||
update: yes
|
update: yes
|
||||||
|
|
||||||
- name: configure docker-volume-backup.service.tpl
|
- name: configure docker-volume-backup.service.tpl
|
||||||
template: src=docker-volume-backup.service dest=/etc/systemd/system/docker-volume-backup.service
|
template: src=docker-volume-backup.service.j2 dest=/etc/systemd/system/docker-volume-backup.service
|
||||||
notify: restart docker-volume-backup service
|
notify: restart docker-volume-backup service
|
||||||
|
|
||||||
- name: configure docker-volume-backup.timer.tpl
|
- name: configure docker-volume-backup.timer.tpl
|
||||||
template: src=docker-volume-backup.timer dest=/etc/systemd/system/docker-volume-backup.timer
|
template: src=docker-volume-backup.timer.j2 dest=/etc/systemd/system/docker-volume-backup.timer
|
||||||
notify: restart docker-volume-backup timer
|
notify: restart docker-volume-backup timer
|
||||||
|
|
||||||
- name: create /usr/local/bin/docker-volume-backup/databases.csv
|
- name: create {{docker_volume_backup_folder}}/databases.csv
|
||||||
copy:
|
copy:
|
||||||
src: "{{ inventory_dir }}/files/{{ inventory_hostname }}/usr/local/bin/docker-volume-backup/databases.csv"
|
src: "{{ inventory_dir }}/files/{{ inventory_hostname }}{{docker_volume_backup_folder}}/databases.csv"
|
||||||
dest: /usr/local/bin/docker-volume-backup/databases.csv
|
dest: {{docker_volume_backup_folder}}/databases.csv
|
||||||
owner: root
|
owner: root
|
||||||
group: root
|
group: root
|
||||||
|
@ -4,4 +4,4 @@ OnFailure=systemd-email@%n.service
|
|||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
Type=oneshot
|
Type=oneshot
|
||||||
ExecStart=/usr/bin/python /usr/local/bin/docker-volume-backup/docker-volume-backup.py
|
ExecStart=/usr/bin/python {{docker_volume_backup_folder}}/docker-volume-backup.py
|
1
roles/native-docker-volume-backup/vars/main.yml
Normal file
1
roles/native-docker-volume-backup/vars/main.yml
Normal file
@ -0,0 +1 @@
|
|||||||
|
docker_volume_backup_folder: "/home/administrator/scripts/docker-volume-backup/"
|
@ -1,15 +1,15 @@
|
|||||||
- name: create pull-remote-backup.sh
|
- name: create pull-remote-backup.sh
|
||||||
copy:
|
copy:
|
||||||
src: pull-remote-backup.sh
|
src: pull-remote-backup.sh
|
||||||
dest: "/usr/local/bin/pull-remote-backup.sh"
|
dest: "bash {{docker_pull_primary_backups_folder}}pull-remote-backup.sh"
|
||||||
|
|
||||||
- name: create pull-remote-backups.service
|
- name: create pull-remote-backups.service
|
||||||
template: src=pull-remote-backups.service dest=/etc/systemd/system/pull-remote-backups.service
|
template: src=pull-remote-backups.service.j2 dest=/etc/systemd/system/pull-remote-backups.service
|
||||||
notify: restart pull-remote-backups service
|
notify: restart pull-remote-backups serviceß
|
||||||
|
|
||||||
- name: create pull-remote-backups.timer
|
- name: create pull-remote-backups.timer
|
||||||
template: src=pull-remote-backups.timer dest=/etc/systemd/system/pull-remote-backups.timer
|
template: src=pull-remote-backups.timer.j2 dest=/etc/systemd/system/pull-remote-backups.timer
|
||||||
notify: restart pull-remote-backups timer
|
notify: restart pull-remote-backups timer
|
||||||
|
|
||||||
- name: create pull-remote-backups.sh
|
- name: create pull-remote-backups.sh
|
||||||
template: src=pull-remote-backups.sh dest=/usr/local/bin/pull-remote-backups.sh
|
template: src=pull-remote-backups.sh.j2 dest=bash {{docker_pull_primary_backups_folder}}pull-remote-backups.sh
|
||||||
|
@ -4,4 +4,4 @@ OnFailure=systemd-email@%n.service
|
|||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
Type=oneshot
|
Type=oneshot
|
||||||
ExecStart=/usr/bin/bash /usr/local/bin/pull-remote-backups.sh
|
ExecStart=/usr/bin/bash {{docker_pull_primary_backups_folder}}pull-remote-backups.sh
|
@ -3,6 +3,6 @@
|
|||||||
hosts="{{pull_remote_backups_hosts}}";
|
hosts="{{pull_remote_backups_hosts}}";
|
||||||
errors=0
|
errors=0
|
||||||
for host in $hosts; do
|
for host in $hosts; do
|
||||||
bash /usr/local/bin/pull-remote-backup.sh $host || ((errors+=1));
|
bash {{docker_pull_primary_backups_folder}}/pull-remote-backup.sh $host || ((errors+=1));
|
||||||
done;
|
done;
|
||||||
exit $errors;
|
exit $errors;
|
1
roles/native-pull-primary-backups/vars/main.yml
Normal file
1
roles/native-pull-primary-backups/vars/main.yml
Normal file
@ -0,0 +1 @@
|
|||||||
|
docker_pull_primary_backups_folder: "/usr/local/bin/pull-primary-backups/"
|
@ -4,8 +4,14 @@
|
|||||||
- name: configure msmtprc.conf.j2
|
- name: configure msmtprc.conf.j2
|
||||||
template: src=msmtprc.conf.j2 dest=/root/.msmtprc
|
template: src=msmtprc.conf.j2 dest=/root/.msmtprc
|
||||||
|
|
||||||
|
- name: "create {{systemd_email_folder}}"
|
||||||
|
file:
|
||||||
|
path: "{{systemd_email_folder}}"
|
||||||
|
state: directory
|
||||||
|
mode: 0755
|
||||||
|
|
||||||
- name: configure systemd-email.sh
|
- name: configure systemd-email.sh
|
||||||
template: src=systemd-email.sh.j2 dest=/usr/local/bin/systemd-email.sh
|
template: src=systemd-email.sh.j2 dest={{systemd_email_folder}}bin/systemd-email.sh
|
||||||
|
|
||||||
- name: configure systemd-email.service
|
- name: configure systemd-email.service
|
||||||
template: src=systemd-email@.service.j2 dest=/etc/systemd/system/systemd-email@.service
|
template: src=systemd-email@.service.j2 dest=/etc/systemd/system/systemd-email@.service
|
||||||
|
@ -3,6 +3,6 @@ Description=status email for %i to user
|
|||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
Type=oneshot
|
Type=oneshot
|
||||||
ExecStart=/bin/bash /usr/local/bin/systemd-email.sh %i
|
ExecStart=/bin/bash {{systemd_email_folder}}systemd-email.sh %i
|
||||||
User=root
|
User=root
|
||||||
Group=systemd-journal
|
Group=systemd-journal
|
||||||
|
1
roles/native-systemd-email/vars/main.yml
Normal file
1
roles/native-systemd-email/vars/main.yml
Normal file
@ -0,0 +1 @@
|
|||||||
|
systemd_email_folder: "/home/administrator/scripts/systemd_email/"
|
Loading…
Reference in New Issue
Block a user