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 - \ ~/.config/ansible/hcloud.secret --output - \
group_vars/all/vars.yaml | cut -d' ' -f2) 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 | \ 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 OPTIONS = -i inventory -t active
CREATE_COMMAND = ansible-playbook create.yaml $(OPTIONS) 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) ENV = HCLOUD_TOKEN="$(TOKEN)" SNAPSHOT="$(SNAPSHOT)" ANSIBLE_VERBOSITY=$(verbose)
test:
@echo SNAPSHOT="$(SNAPSHOT)"
all: create deploy all: create deploy
debug: debug:

View File

@ -1,6 +1,6 @@
## Ansible roles and playbook to maintain bsdnix.de ## 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: 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 - shutdown the vps
- create a snapshot, name it visely, I name mine like: `FreeBSD-14.1-RELEASE-hcloud-init` - create a snapshot, name it visely, I name mine like: `FreeBSD-14.1-RELEASE-hcloud-init`
- delete the builder vps - 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 Then you can deploy new freebsd vps' using this snapshot. They'll come
up, configure themselves to be reachable. up, configure themselves to be reachable.
The `deploy.yaml` playbook will then use the hetzner cloud dynamic The `create.yaml` playbook will create a new vps if it doesn't exist
inventory to discover your vps. So, you have to call `make deploy` yet and the `deploy.yaml` playbook will then use the hetzner cloud
twice: once to deploy a new vps and second time to configure dynamic inventory to discover your vps.
it. Subsequent calls only configure of course.
### Setup ansible ### 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) `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. 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 # used by bastille to build a base
release: 14.1-RELEASE release: 14.1-RELEASE
# snapshot to install in new vps
snapshot: FreeBSD-14.1-RELEASE-hcloud-init
location: fsn1 location: fsn1
# must already exist in group project # must already exist in group project