ansible roles

This commit is contained in:
2024-08-31 23:55:11 +01:00
parent b3d9bdfbe3
commit 54fc671afb
17 changed files with 258 additions and 89 deletions

View File

@@ -18,13 +18,8 @@ Using [code-server docker container](#code-server) for Development / Maintenance
- [Table of Contents](#table-of-contents)
- [Services](#services)
- [myInfra stack](#myinfra-stack)
- [SSH](#ssh)
- [Docker](#docker)
- [Volumes](#volumes)
- [Portainer](#portainer)
- [Promtail](#promtail)
- [Telegraf](#telegraf)
- [Setup \& Update](#setup--update)
- [nginx](#nginx)
- [code-server](#code-server)
- [Home Assistant](#home-assistant)
@@ -33,49 +28,25 @@ Using [code-server docker container](#code-server) for Development / Maintenance
- [Wyoming](#wyoming)
- [Zigbee2mqtt](#zigbee2mqtt)
- [Docker devices](#docker-devices)
- [Host](#host)
- [System](#system)
- [proxmox - lxc container](#proxmox---lxc-container)
- [OS](#os)
- [Operation System](#operation-system)
- [Packages and Requirements](#packages-and-requirements)
- [Users \& Groups](#users--groups)
- [Ansible](#ansible)
- [Roles](#roles)
- [myInfra.dev.homesrv01](#myinfradevhomesrv01)
- [fstab](#fstab)
- [Update](#update)
## Services
### myInfra stack
docker, Portainer, promtail and telegraf [maintained on repo](/marcio.fernandes&myInfra).
### SSH
Deployed and maintained by ansible role [myInfra.dev.homesrv1](./ansible/roles/myInfra.dev.homesrv01/README.md).
Deployed and maintained by ansible role [myInfra.dev.homesrv1](#ansible).
### Docker
### Volumes
```bash
# requires mount /mnt/media@sshfs:nas.lan
# required by LMS service
docker volume create --driver local --opt type=none --opt device=/mnt/media@sshfs:nas.lan/music --opt o=bind music
# required by code-server service
# required by Promtail service
# required by Telegraf service
docker volume create --driver local --opt type=none --opt device=/ --opt o=bind hostfs
```
### Portainer
maintained by ansible myInfra.docker.portainer role
### Promtail
maintained by ansible myInfra.docker.promtail role
### Telegraf
#### Setup & Update
maintained by ansible myInfra.docker.telegraf role
### nginx
@@ -106,7 +77,7 @@ services:
- code-server_config:/config
- code-server_root:/root
- has_config:/config/workspace/has/volumes/config
- hostfs:/mnt/hostfs
- /:/mnt/hostfs
#- ./../nginx/volumes/nginx_conf:/config/workspace/host/repos/homesrv01.dev.lan/services/nginx/volumes/nginx_conf
#- mosquitto_config:/config/workspace/host/repos/homesrv01.dev.lan/services/mosquitto/volumes/config
#- mosquitto_data:/config/workspace/host/repos/homesrv01.dev.lan/services/mosquitto/volumes/data
@@ -127,8 +98,6 @@ volumes:
has_config:
name: has_app_config
external: true
hostfs:
external: true
#mosquitto_config:
# external: true
#mosquitto_data:
@@ -214,7 +183,7 @@ Links
- [Home assistant integration](/marcio.fernandes/homeassistant#Zigbee2mqtt)
- [Continuos Deploy - git action](./.gitea/workflows/services.zigbee2mqtt.yml)
## Host
## System
Currently hosted on a proxmox ubuntu container.
@@ -276,7 +245,7 @@ ls -l /dev/ttyUSB0
#lxc.mount.entry: /dev/ttyUSB0 dev/ttyUSB0 none bind,optional,create=file
```
### OS
### Operation System
```bash
# lsb_release -a
@@ -292,35 +261,38 @@ Codename: noble
### Packages and Requirements
```bash
apt update -y && apt upgrade -y
apt install curl -y
apt install git -y
curl -fsSL https://get.docker.com -o get-docker.sh && sh ./get-docker.sh
docker run hello-world && docker info
apt install sshfs
apt install ansible
```
### Users & Groups
### Ansible
#### Roles
##### myInfra.dev.homesrv01
- ssh server
- admin user
- daily auto update script
- git package
- curl package
```bash
# add user admin to docker group, so sudo is not required when executing docker commands
usermod -aG docker admin
#execute local
sudo ansible-playbook --connection=local --inventory 127.0.0.1, --limit 127.0.0.1 ansible/site.yml
```
``` bash
# check auto update scripts logs
journalctl -r -t auto-update
```
### fstab
```bash
# /etc/fstab
# used by docker volume music
sshfs#media@nas.lan:/home/media /mnt/media@sshfs:nas.lan fuse defaults,_netdev,allow_other,follow_symlinks 0 0
```
### Update
```bash
./scripts/auto-update.sh
ln -s $PWD/scripts/auto-update.sh /etc/cron.daily/auto-update
journalctl -r -t auto-update
```