Skip to content
Open
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
17 changes: 17 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,26 @@

.PHONY: roles lint

VARS_DIR := inventory/host_vars/$(domain)
VARS_FILE := inventory/host_vars/$(domain)/vars.yml
HOSTS_FILE := inventory/hosts

help: ## Show this help.
@grep -F -h "##" $(MAKEFILE_LIST) | grep -v grep | sed -e 's/\\$$//' | sed -e 's/##//'

inventory: ## Initialize inventory files
@mkdir -p "$(VARS_DIR)"
@cp examples/vars.yml "$(VARS_FILE)"
@cp examples/hosts inventory/hosts
@sed -i 's/^matrix_domain:.*/matrix_domain: $(domain)/' "$(VARS_FILE)"
@PASSWORD=`openssl rand -base64 64 | head -c 64`; \
sed -i "s#^matrix_homeserver_generic_secret_key:.*#matrix_homeserver_generic_secret_key: '$$PASSWORD'#" "$(VARS_FILE)"
@sed -i 's/^matrix\.example\.com/$(domain)/' "$(HOSTS_FILE)"
@sed -i 's/ansible_host=<[^>]\+>/ansible_host=$(ip)/' "$(HOSTS_FILE)"
@echo "Check and configure your files at:"
@echo $(VARS_FILE)
@echo $(HOSTS_FILE)

roles: ## Pull roles
rm -rf roles/galaxy
ansible-galaxy install -r requirements.yml -p roles/galaxy/ --force
Expand Down
15 changes: 14 additions & 1 deletion docs/quick-start.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,20 @@ To install Matrix services with this playbook, you would at least need 2 configu

For your convenience, we have prepared example files of them ([`vars.yml`](../examples/vars.yml) and [`hosts`](../examples/hosts)).

To start quickly based on these example files, go into the `matrix-docker-ansible-deploy` directory and follow the instructions below:
To start quickly based on these example files, go into the `matrix-docker-ansible-deploy` directory and follow the instructions below.


If you have `just` installed, replace the **domain** and "**1.2.3.4**" with you own and run:
```sh
just matrix.yourdomain.com 1.2.3.4
```

If you have `make`, run:
```sh
make domain=matrix.yourdomain.com ip=1.2.3.4
```

Otherwise you may copy the files manually:

1. Create a directory to hold your configuration: `mkdir -p inventory/host_vars/matrix.example.com` where `example.com` is your "base domain"
2. Copy the sample configuration file: `cp examples/vars.yml inventory/host_vars/matrix.example.com/vars.yml`
Expand Down
20 changes: 20 additions & 0 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,26 @@
default:
@{{ just_executable() }} --list --justfile "{{ justfile() }}"

# Initialize inventory files
inventory domain ip:
#!/usr/bin/env sh
VARS_DIR="inventory/host_vars/{{ domain }}"
VARS_FILE="inventory/host_vars/{{ domain }}/vars.yml"
HOSTS_FILE="inventory/hosts"

mkdir -p "$VARS_DIR"
cp examples/vars.yml "$VARS_FILE"
cp examples/hosts inventory/hosts
sed -i 's/^matrix_domain:.*/matrix_domain: {{ domain }}/' "$VARS_FILE"
PASSWORD=`openssl rand -base64 64 | head -c 64`; \
sed -i "s#^matrix_homeserver_generic_secret_key:.*#matrix_homeserver_generic_secret_key: '$PASSWORD'#" "$VARS_FILE"
sed -i 's/^matrix\.example\.com/{{ domain }}/' "$HOSTS_FILE"
sed -i 's/ansible_host=<[^>]\+>/ansible_host={{ ip }}/' "$HOSTS_FILE"
echo "Check and configure your files at:"
echo $VARS_FILE
echo $HOSTS_FILE


# Pulls external Ansible roles
roles:
#!/usr/bin/env sh
Expand Down
Loading