This part of the repo is responsible for provisioning our home-lab services using Ansible on top of the infrastructure already created via Terraform. The basic pattern is to confiure the service, and then add the upstream host to our reverse proxy (Caddy) configuration. ![architecture image](archi.png) # TODOs (in-progress) 1. reverse-proxy (Caddy) init 1. minio user,bucket init 1. static sites using minio bucket # Done 1. Adding service to reverse-proxy (Caddy) via api 1. Media Downloader for `*arr` services 1. Torrent server 1. Plex 1. Password Manager 1. Nextcloud 1. Metrics monitoring --- # Pre-reqs * `pip`3 - `sudo apt install python3 python3-pip` * `ansible` - `pip install --user ansible` # Execution 1. (First Time Only) Fork this repo, if you haven't already. 1. (FTO) Make sure that your [`hosts`](./hosts) have been created in the [Terraform](../terraform) section. 1. (FTO) Edit `group_vars/all/vault.example` to your liking. ```bash echo "YourSecretPassword" > vaultkey ansible-vault encrypt --output group_vars/all/vault --encrypt-vault-id vaultkey group_vars/all/vault.example git checkout group_vars/all/vault.example ``` 1. View/edit your encrypted vault: ```bash ansible-vault view/edit group_vars/all/vault ``` 1. (FTO) Run the `init.yaml` playbook with a `limit` and `tag` to install a service ```bash ansible-playbook playbooks/init.yaml --limit=[app name] --tags=install ``` 1. Run the playbook with a `limit` and `tag` to modify a service ```bash ansible-playbook playbooks/... --limit=[app name] --tags=config ``` # Ansible Roles You can think of each Role being an "app". Each Role has a `setup.yaml` task file responsible for installing the app. It may or may not have other task files (eg. `config.yaml`) depending on what other functionality this Role supports for this app. The `main.yaml` file in the Role determines the flow logic for which task files are getting run based on Tags. # Artifacts The directory `playbooks/artifacts/` is a place where we save the output for some of the roles. This not only serves the purpose to tracking important state info for our configurations, but it also allows us to use some of this info in other parts of Ansible for cleaner automation. > Never commit this dir to git. It contains sensitive info! Its already configured to be ignored by git.