diff --git a/roles/ynh_backup/tasks/main.yml b/roles/ynh_backup/tasks/main.yml index 0c9d4afa2059463ee435d26906d1d8a12442ac0b..03b79dddebef03bfe142583e8adbbbcd5c5930a1 100644 --- a/roles/ynh_backup/tasks/main.yml +++ b/roles/ynh_backup/tasks/main.yml @@ -1,2 +1,23 @@ --- -# tasks file for ynh_test +#-----------------------------------------------------------------------------# +# 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: Enable Yunohost apps backup + ansible.builtin.include_tasks: backup.yml + when: ynh_apps_backup.scheduled diff --git a/roles/ynh_backup/vars/main.yml b/roles/ynh_backup/vars/main.yml deleted file mode 100644 index 974325d5acc9b724a113b968464cf9654cc58dd4..0000000000000000000000000000000000000000 --- a/roles/ynh_backup/vars/main.yml +++ /dev/null @@ -1,2 +0,0 @@ ---- -# vars file for ynh_test diff --git a/roles/ynh_config/README-FR.md b/roles/ynh_config/README-FR.md index f239c7cce8a5f434c3f8a8189582c01e2c3a5d3c..1e9ed720591c0b1c5fb5944f5516a9ddad27af97 100644 --- a/roles/ynh_config/README-FR.md +++ b/roles/ynh_config/README-FR.md @@ -8,11 +8,11 @@ [](https://github.com/LydraFr/ansible-yunohost) [](https://github.com/LydraFr/ansible-yunohost) -# Rôle Ansible : Yunohost Backup +# Rôle Ansible : Yunohost Configuration [🇬🇧 English version](README.md) -Sauvegardez [Yunohost](https://yunohost.org/#/) avec Ansible ! +Configurez [Yunohost](https://yunohost.org/#/) avec Ansible ! ## Prérequis @@ -20,7 +20,7 @@ Yunohost doit déjà être installé sur votre serveur. ## Variables du rôle -Les variables par défaut sont disponibles dans `default/main.yml` cependant il est possible de les surcharger selon vos besoins en ... +Les variables par défaut sont disponibles dans `default/main.yml` cependant il est possible de les surcharger selon vos besoins. ### Configuration d'un relais SMTP @@ -32,7 +32,8 @@ ynh_smtp_relay: 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. + +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). ### Concernant les mises à jour @@ -47,15 +48,15 @@ ynh_autoupdate: dest_script: "/usr/bin/" ``` -Une tâche cron peut être mise en place pour automatiser la vérification des mises à jour système et applications suivant la périodicité de votre choix. - - `ynh_autoupdate.scheduled` : activez la tâche cron en mettant la valeur à `True`. - - `ynh_autoupdate.special_time`: est obligatoire. Elle permet de préciser quand vous souhaitez que cette tâche soit exécutée. Valeurs possibles : (`annually`,`daily`,`hourly`,`monthly`,`reboot`,`weekly`,`yearly`). - Pour en savoir plus sur les _special times_, cliquez [ici](https://docs.ansible.com/ansible/latest/collections/ansible/builtin/cron_module.html). - - `ynh_autoupdate.apps` : est obligatoire. Activez la mise à jour automatique des applications Yunohost en mettant la valeur à `True`. - - `ynh_autoupdate.system` : est obligatoire. Activez la mise à jour automatique du système Yunohost en mettant la valeur à `True`. - - `ynh_autoupdate.dest_script` : c'est le chemin du répertoire où le script de mise à jour sera installé sur le serveur. La valeur par défaut est `/usr/local/bin`. Le script s'appelle `ynh_autoupdate.sh`. +Une tâche cron peut être mise en place pour automatiser la vérification des mises à jour système et applications suivant la périodicité de votre choix. + +- `ynh_autoupdate.scheduled` : activez la tâche cron en mettant la valeur à `True`. +- `ynh_autoupdate.special_time`: est obligatoire. Elle permet de préciser quand vous souhaitez que cette tâche soit exécutée. Valeurs possibles : (`annually`,`daily`,`hourly`,`monthly`,`reboot`,`weekly`,`yearly`). Pour en savoir plus sur les _special times_, cliquez [ici](https://docs.ansible.com/ansible/latest/collections/ansible/builtin/cron_module.html). +- `ynh_autoupdate.apps` : est obligatoire. Activez la mise à jour automatique des applications Yunohost en mettant la valeur à `True`. +- `ynh_autoupdate.system` : est obligatoire. Activez la mise à jour automatique du système Yunohost en mettant la valeur à `True`. +- `ynh_autoupdate.dest_script` : c'est le chemin du répertoire où le script de mise à jour sera installé sur le serveur. La valeur par défaut est `/usr/local/bin`. Le script s'appelle `ynh_autoupdate.sh`. -Si des mises à jour sont disponibles, elles sont faites automatiquement. En cas de problème suite à la mise à jour d'une application, vous pouvez lire les logs qui sont disponibles ici `/var/log/yunohost/categories/operation`. Vous avez aussi la possibilité de revenir à la version précédente car Yunohost fait toujours une sauvegarde automatique d'une application lorsqu'elle est mise à jour. +Si des mises à jour sont disponibles, elles sont faites automatiquement. En cas de problème suite à la mise à jour d'une application, vous pouvez lire les logs qui sont disponibles ici `/var/log/yunohost/categories/operation`. Vous avez aussi la possibilité de revenir à la version précédente car Yunohost fait toujours une sauvegarde automatique d'une application lorsqu'elle est mise à jour. Pour en savoir plus sur le fonctionnement des mises à jour dans Yunohost vous pouvez vous rendre [ici](https://yunohost.org/fr/update). Le changelog des versions de Yunohost est aussi disponible [ici](https://forum.yunohost.org/tag/ynh_release). @@ -67,7 +68,7 @@ Aucune. ```yml --- -- name: Install Yunohost on Debian Server +- name: Configure Yunohost on Debian Server hosts: all become: True pre_tasks: diff --git a/roles/ynh_config/README.md b/roles/ynh_config/README.md index 5ec840edc5faf8d397158219203aef6df7807e40..34af3ebe6bc152773776d985b8bb47786d1d76c6 100644 --- a/roles/ynh_config/README.md +++ b/roles/ynh_config/README.md @@ -36,7 +36,6 @@ ynh_smtp_relay: 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). - ### About the updates ```yml @@ -50,11 +49,12 @@ ynh_autoupdate: ``` A cron job can been set up to automate the check for system and application updates on a schedule of your choice. - - `ynh_autoupdate.scheduled` : enables the cron job by setting the value to `True`. - - `ynh_autoupdate.special_time`: it is mandatory. It allows you to specify when you want this task to be executed. Possible values: (`annually`,`daily`,`hourly`,`monthly`,`reboot`,`weekly`,`yearly`). To learn more about special times, click [here](https://docs.ansible.com/ansible/latest/collections/ansible/builtin/cron_module.html). - - `ynh_autoupdate.apps`: is mandatory. Enable automatic updating of Yunohost applications by setting the value to `True`. - - `ynh_autoupdate.system`: is mandatory. Enable automatic updating of the Yunohost system by setting the value to `True`. - - `ynh_autoupdate.dest_script`: it is the path to the directory where the update script will be installed on the server. The default value is `/usr/local/bin`. The script is named `ynh_autoupdate.sh`. + +- `ynh_autoupdate.scheduled` : enables the cron job by setting the value to `True`. +- `ynh_autoupdate.special_time`: it is mandatory. It allows you to specify when you want this task to be executed. Possible values: (`annually`,`daily`,`hourly`,`monthly`,`reboot`,`weekly`,`yearly`). To learn more about special times, click [here](https://docs.ansible.com/ansible/latest/collections/ansible/builtin/cron_module.html). +- `ynh_autoupdate.apps`: is mandatory. Enable automatic updating of Yunohost applications by setting the value to `True`. +- `ynh_autoupdate.system`: is mandatory. Enable automatic updating of the Yunohost system by setting the value to `True`. +- `ynh_autoupdate.dest_script`: it is the path to the directory where the update script will be installed on the server. The default value is `/usr/local/bin`. The script is named `ynh_autoupdate.sh`. If available, updates are done automatically. In case of problems following an application update, you can read logs located in `/var/log/yunohost/categories/operation` . You also have the possibility to rollback to the previous version since Yunohost always makes an automatic backup of an application when it is updated. diff --git a/roles/ynh_config/tasks/main.yml b/roles/ynh_config/tasks/main.yml index c12e3fb8aad98ddb4d8a18381c4d5eafba5b5687..7650a87751eddfd182099ab857bc24d577b3eb4f 100644 --- a/roles/ynh_config/tasks/main.yml +++ b/roles/ynh_config/tasks/main.yml @@ -1,2 +1,28 @@ --- -# tasks file for ynh_test2 +#-----------------------------------------------------------------------------# +# 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: Configure SMTP relay + ansible.builtin.include_tasks: smtp_relay.yml + loop: "{{ ynh_smtp_relay | dict2items }}" + when: item.value + +- name: Configures Yunohost autoupdate + ansible.builtin.include_tasks: autoupdate.yml + when: ynh_autoupdate.scheduled diff --git a/roles/ynh_config/templates/ynh_autoupdate.sh.j2 b/roles/ynh_config/templates/ynh_autoupdate.sh.j2 new file mode 100644 index 0000000000000000000000000000000000000000..27e77bbb11bb2bca412a5862f9a5bd3fbf0aeea9 --- /dev/null +++ b/roles/ynh_config/templates/ynh_autoupdate.sh.j2 @@ -0,0 +1,14 @@ +#!/bin/sh + +yunohost tools update +{% if ynh_autoupdate.system %} + yunohost tools upgrade system +{% endif %} +{% if ynh_autoupdate.apps %} + yunohost tools upgrade apps +{% endif %} +{% if ynh_autoupdate.system is false and ynh_autoupdate.apps is false %} + echo "Read the readme to know more about ynh_autoupdate.apps and ynh_autoupdate.system" + echo "https://lab.frogg.it/lydra/yunohost/ansible-yunohost/-/blob/main/README.md" + exit 1 +{% endif %} diff --git a/roles/ynh_config/vars/main.yml b/roles/ynh_config/vars/main.yml deleted file mode 100644 index 0f6d3e4827c171ee2fec38560099461c395cd7e3..0000000000000000000000000000000000000000 --- a/roles/ynh_config/vars/main.yml +++ /dev/null @@ -1,2 +0,0 @@ ---- -# vars file for ynh_test2 diff --git a/roles/ynh_setup/vars/main.yml b/roles/ynh_setup/vars/main.yml deleted file mode 100644 index fb0de593280e26f38b86ea19cad3f90e1fe3c0d1..0000000000000000000000000000000000000000 --- a/roles/ynh_setup/vars/main.yml +++ /dev/null @@ -1,2 +0,0 @@ ---- -# vars file for ynh_test3