This PR was primarily looking to resolve #53 & #109. However, I ran across some things that required adjusting (which will benefit us when we tidy up everything a bit more!).
Special thanks to @mpraeger for the inspiration. I've added you as a co-author on the initial commit as I re-used some of your code & idea's.
Move postgres_password variable to vars.yml instead of being defined in lemmy.yml and lemmy-almalinux.yml. This exposes it to users in case they have an existing database they would like to use or if they’d prefer to set it manually (it also helps clean up the playbooks by centralizing the configuration variables)
Rename the generated inventory/host_vars/<fqdn>/passwords/postgres to inventory/host_vars/<fqdn>/passwords/postgres.psk. The reason for this change is we’re currently not using the host_vars path entirely correctly, so it’s attempting to parse the password file as a variable file and will puke due to an invalid syntax. By default, Ansible will read in inventory/host_vars/<fqdn>/{*.yml,*.yaml,*.ini,exec_file} files.
Adjust the example inventory (examples/hosts) to use a better format. Instead of using user@server.com, we opt to use the ansible_user=user to avoid unpredictable variable loading. Using the above examples, if you have user@server.com in your inventory, Ansible will look for variables in inventory/host_vars/user@server.com directory instead of the expected inventory/host_vars/server.com directory.
Tested against:
AlmaLinux 9/RHEL 9
~Debian 10~ (UNTESTED, should work)
Debian 11
Debian 12
Ubuntu 22.04 LTS
Could someone verify at least one or more of the target distributions above? I didn't have time to test pict-rs with S3, but I can confirm the environmental variables get populated and injected into the VM properly. We should try this to ensure there is no funny business when using S3 for object storage.
This PR was primarily looking to resolve #53 & #109. However, I ran across some things that required adjusting (which will benefit us when we tidy up everything a bit more!).
Special thanks to @mpraeger for the inspiration. I've added you as a co-author on the initial commit as I re-used some of your code & idea's.
Primary Changes
Remove the environmental variables defined in the
docker-compose.yml
template forpict-rs
and move them to avars.yml
file which is used to configure & maintain variables in a sane spot (instead of them floating around in the playbook) https://github.com/LemmyNet/lemmy-ansible/commit/a8c859da60d31281faa34d1de57049f728436121PICTRS__SERVER__API_KEY
default topostgres_password
to ensure interoperability with prior versions, but this allows users to have more agency over what it’s set to. https://github.com/LemmyNet/lemmy-ansible/commit/a8c859da60d31281faa34d1de57049f728436121#diff-fadf44a49d340433e809fac78150211bc15b8047e299b14bf891197a2f8a54fdR6Move
postgres_password
variable tovars.yml
instead of being defined inlemmy.yml
andlemmy-almalinux.yml
. This exposes it to users in case they have an existing database they would like to use or if they’d prefer to set it manually (it also helps clean up the playbooks by centralizing the configuration variables)inventory/host_vars/<fqdn>/passwords/postgres
toinventory/host_vars/<fqdn>/passwords/postgres.psk
. The reason for this change is we’re currently not using thehost_vars
path entirely correctly, so it’s attempting to parse the password file as a variable file and will puke due to an invalid syntax. By default, Ansible will read ininventory/host_vars/<fqdn>/{*.yml,*.yaml,*.ini,exec_file}
files.Adjust the example inventory (
examples/hosts
) to use a better format. Instead of usinguser@server.com
, we opt to use theansible_user=user
to avoid unpredictable variable loading. Using the above examples, if you haveuser@server.com
in your inventory, Ansible will look for variables ininventory/host_vars/user@server.com
directory instead of the expectedinventory/host_vars/server.com
directory.Tested against:
Could someone verify at least one or more of the target distributions above? I didn't have time to test
pict-rs
with S3, but I can confirm the environmental variables get populated and injected into the VM properly. We should try this to ensure there is no funny business when using S3 for object storage.