Go to file
TuDatTr b36f97fa65 Fixed backblaze backup
Signed-off-by: TuDatTr <tuan-dat.tran@tudattr.dev>
2022-12-06 23:16:52 +01:00
group_vars/all Added zoneminder to aya01 (if I hadn't before) 2022-12-06 16:36:21 +01:00
host_vars Added docker for aya01 and pi 2022-12-05 16:47:35 +01:00
roles Fixed backblaze backup 2022-12-06 23:16:52 +01:00
#README.md# Fixed backblaze backup 2022-12-06 23:16:52 +01:00
.#README.md Fixed backblaze backup 2022-12-06 23:16:52 +01:00
.gitignore Initial commit with not yet working docker networking 2022-11-30 23:49:07 +01:00
README.md Added zoneminder to aya01 (if I hadn't before) 2022-12-06 16:36:21 +01:00
aya01.yml Added zoneminder to aya01 (if I hadn't before) 2022-12-06 16:36:21 +01:00
infra.yml Fixed typo in definition 2022-12-06 09:45:08 +01:00
pi.yml Added zoneminder to aya01 (if I hadn't before) 2022-12-06 16:36:21 +01:00
production Initial commit with not yet working docker networking 2022-11-30 23:49:07 +01:00
staging Initial commit with not yet working docker networking 2022-11-30 23:49:07 +01:00

README.md

TuDatTr IaC

Vault

  • Create vault with: ansible-vault create secrets.yml
  • Create entry in vault with: ansible-vault edit secrets.yml
  • Add following entries:
    • vault_pi_tudattr_password: <YOURPASSWORD> (password you've setup on the device)
    • vault_aya01_tudattr_password: <YOURPASSWORD> (password you've setup on the device)
    • vault_pihole_password: <YOURPASSWORD> (arbitrary password you want to log in with)
    • vault_mysql_root_password: <YOURPASSWORD> (arbitrary password, used internally)
    • vault_mysql_user_password: <YOURPASSWORD> (arbitrary password, used internally)
    • vault_ddns_tudattrdev_password: <YOURPASSWORD> (password needed for ddns, refer to here)
    • vault_ddns_borgland_password: <YOURPASSWORD> (password needed for ddns, refer to here)

Server

  • Install Debian (debian-11.5.0-amd64-netinst.iso) on remote system
  • Create user (tudattr)
  • Get IP of remote system (192.168.20.11)
  • Create ssh-config entry
    Host aya01
      HostName 192.168.20.11
      Port 22
      User tudattr
      IdentityFile /mnt/veracrypt1/genesis
    
    • copy public key to remote system ssh-copy-id -i /mnt/veracrypt1/genesis.pub aya01
  • Add this host to ansible inventory
  • Install sudo on remote
  • add user to sudo group (with su --login without login the path will not be loaded correctly see here) and usermod -a -G sudo tudattr
  • set time correctly when getting the following error
Release file for http://security.debian.org/debian-security/dists/bullseye-security/InRelease is not valid yet (invalid for another 12h 46min 9s). Updates for this repository will not be applied.

By doing on remote system (example):

sudo systemctl stop ntp.service
sudo ntpd -gq
sudo systemctl start ntp.service

zoneminder

  • Enable authentification in (Option->System)
  • Create new Camera:
    • General>Name: BirdCam
    • General>Function: Ffmpeg
    • General>Function: Modect
    • Source>Source Path: rtsp://user:pw@ip:554/cam/mpeg4
  • Change default admin password
  • Create users

RaspberryPi

  • Install raspbian lite (2022-09-22-raspios-bullseye-arm64-lite.img) on pi
  • Get IP of remote system (192.168.20.11)
  • Create ssh-config entry
Host pi
     HostName 192.168.20.11
     Port 22
     User tudattr
     IdentityFile /mnt/veracrypt1/genesis
  • enable ssh on pi
  • copy public key to pi
  • change user password of user on pi
  • execute ansible-playbook -i production --ask-vault-pass --extra-vars '@secrets.yml' pi.yml

Mikrotik

  • Create rsa-key on your device and name it mikrotik_rsa
  • On mikrotik run: /user/ssh-keys/import public-key-file=mikrotik_rsa.pub user=tudattr
  • Create ssh-config entry:
Host mikrotik
     HostName 192.168.70.1
     Port 2200
     User tudattr
     IdentityFile /mnt/veracrypt1/mikrotik_rsa

Todo

  • Role to setup backup
  • Role to load customization/configurations from backup to servers
  • aya01 fstab