feat(yunohost): add SMTP relay support
This commit is contained in:
parent
0717812d22
commit
0e59763a0e
5 changed files with 76 additions and 1 deletions
15
README-FR.md
15
README-FR.md
|
@ -31,7 +31,7 @@ ynh_install_script_url: https://install.yunohost.org
|
|||
ynh_admin_password: MYINSECUREPWD_PLZ_OVERRIDE_THIS
|
||||
```
|
||||
|
||||
-`ynh_install_script_url` est le script d'installation des packages Yunohost, par défaut c'est le script officiel. Yunohost ne s'installe que sur Debian 10.
|
||||
- `ynh_install_script_url` est le script d'installation des packages Yunohost, par défaut c'est le script officiel. Yunohost ne s'installe que sur Debian 10.
|
||||
- `ynh_admin_password` est le mot de passe permettant d'accéder à l’interface d’administration du serveur.
|
||||
|
||||
### Gestion des domaines
|
||||
|
@ -49,6 +49,19 @@ ynh_ignore_dyndns_server: False
|
|||
- `ynh_extra_domains` sont des sous-domaines optionnels. Ils permettent d'installer une application par sous-domaine (plus d'infos [ici](https://yunohost.org/fr/dns_subdomains)).
|
||||
- `ynh_ignore_dyndns_server` permet d'enregistrer les domaines avec un service de DNS dynamique (plus d'infos [ici](https://yunohost.org/fr/dns_dynamicip)).
|
||||
|
||||
### Configuration d'un relais SMTP
|
||||
|
||||
```yml
|
||||
# paramètres personnalisés du relais SMTP
|
||||
ynh_smtp_relay:
|
||||
host: smtp.domain.tld
|
||||
port: 25
|
||||
user: user1
|
||||
password: Pa$$w0rd
|
||||
```
|
||||
Yunohost possède son propre serveur SMTP natif mais il est aussi possible de configurer Yunohost pour qu'il utilise un relais SMTP à la place.
|
||||
Pour faire cela, créez la variable `ynh_smtp_relay` et mettez vos propres valeurs. Vous pouvez en apprendre plus sur les relais SMTP [ici](https://yunohost.org/fr/administrate/specific_use_cases/email_relay).
|
||||
|
||||
### Gestion des utilisateurs
|
||||
|
||||
```yml
|
||||
|
|
14
README.md
14
README.md
|
@ -49,6 +49,20 @@ ynh_ignore_dyndns_server: False
|
|||
- `ynh_extra_domains` are optional and allow you to install one app per subdomain (more info [here](https://yunohost.org/en/administrate/specific_use_cases/domains/dns_subdomains)).
|
||||
- `ynh_ignore_dyndns_server` allow to register domains with a Dynamic DNS service (more info [here](https://yunohost.org/en/dns_dynamicip)).
|
||||
|
||||
### SMTP relay configuration
|
||||
|
||||
```yml
|
||||
# SMTP custom settings
|
||||
ynh_smtp_relay:
|
||||
host: smtp.domain.tld
|
||||
port: 25
|
||||
user: user1
|
||||
password: Pa$$w0rd
|
||||
```
|
||||
|
||||
There is a built-in SMTP server on Yunohost but you can also set up Yunohost to use a SMTP relay instead.
|
||||
In order to do so, create the `ynh_smtp_relay` variable and provide your own values. You can learn more about SMTP relay [here](https://yunohost.org/en/administrate/specific_use_cases/email_relay).
|
||||
|
||||
### User management
|
||||
|
||||
```yml
|
||||
|
|
|
@ -36,6 +36,19 @@ ynh_users: null
|
|||
# lastname: Doe
|
||||
# mail_domain: domain.tld
|
||||
|
||||
# Do not touch this variable
|
||||
# Just to have dict default value
|
||||
ynh_smtp_relay:
|
||||
value: null
|
||||
|
||||
# SMTP custom settings (Only override if you need a SMTP relay)
|
||||
# Example:
|
||||
# ynh_smtp_relay:
|
||||
# host: smtp.domain.tld
|
||||
# port: "25"
|
||||
# user: user1
|
||||
# password: Pa$$w0rd
|
||||
|
||||
# The list of Yunohost apps.
|
||||
ynh_apps: null
|
||||
# - label: Tiny Tiny RSS
|
||||
|
|
|
@ -60,6 +60,11 @@
|
|||
ansible.builtin.command: yunohost domain cert-install
|
||||
changed_when: False
|
||||
|
||||
- name: Configure SMTP relay
|
||||
ansible.builtin.include_tasks: smtp_relay.yml
|
||||
loop: "{{ ynh_smtp_relay | dict2items }}"
|
||||
when: item.value
|
||||
|
||||
- name: Add Yunohost users
|
||||
ansible.builtin.include_tasks: users.yml
|
||||
when: ynh_users
|
||||
|
|
30
tasks/smtp_relay.yml
Normal file
30
tasks/smtp_relay.yml
Normal file
|
@ -0,0 +1,30 @@
|
|||
---
|
||||
#-----------------------------------------------------------------------------#
|
||||
# ansible-yunohost allows to deploy Yunohost using Ansible #
|
||||
# Copyright 2021-2021 Lydra https://www.lydra.fr/ #
|
||||
# #
|
||||
# this program is free software: you can redistribute it and/or modify #
|
||||
# it under the terms of the GNU General Public License as published by #
|
||||
# the Free Software Foundation, either version 3 of the License, or #
|
||||
# (at your option) any later version. #
|
||||
# #
|
||||
# this program is distributed in the hope that it will be useful, #
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
|
||||
# GNU General Public License for more details. #
|
||||
# #
|
||||
# You should have received a copy of the GNU General Public License #
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>. #
|
||||
# #
|
||||
#-----------------------------------------------------------------------------#
|
||||
|
||||
- name: Get current SMTP settings
|
||||
ansible.builtin.command:
|
||||
"yunohost settings get smtp.relay.{{ item.key }}"
|
||||
register: _ynh_smtp_current_values
|
||||
changed_when: False
|
||||
|
||||
- name: Set new SMTP settings
|
||||
ansible.builtin.command:
|
||||
"yunohost settings set smtp.relay.{{ item.key }} -v {{ item.value }}"
|
||||
when: _ynh_smtp_current_values.stdout != item.value
|
Loading…
Reference in a new issue