You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Are you interested in adding a new service which is not yet [available on this playbook](supported-services.md)? Great! By following the guide below, you can easily implement one to the playbook.
13
14
14
-
- the role doesn't exist already in [`supported-services.md`](supported-services.md) and no one else is already [working on it](https://github.com/mother-of-all-self-hosting/mash-playbook/pulls)
15
+
### 1. Get started
15
16
16
-
- the service you wish to add can run in a Docker container
17
-
18
-
- a container image already exists
17
+
Before working on implementation, check if:
19
18
20
-
### 2. Create the Ansible role in a public git repository.
21
-
You can follow the structure of existing roles, like the [`ansible-role-gitea`](https://github.com/mother-of-all-self-hosting/ansible-role-gitea) or the [`ansible-role-gotosocial`](https://github.com/mother-of-all-self-hosting/ansible-role-gotosocial).
19
+
- the role does not exist already in [`supported-services.md`](supported-services.md) and no one else is already [working on it](https://github.com/mother-of-all-self-hosting/mash-playbook/pulls)
22
20
23
-
Some advice:
24
-
- Your file structure will probably look something like this:
21
+
- the service you wish to add can run in a Docker container
25
22
26
-
```
27
-
.
28
-
├── defaults/
29
-
│ └── main.yml
30
-
├── meta/
31
-
│ └── main.yml
32
-
├── tasks/
33
-
│ ├── main.yml
34
-
│ ├── install.yml
35
-
│ ├── uninstall.yml
36
-
│ └── validate_config.yml
37
-
├── templates/
38
-
│ ├── env.j2
39
-
│ ├── labels.j2
40
-
│ └── NEW-SERVICE.service.j2
41
-
├── .gitignore
42
-
├── LICENSE
43
-
└── README.md
44
-
```
45
-
- You will need to decide on a licence, without it, ansible-galaxy won't work. We recommend AGPLv3, like all of MASH.
23
+
- a container image already exists
46
24
47
-
### 3. Update the MASH-Playbook to support your created Ansible role
25
+
### 2. Create an Ansible role in a public git repository
26
+
27
+
To support a new service, at first you need to create an Ansible role for it in its public git repository. It does not have to be maintained on a specific forge like GitHub; you can use GitLab, Codeberg, or anywhere you choose. Note that the instance should be stable and globally available as the roles are to be fetched anytime.
28
+
29
+
When it comes to the structure of roles, you can follow existing roles such as [`ansible-role-postgres`](https://github.com/mother-of-all-self-hosting/ansible-role-postgres), [`ansible-role-syncthing`](https://github.com/mother-of-all-self-hosting/ansible-role-syncthing), and [`ansible-role-ntfy`](https://github.com/mother-of-all-self-hosting/ansible-role-ntfy). Generally, it is not recommended to create a role from the scratch as it can lack important variables required for the playbook. If you are not quite sure where to start, your best bet would be to copy the existing (and recently updated) role maintained by [MASH project](https://github.com/mother-of-all-self-hosting), and reuse it as a template.
30
+
31
+
💡 **Notes**:
32
+
- Your role's file structure should be similar to this tree:
33
+
```
34
+
.
35
+
├── defaults/
36
+
│ └── main.yml
37
+
├── docs/
38
+
│ └── configuring-YOUR-SERVICE.md
39
+
├── meta/
40
+
│ └── main.yml
41
+
├── tasks/
42
+
│ ├── main.yml
43
+
│ ├── install.yml
44
+
│ ├── uninstall.yml
45
+
│ └── validate_config.yml
46
+
├── templates/
47
+
│ ├── env.j2
48
+
│ ├── labels.j2
49
+
│ └── systemd/
50
+
│ └── YOUR-SERVICE.service.j2
51
+
├── justfile
52
+
├── LICENSE
53
+
└── README.md
54
+
```
55
+
- You will also need to decide on a licence. Otherwise ansible-galaxy won't work. We recommend AGPLv3, as all roles of the MASH playbook.
56
+
- If you are committed to free software, you might probably be interested in publishing the role based on [REUSE](https://reuse.software/), an initiative by [FSFE](https://fsfe.org/).
57
+
58
+
### 3. Update the MASH playbook to support your created Ansible role
48
59
49
60
There are a few files that you need to adapt:
61
+
50
62
```
51
63
.
52
64
├── docs/
53
65
│ ├── supported-services.md -> Add your service
54
66
│ └── services/
55
-
│ └── YOUR-SERVICE.md -> document how to use it
67
+
│ └── YOUR-SERVICE.md -> Add documentation about how to configure it
💡 Make sure to edit configuration files inside `templates` — These are source files to be optimized and used when running [`just`](just.md) commands to install, configure, or uninstall services.
75
+
76
+
#### Add the role to `group_vars_mash_servers` in `templates` directory
77
+
78
+
On `group_vars_mash_servers` you need to wire your role with the rest of the services of the playbook — integrating with the service manager or potentially with other roles.
79
+
80
+
When adding the role, replace `YOUR-SERVICE` with yours, and also mind the place to add the role, as the roles are (mostly) sorted alphabetically for other developers' sanity.
81
+
82
+
See below for details about what to configure. Note that not all roles require to be wired to anything other than `systemd_service_manager`.
83
+
61
84
<details>
85
+
<summary>Wire the role to systemd_service_manager</summary>
86
+
87
+
You have to add the role to `mash_playbook_devture_systemd_service_manager_services_list_auto_itemized` so that it is wired to `systemd_service_manager`.
Please wire your role to other services than `systemd_service_manager` if necessary.
120
+
92
121
<details>
93
-
<summary>Support Postgres</summary>
122
+
<summary>Wire the role to Postgres / MariaDB</summary>
123
+
124
+
On this playbook Postgres is enabled by default (see [`examples/vars.yml`](../examples/vars.yml)), and you can wire your role to Postgres by adding it to the configuration for Postgres as below:
The [exim-relay](https://github.com/devture/exim-relay) is an easy way to configure for all services a way for outgoing mail.
187
+
💡 If your role requires MySQL, you can instead wire it to MariaDB on this playbook via `mash_playbook_mariadb_managed_databases_auto_itemized` in a similar way. See the [service documentation](services/mariadb.md) for details about managing a MariaDB instance.
188
+
189
+
</details>
190
+
191
+
<details>
192
+
<summary>Wire the role to exim-relay (mailer)</summary>
193
+
194
+
This playbook implements [exim-relay](https://github.com/devture/exim-relay), a SMTP mailer service.
195
+
196
+
Various services need to send out email, and exim-relay gives you a centralized place for configuring email-sending.
197
+
198
+
To wire the role to exim-relay, add the configuration for it as below:
<summary>Wire the role to Hubsite (static site for services overview)</summary>
238
+
239
+
[Hubsite](https://github.com/moan0s/hubsite) is a service which provides you with a simple static site that shows an overview of the available services.
194
240
195
-
<summary>Support hubsite</summary>
241
+
Adding the role to Hubsite is not a hard requirement to add the role to the playbook, but it is recommended to do so, so that you (and visitors of your services) can easily navigate to the services available on your server.
196
242
197
-
- Add the logo of your Service to [`ansible-role-hubsite/assets`](https://github.com/mother-of-all-self-hosting/ansible-role-hubsite/tree/main/assets) via a pull request.
198
-
- configure the `group_vars_mash_servers` file:
243
+
To wire the role to Hubsite, add the configuration for it as below:
- If the service of your role distributes its logo under free licenses, you can add it to [`ansible-role-hubsite/assets`](https://github.com/mother-of-all-self-hosting/ansible-role-hubsite/tree/main/assets) via a pull request.
290
+
242
291
</details>
243
292
244
293
### Additional hints
245
294
246
-
- Add a line like `# Project source code URL: YOUR-SERVICE-GIT-REPO` to your Ansible role's `defaults/main.yml` file, so that [`bin/feeds.py`](/bin/feeds.py) can automatically find the Atom/RSS feed for new releases.
295
+
Please consider to add a line like `# Project source code URL: YOUR-SERVICE-GIT-REPO` to your Ansible role's `defaults/main.yml` file, so that [`bin/feeds.py`](/bin/feeds.py) can automatically find the Atom/RSS feed for new releases.
296
+
297
+
If you have any questions, you are welcomed to join the Matrix room for the MASH playbook and free free to ask: https://matrix.to/#/%23mash-playbook:devture.com
0 commit comments