Added zoneminder to aya01 (if I hadn't before)

Added backblaze (todo documentation)

Signed-off-by: TuDatTr <tuan-dat.tran@tudattr.dev>
This commit is contained in:
TuDatTr
2022-12-06 16:36:21 +01:00
parent 70083f2974
commit b371e246a9
16 changed files with 150 additions and 11 deletions

View File

@@ -0,0 +1,6 @@
---
- name: Loop over subelements of the dictionary
shell:
cmd: "rclone -vv sync {{ item.1 }} secret:{{ item.1 }}"
when: item.0.key == inventory_hostname
loop: "{{ backblaze_paths | dict2items | subelements('value') }}"

View File

@@ -0,0 +1,18 @@
---
- name: Create rclone config folder at "{{ rclone_config }}"
file:
path: "{{ rclone_config }}"
owner: '0'
group: '0'
mode: '700'
state: directory
become: true
- name: Copy rclone config to "{{ inventory_hostname }}"
template:
src: "templates/{{ inventory_hostname }}/rclone.conf"
dest: "{{ rclone_config }}/rclone.conf"
owner: '0'
group: '0'
mode: '400'
become: true

View File

@@ -0,0 +1,13 @@
---
- name: Update and upgrade packages
apt:
update_cache: yes
upgrade: yes
autoremove: yes
become: yes
- name: Install rclone
apt:
name: "rclone"
state: present
become: yes

View File

@@ -0,0 +1,5 @@
---
- include_tasks: install.yml
- include_tasks: config.yml
- include_tasks: backup.yml

View File

@@ -0,0 +1,10 @@
[remote]
type = b2
account = {{ vault_backblaze_aya01_account }}
key = {{ vault_backblaze_aya01_key }}
[secret]
type = crypt
remote = remote:aya01-tudattr-dev
password = {{ vault_rclone_aya01_password }}
password2 = {{ vault_rclone_aya01_password2 }}

View File

@@ -0,0 +1,10 @@
[remote]
type = b2
account = {{ vault_backblaze_pi_account }}
key = {{ vault_backblaze_pi_key }}
[secret]
type = crypt
remote = remote:pi-tudattr-dev
password = {{ vault_rclone_pi_password }}
password2 = {{ vault_rclone_pi_password2 }}

View File

@@ -0,0 +1,21 @@
---
- name: Create folders to mount to
file:
path: "{{ item.path }}"
state: directory
loop: "{{ fstab_entries }}"
become: true
- name: Create fstab entries
mount:
src: "UUID={{ item.uuid }}"
path: "{{ item.path }}"
fstype: "{{ item.type }}"
state: present
backup: true
loop: "{{ fstab_entries }}"
become: true
- name: Mount all disks
command: mount -a
become: true

View File

@@ -2,4 +2,4 @@
- include_tasks: time.yml
- include_tasks: essential.yml
- include_tasks: aya01_fstab.yml
when: ansible_hostname == "aya01"
when: inventory_hostname == "aya01"

View File

@@ -6,7 +6,9 @@
mode: '700'
state: directory
loop:
- "{{ docker_dir }}/zm/"
- "{{ zoneminder_data }}"
- "{{ zoneminder_config }}"
become: true
# Todo, check if docker compose is running
# - name: Shut down docker

View File

@@ -2,6 +2,6 @@
- include_tasks: install.yml
- include_tasks: user_group_setup.yml
- include_tasks: pi_compose.yml
when: ansible_hostname == "pi"
when: inventory_hostname == "pi"
- include_tasks: aya01_compose.yml
when: ansible_hostname == "aya01"
when: inventory_hostname == "aya01"

View File

@@ -7,7 +7,7 @@ services:
- zoneminder
volumes:
- "/etc/localtime:/etc/localtime:ro"
- "{{ docker_dir }}/zm/db:/var/lib/mysql"
- "{{ zoneminder_config}}/db:/var/lib/mysql"
environment:
- "MYSQL_DATABASE=zm"
- "MYSQL_ROOT_PASSWORD={{ vault_mysql_root_password }}"
@@ -30,9 +30,9 @@ services:
- net
volumes:
- "/etc/localtime:/etc/localtime:ro"
- "{{ docker_dir }}/zm/data:/data"
- "{{ docker_dir }}/zm/config:/config"
- "{{ docker_dir }}/zm/log:/log"
- "{{ zoneminder_data }}:/data"
- "{{ zoneminder_config }}/config:/config"
- "{{ zoneminder_config }}/log:/log"
- type: tmpfs
target: /dev/shm
tmpfs:
@@ -51,7 +51,8 @@ networks:
net:
driver: bridge
ipam:
driver: default
# driver: default
config:
- subnet: 172.16.69.0/24
ip_range: 172.28.69.0/24
gateway: 172.16.69.1

View File

@@ -80,7 +80,7 @@ networks:
net:
driver: bridge
ipam:
driver: default
# driver: default
config:
- subnet: 172.16.69.0/24
gateway: 172.16.69.1