This commit is contained in:
David Rotermund 2024-04-18 17:10:00 +02:00
parent 9087a1ccfa
commit f5b42896a6
3 changed files with 40 additions and 3 deletions

37
backup_check.yaml Normal file
View file

@ -0,0 +1,37 @@
---
- name: backup check
hosts: all
become: true
gather_facts: true
tasks:
- name: make backup folder
ansible.builtin.file:
path: "/check_backup/"
owner: "ansibleuser"
group: "ansibleuser"
mode: '0700'
state: "directory"
- name: delete old file
ansible.builtin.file:
path: "/check_backup/check_{{ ansible_hostname }}.tgz"
state: "absent"
- name: create archive
community.general.archive:
dest: "/check_backup/check_{{ ansible_hostname }}.tgz"
path: "/var/lib/docker/volumes"
owner: "ansibleuser"
- name: create sudo permision
lineinfile:
path: "/etc/sudoers.d/root"
create: true
state: present
line: "root ALL=(ansibleuser) NOPASSWD: ALL"
- name: scp file into safety
ansible.builtin.shell: 'scp -o "StrictHostKeyChecking accept-new" /check_backup/check_{{ ansible_hostname }}.tgz ansibleuser@10.10.0.2:/home/backup_ansible/'
become: false

View file

@ -21,8 +21,8 @@
recreate: no recreate: no
restart_policy: always restart_policy: always
published_ports: published_ports:
- "8000:8000/tcp" - "80:8000/tcp"
- "9443:9443/tcp" - "443:9443/tcp"
volumes: volumes:
- /var/run/docker.sock:/var/run/docker.sock - /var/run/docker.sock:/var/run/docker.sock
- portainer_data:/data - portainer_data:/data

View file

@ -185,7 +185,7 @@
recreate: yes recreate: yes
restart_policy: always restart_policy: always
published_ports: published_ports:
- "3000:3000/tcp" - "80:3000/tcp"
volumes: volumes:
- "semaphore_etc:/etc/semaphore" - "semaphore_etc:/etc/semaphore"
- "semaphore_lib:/var/lib/semaphore" - "semaphore_lib:/var/lib/semaphore"