updated README, use 1 place for the release name (all.yaml)

This commit is contained in:
Thomas von Dein 2024-11-17 17:54:49 +01:00
parent 9057c75b1f
commit 4654b7484c
3 changed files with 35 additions and 6 deletions

View File

@ -5,8 +5,10 @@ TOKEN = $(shell ansible-vault decrypt --vault-password-file \
~/.config/ansible/hcloud.secret --output - \
group_vars/all/vars.yaml | cut -d' ' -f2)
SNAPNAME = $(shell cat group_vars/all/all.yaml | yq .snapshot)
SNAPSHOT = $(shell hcloud image list -t snapshot -o yaml | \
yq '. | map(select(.description == "FreeBSD-14.1-RELEASE-hcloud-init")) | .[].id')
yq '. | map(select(.description == "$(SNAPNAME)")) | .[].id')
OPTIONS = -i inventory -t active
CREATE_COMMAND = ansible-playbook create.yaml $(OPTIONS)
@ -17,6 +19,9 @@ DEBUG_COMMAND = ansible-playbook debug.yaml $(OPTIONS)
ENV = HCLOUD_TOKEN="$(TOKEN)" SNAPSHOT="$(SNAPSHOT)" ANSIBLE_VERBOSITY=$(verbose)
test:
@echo SNAPSHOT="$(SNAPSHOT)"
all: create deploy
debug:

View File

@ -1,6 +1,6 @@
## Ansible roles and playbook to maintain bsdnix.de
### Basics
### Prepare hetzner cloud
In order to be able to deploy freebsd vps' on Hetzner cloud you need to do:
@ -16,14 +16,14 @@ In order to be able to deploy freebsd vps' on Hetzner cloud you need to do:
- shutdown the vps
- create a snapshot, name it visely, I name mine like: `FreeBSD-14.1-RELEASE-hcloud-init`
- delete the builder vps
- update the snapshot name in `group_vars/all/all.yaml`
Then you can deploy new freebsd vps' using this snapshot. They'll come
up, configure themselves to be reachable.
The `deploy.yaml` playbook will then use the hetzner cloud dynamic
inventory to discover your vps. So, you have to call `make deploy`
twice: once to deploy a new vps and second time to configure
it. Subsequent calls only configure of course.
The `create.yaml` playbook will create a new vps if it doesn't exist
yet and the `deploy.yaml` playbook will then use the hetzner cloud
dynamic inventory to discover your vps.
### Setup ansible
@ -61,3 +61,24 @@ To make the output more verbose, add `verbose=N` to the target, e.g.:
`make depoy verbose=2` where N is the verbosity level (0-4)
If you want to execute only a subset of a playbook, remove the `active` tag from it.
### Updating
(not yet completely determined!)
- create a new release snapshot as outlined above
- add a new vps to the local inventory (`inventory/vps.yaml`)
- run `make`
- remove the old vps
or: just call `freebsd-update** - however, if you ever need to rebuild
the vps, then it will come up with the - then - old release. So,
better rebuild from scratch to update.
### Deleting
**CAUTION** the `cleanup.yaml` playbook removes **ALL** running vps
instances! Better use the `hcloud` cli to do this. The cleanup
playbook just exists to make development of the deployment easier so
that I don't need to pay for an non-ready instance running while I'm
not working on it.

View File

@ -11,6 +11,9 @@ packages:
# used by bastille to build a base
release: 14.1-RELEASE
# snapshot to install in new vps
snapshot: FreeBSD-14.1-RELEASE-hcloud-init
location: fsn1
# must already exist in group project