Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor as Ansible Collection and Roles #181

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,11 @@ If you wish to see another distribution on the list, please test on the latest c

[Here are all the config options.](https://join-lemmy.org/docs/en/administration/configuration.html#full-config-with-default-values)

4. Copy the sample inventory hosts file:
4. Copy the sample inventory yml file:

`cp examples/hosts inventory/hosts`
`cp examples/inventory.yml inventory/inventory.yml`

Edit the inventory hosts file (inventory/hosts) to your liking.
Edit the inventory `inventory.yml` file (`inventory/inventory.yml`) to your liking.

5. Copy the sample postgresql.conf

Expand All @@ -68,15 +68,15 @@ If you wish to see another distribution on the list, please test on the latest c

_Note_: See the "Supported Distribution Playbook Matrix" section above if you should use `lemmy.yml` or not

`ansible-playbook -i inventory/hosts lemmy.yml`
`ansible-playbook -i inventory/inventory.yml lemmy.yml`

_Note_: if you are not the root user or don't have password-less sudo, use this command:

`ansible-playbook -i inventory/hosts lemmy.yml --become --ask-become-pass`
`ansible-playbook -i inventory/inventory.yml lemmy.yml --become --ask-become-pass`

_Note_: if you haven't set up ssh keys[^1], and ssh using a password, use the command:

`ansible-playbook -i inventory/hosts lemmy.yml --become --ask-pass --ask-become-pass`
`ansible-playbook -i inventory/inventory.yml lemmy.yml --become --ask-pass --ask-become-pass`

[Full ansible command-line docs](https://docs.ansible.com/ansible/latest/cli/ansible-playbook.html)

Expand Down Expand Up @@ -105,7 +105,7 @@ Major changes:
- Rename `inventory/host_vars/{{ domain }}/passwords/postgres` file to `inventory/host_vars/{{ domain }}/passwords/postgres.psk`
- Copy the `examples/vars.yml` file to `inventory/host_vars/{{ domain }}/vars.yml`
- Edit your variables as desired
- Run your regular deployment. Example: `ansible-playbook -i inventory/hosts lemmy.yml --become`
- Run your regular deployment. Example: `ansible-playbook -i inventory/inventory.yml lemmy.yml --become`

### Upgrading to 1.1.0 (Lemmy 0.18.3)

Expand All @@ -121,7 +121,7 @@ Major changes:

## Uninstall

`ansible-playbook -i inventory/hosts uninstall.yml --become`
`ansible-playbook -i inventory/inventory.yml uninstall.yml --become`

## License

Expand Down
15 changes: 0 additions & 15 deletions examples/hosts

This file was deleted.

22 changes: 22 additions & 0 deletions examples/inventory.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
all:
vars:
ansible_connection: ssh
hosts:
lemmy_example_com:
ansible_host: 192.168.10.1
ansible_become: true
children:
lemmy:
vars:
# replace `root` with your the username you use to connect to your ssh server
ansible_user: root
# replace `lemmy.example.com` with your lemmy domain
domain: lemmy.example.com
# replace `[email protected]` with your email address,
# to get notifications if your ssl cert expires
letsencrypt_contact_email: your@[email protected]
# the location on the server where lemmy can be installed, can be any folder
# if you are upgrading from a previous version, set this to `/lemmy`
lemmy_base_dir: /srv/lemmy
hosts:
lemmy_example_com:
14 changes: 13 additions & 1 deletion examples/vars.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
postgres_password: "{{ lookup('password', 'inventory/host_vars/{{domain}}/passwords/postgres.psk chars=ascii_letters,digits') }}"
postgres_password: "{{ lookup('password', 'inventory/host_vars/{{ domain }}/passwords/postgres.psk chars=ascii_letters,digits') }}"
# Next two only relevant if pictrs_safety == True
pictrs_safety_worker_auth: "{{ lookup('password', 'inventory/host_vars/{{ domain }}/passwords/pictrs_safety_worker_auth.psk chars=ascii_letters,digits length=15') }}"
pictrs_safety_secret: "{{ lookup('password', 'inventory/host_vars/{{ domain }}/passwords/pictrs_safety_secret.psk chars=ascii_letters,digits length=80') }}"

# You can set any pict-rs environmental variables here. They will populate the templates/docker-compose.yml file.
# https://git.asonix.dog/asonix/pict-rs
Expand Down Expand Up @@ -35,3 +38,12 @@ lemmyui_env_vars:

postfix_env_vars:
- POSTFIX_myhostname: "{{ domain }}"

pictrs_safety_env_vars:
# Use this in your fedi-safety to allow your worker to authenticate to pictrs-safety
- FEDIVERSE_SAFETY_WORKER_AUTH: "{{ pictrs_safety_worker_auth }}"
- FEDIVERSE_SAFETY_IMGDIR: "/tmp/images"
- USE_SQLITE: 1
- secret_key: "{{ pictrs_safety_secret }}"
- SCAN_BYPASS_THRESHOLD: 10
- MISSING_WORKER_THRESHOLD: 5
20 changes: 20 additions & 0 deletions galaxy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---

namespace: "lemmynet"
name: "lemmy"
version: "0.1.0"
readme: "README.md"
authors:
- "dessalines"
- "codyro"
- "db0"
dependencies: {}
license:
- "GPL-3.0-or-later"
tags:
- lemmy
- docker
- collection
repository: "https://github.com/LemmyNet/lemmy-ansible"
issues: "https://github.com/LemmyNet/lemmy-ansible/issues"
description: Collection for installation of lemmy and adjacent software
Loading