This commit is contained in:
28
readme.md
28
readme.md
@@ -10,4 +10,30 @@ You'll need to install Ansible Playbook, either through APT or another avenue.
|
|||||||
sudo apt install ansible-core
|
sudo apt install ansible-core
|
||||||
```
|
```
|
||||||
|
|
||||||
Then, configure your vaults using the variable templates provided & update the hosts file to match your hosts. After you've done so, you can simply run `ansible-playbook main.yml` & it will deploy all containers.
|
Once you've done so, configure the [hosts](./hosts) file to direct to your server(s). You'll need to deal with the SSH setup, alongside setting up the host variables for each service you want to use.
|
||||||
|
|
||||||
|
## Project setup
|
||||||
|
|
||||||
|
I have this project set up like so;
|
||||||
|
|
||||||
|
- **tasks/** - All of the playbooks for the services I deploy
|
||||||
|
- **roles/** - More comprehensive tasks, like FiveM which requires multiple JNinja templates
|
||||||
|
- **scripts/** - Any utility scripts, like the one used for deployment
|
||||||
|
- **host_vars/** - All host variables, containings variables for each service
|
||||||
|
- **main.yml** - Playbook that contains all the setup for the automated deployment
|
||||||
|
|
||||||
|
## Deployment
|
||||||
|
|
||||||
|
In my lab, I have a Git runner sitting on my local network. I use this to deploy changes to this repository across all of my machines.
|
||||||
|
|
||||||
|
The business logic for how this is done is in the `scripts/deploy_containers.py` script, which handles
|
||||||
|
|
||||||
|
- Deploying new containers
|
||||||
|
- Redeploying changed containers based on the Git diff
|
||||||
|
- Redeploying VPN-based containers that need to restart when Gluetun does
|
||||||
|
- Redeploying containers when secrets update
|
||||||
|
- Cleaning up containers/images when tasks are removed
|
||||||
|
|
||||||
|
This uses `tags` in [main.yml](./main.yml), structured as `{container}_deploy` - so if I update Immich, it will run ansible-playbook with the argument `--tags immich_deploy`.
|
||||||
|
|
||||||
|
When secrets for a specific host are detected as updated, it will run the deploy tasks for all containers that host has (`-l {host}`) to refresh environment variables.
|
||||||
|
|||||||
@@ -1,19 +0,0 @@
|
|||||||
global:
|
|
||||||
scrape_interval: 15s
|
|
||||||
evaluation_interval: 15s
|
|
||||||
|
|
||||||
scrape_configs:
|
|
||||||
# Prometheus itself
|
|
||||||
- job_name: "prometheus"
|
|
||||||
static_configs:
|
|
||||||
- targets: ["localhost:9090"]
|
|
||||||
|
|
||||||
# Node Exporter (system metrics)
|
|
||||||
- job_name: "node-exporter"
|
|
||||||
static_configs:
|
|
||||||
- targets: ["node-exporter:9100"]
|
|
||||||
|
|
||||||
# Docker metrics
|
|
||||||
- job_name: "cadvisor"
|
|
||||||
static_configs:
|
|
||||||
- targets: ["cadvisor:8083"]
|
|
||||||
Reference in New Issue
Block a user