refactor: ynh_apps is now a role
This commit is contained in:
parent
26351e9e11
commit
5b78dd4c11
10 changed files with 242 additions and 129 deletions
94
roles/ynh_apps/README-FR.md
Normal file
94
roles/ynh_apps/README-FR.md
Normal file
|
@ -0,0 +1,94 @@
|
|||
# Rôle Ansible : Yunohost Apps
|
||||
|
||||
[🇬🇧 English version](README.md)
|
||||
|
||||
Installez les applications [Yunohost](https://yunohost.org/#/) avec Ansible !
|
||||
Retrouvez la liste des applications Yunohost [ici](https://yunohost.org/fr/applications/catalog).
|
||||
|
||||
## Prérequis
|
||||
|
||||
Aucun.
|
||||
|
||||
## Variables du rôle
|
||||
|
||||
Les variables par défaut sont disponibles dans `default/main.yml` cependant il est nécessaire de les surcharger selon vos besoins en termes de domaines, d'utilisateurs et d'applications sur Yunohost.
|
||||
|
||||
### Gestion des applications
|
||||
|
||||
```yml
|
||||
# Liste des applications Yunohost.
|
||||
ynh_apps:
|
||||
- label: WikiJS
|
||||
link: wikijs
|
||||
args:
|
||||
domain: wiki.domain.tld
|
||||
path: /
|
||||
admin: user1
|
||||
is_public: no
|
||||
- label: Discourse
|
||||
link: discourse
|
||||
args:
|
||||
domain: forum.domain.tld
|
||||
path: /
|
||||
admin: user1
|
||||
is_public: yes
|
||||
post_install:
|
||||
- src: "templates/site_settings.yml.j2"
|
||||
dest: "/var/www/discourse/config/site_settings.yml"
|
||||
type: "config"
|
||||
|
||||
- src: "templates/configure_discourse.sh.j2"
|
||||
dest: "/tmp/configure_discourse.sh"
|
||||
type: "script"
|
||||
owner: root
|
||||
group: root
|
||||
```
|
||||
|
||||
- `ynh_apps` est la liste des applications à installer.
|
||||
- `label` permet de donner un nom personnalisé à l'application sur l'interface utilisateur.
|
||||
- `link` correspond au nom de l'application Yunohost qu'on veut installer.
|
||||
|
||||
#### Concernant les arguments
|
||||
|
||||
- `domain` est obligatoire. Il faut choisir un des domaines de son instance Yunohost.
|
||||
- `path` est obligatoire. Il faut choisir une URL pour accéder à son application comme `domain.tld/my_app`. Utilisez juste `/` si l'application doit s'installer sur un sous-domaine.
|
||||
- `is_public` est un argument qu'on retrouve souvent. Paramétré sur `yes`, l'application sera accessible à tout le monde, même sans authentification sur le portail SSO Yunohost. Paramétré sur `no`, l'application ne sera accessible qu'après authentification.
|
||||
|
||||
Pour les autres arguments, il faut se référer au `manifest.json` disponible dans le dépôt de l'application Yunohost qu'on installe. Vous pouvez en apprendre plus sur cette partie [ici](https://yunohost.org/fr/packaging_apps_manifest).
|
||||
|
||||
#### Concernant la post-installation
|
||||
|
||||
Il est possible de compléter l'installation des applications par l'ajout de templates jinja de configuration ou de scripts que vous aurez écrit de votre côté.
|
||||
Pour activer cette fonctionnalité, définissez la variable `post_install` qui correspond à la liste des fichiers de post-installation de votre application.
|
||||
Cette tâche utilisant le module template, vous pouvez tout à fait utiliser vos propres variables et les appeler dans vos fichiers de template. Pour en savoir sur ce module, cliquez [ici](https://docs.ansible.com/ansible/latest/collections/ansible/builtin/template_module.html).
|
||||
|
||||
- `src` est obligatoire. Il s'agit du répertoire où le fichier de template se situe sur la machine qui execute Ansible.
|
||||
- `dest` est obligatoire. Il s'agit du répertoire où le fichier de template va être stocké.
|
||||
- `type` est obligatoire :
|
||||
- Si vous précisez comme valeur `script` alors le fichier de template aura pour droits 740. Il sera exécuté après son transfert sur le serveur Yunohost (généralement dans `/tmp/`) puis il sera supprimé.
|
||||
- Si vous précisez comme valeur `config` alors le fichier de template aura pour droits 660. Il sera transféré sur le serveur Yunohost (généralement dans `/var/www/AppName/`) et vous pourrez l'importer avec un script shell à côté par exemple.
|
||||
|
||||
Pour `owner` et `group`, par défaut le fichier va prendre comme utilisateur propriétaire le nom de l'application et comme groupe propriétaire www-data (groupe NGINX). Vous pouvez les changer en précisant des valeurs différentes.
|
||||
|
||||
## Dépendances
|
||||
|
||||
Aucune.
|
||||
|
||||
## Exemple de Playbook
|
||||
|
||||
```yml
|
||||
---
|
||||
- name: Install Yunohost apps
|
||||
hosts: all
|
||||
become: True
|
||||
collections:
|
||||
- lydra.yunohost
|
||||
roles:
|
||||
- ynh_apps
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
[![ansible-yunohost Copyright 2021 Lydra](https://www.gnu.org/graphics/gplv3-with-text-136x68.png)](https://choosealicense.com/licenses/gpl-3.0/)
|
||||
|
||||
**ansible-yunohost** est maintenu par [Lydra](https://lydra.fr/) et publié sous la licence GPL3.
|
94
roles/ynh_apps/README.md
Normal file
94
roles/ynh_apps/README.md
Normal file
|
@ -0,0 +1,94 @@
|
|||
# Ansible Role: Yunohost Apps
|
||||
|
||||
[🇫🇷 French version](README-FR.md)
|
||||
|
||||
Install [Yunohost](https://yunohost.org/#/) apps with Ansible!
|
||||
You can find the list of available Yunohost applications [here](https://yunohost.org/en/apps).
|
||||
|
||||
## Requirements
|
||||
|
||||
None.
|
||||
|
||||
## Role Variables
|
||||
|
||||
Default variables are available in `default/main.yml` however it is necessary to override them according to your needs for Yunohost domains, users and apps.
|
||||
|
||||
### App management
|
||||
|
||||
```yml
|
||||
# The list of Yunohost apps.
|
||||
ynh_apps:
|
||||
- label: WikiJS
|
||||
link: wikijs
|
||||
args:
|
||||
domain: wiki.domain.tld
|
||||
path: /
|
||||
admin: user1
|
||||
is_public: no
|
||||
- label: Discourse
|
||||
link: discourse
|
||||
args:
|
||||
domain: forum.domain.tld
|
||||
path: /
|
||||
admin: user1
|
||||
is_public: yes
|
||||
post_install:
|
||||
- src: "templates/site_settings.yml.j2"
|
||||
dest: "/var/www/discourse/config/site_settings.yml"
|
||||
type: "config"
|
||||
|
||||
- src: "templates/configure_discourse.sh.j2"
|
||||
dest: "/tmp/configure_discourse.sh"
|
||||
type: "script"
|
||||
owner: root
|
||||
group: root
|
||||
```
|
||||
|
||||
- `ynh_apps` is the list of applications to install.
|
||||
- `label` allows you to give a custom name to the application on the user interface.
|
||||
- `link` is the name of the Yunohost application to install.
|
||||
|
||||
#### About the arguments
|
||||
|
||||
- `domain` is essential. You have to choose one of the domains of your Yunohost instance.
|
||||
- `path` is required. You have to choose a URL to access your application like `domain.tld/my_app`. Just use `/` if the application is to be installed on a subdomain.
|
||||
- `is_public` argument is a common one. Set to `yes`, the application will be accessible to everyone, even without authentication to the Yunohost SSO portal. Set to `no`, the application will be accessible only after authentication.
|
||||
|
||||
For the other arguments, you have to refer to the `manifest.json` available in the repository of the Yunohost application you install. You can learn more about this part [here](https://yunohost.org/fr/packaging_apps_manifest).
|
||||
|
||||
#### About the post-installation
|
||||
|
||||
It is possible to complete the installation of applications by adding jinja template configuration files or scripts written by yourself.
|
||||
To enable this feature, define the `post_install` variable which corresponds to the list of post-installation files of your applications.
|
||||
Because this task uses the template module, you can use your own variables and call them in your template files. To know more about this module, click [here](https://docs.ansible.com/ansible/latest/collections/ansible/builtin/template_module.html).
|
||||
|
||||
- `src` is mandatory. This is the directory where the template file is located on the machine running Ansible.
|
||||
- `dest` is mandatory. This is the directory where the template file will be stored.
|
||||
- `type` is mandatory:
|
||||
- If you specify `script` as the value, then the template file will have 740 rights. It will be executed after it is transferred to the Yunohost server (usually in `/tmp/`) and then deleted.
|
||||
- If you specify `config` as the value, then the template file will have 660 rights. It will be transferred to the Yunohost server (usually in `/var/www/AppName/`) and after you could import it with a shell script on the side for example.
|
||||
|
||||
For `owner` and `group`, by default the file will take as owner the name of the application and as owner www-data(NGINX group). You can change them by specifying different values.
|
||||
|
||||
## Dependencies
|
||||
|
||||
None.
|
||||
|
||||
## Example Playbook
|
||||
|
||||
```yml
|
||||
---
|
||||
- name: Install Yunohost apps
|
||||
hosts: all
|
||||
become: True
|
||||
collections:
|
||||
- lydra.yunohost
|
||||
roles:
|
||||
- ynh_apps
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
[![ansible-yunohost Copyright 2021 Lydra](https://www.gnu.org/graphics/gplv3-with-text-136x68.png)](https://choosealicense.com/licenses/gpl-3.0/)
|
||||
|
||||
**ansible-yunohost** is maintained by [Lydra](https://lydra.fr/) and released under the GPL3 license.
|
33
roles/ynh_apps/defaults/main.yml
Normal file
33
roles/ynh_apps/defaults/main.yml
Normal file
|
@ -0,0 +1,33 @@
|
|||
---
|
||||
#-----------------------------------------------------------------------------#
|
||||
# ansible-yunohost allows to deploy Yunohost using Ansible #
|
||||
# Copyright 2021-present 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/>. #
|
||||
# #
|
||||
#-----------------------------------------------------------------------------#
|
||||
|
||||
# The list of Yunohost apps.
|
||||
ynh_apps: null
|
||||
# - label: Tiny Tiny RSS
|
||||
# link: ttrss
|
||||
# args:
|
||||
# domain: domain.tld
|
||||
# path: /ttrss
|
||||
# post_install:
|
||||
# - src: "templates/file.sh.j2"
|
||||
# dest: "/tmp/script.sh"
|
||||
# type: script
|
||||
# owner: ttrss # Only provide if different from app name
|
||||
# group: ttrss # Only provide if different from www-data
|
18
roles/ynh_apps/meta/main.yml
Normal file
18
roles/ynh_apps/meta/main.yml
Normal file
|
@ -0,0 +1,18 @@
|
|||
---
|
||||
galaxy_info:
|
||||
role_name: ynh_apps
|
||||
author: lydra
|
||||
description: Install Yunohost apps with Ansible
|
||||
license: GPL-v3
|
||||
min_ansible_version: 2.10
|
||||
github_branch: main
|
||||
platforms:
|
||||
- name: Debian
|
||||
versions:
|
||||
- buster
|
||||
galaxy_tags:
|
||||
- yunohost
|
||||
- cloud
|
||||
- web
|
||||
|
||||
dependencies: []
|
|
@ -38,4 +38,3 @@
|
|||
when: ynh_app.label not in ynh_installed_apps.values()
|
||||
tags:
|
||||
- apps
|
||||
|
|
@ -22,4 +22,5 @@
|
|||
ansible.builtin.include_tasks: apps.yml
|
||||
when: ynh_apps
|
||||
tags:
|
||||
- yunohost
|
||||
- apps
|
||||
|
|
|
@ -53,63 +53,6 @@ ynh_users:
|
|||
|
||||
- `ynh_users` est la liste des utilisateurs à créer. Chaque champ est obligatoire. Certaines applications Yunohost nécessitent qu'un utilisateur soit administrateur de l'application. Il aura ensuite le droit de gérer l'application depuis l'interface l'administration du serveur. Vous pouvez en apprendre plus sur la gestion des utilisateurs Yunohost [ici](https://yunohost.org/fr/administrate/overview/users).
|
||||
|
||||
### Gestion des applications
|
||||
|
||||
```yml
|
||||
# Liste des applications Yunohost.
|
||||
ynh_apps:
|
||||
- label: WikiJS
|
||||
link: wikijs
|
||||
args:
|
||||
domain: wiki.domain.tld
|
||||
path: /
|
||||
admin: user1
|
||||
is_public: no
|
||||
- label: Discourse
|
||||
link: discourse
|
||||
args:
|
||||
domain: forum.domain.tld
|
||||
path: /
|
||||
admin: user1
|
||||
is_public: yes
|
||||
post_install:
|
||||
- src: "templates/site_settings.yml.j2"
|
||||
dest: "/var/www/discourse/config/site_settings.yml"
|
||||
type: "config"
|
||||
|
||||
- src: "templates/configure_discourse.sh.j2"
|
||||
dest: "/tmp/configure_discourse.sh"
|
||||
type: "script"
|
||||
owner: root
|
||||
group: root
|
||||
```
|
||||
|
||||
- `ynh_apps` est la liste des applications à installer.
|
||||
- `label` permet de donner un nom personnalisé à l'application sur l'interface utilisateur.
|
||||
- `link` correspond au nom de l'application Yunohost qu'on veut installer.
|
||||
|
||||
#### Concernant les arguments
|
||||
|
||||
- `domain` est obligatoire. Il faut choisir un des domaines de son instance Yunohost.
|
||||
- `path` est obligatoire. Il faut choisir une URL pour accéder à son application comme `domain.tld/my_app`. Utilisez juste `/` si l'application doit s'installer sur un sous-domaine.
|
||||
- `is_public` est un argument qu'on retrouve souvent. Paramétré sur `yes`, l'application sera accessible à tout le monde, même sans authentification sur le portail SSO Yunohost. Paramétré sur `no`, l'application ne sera accessible qu'après authentification.
|
||||
|
||||
Pour les autres arguments, il faut se référer au `manifest.json` disponible dans le dépôt de l'application Yunohost qu'on installe. Vous pouvez en apprendre plus sur cette partie [ici](https://yunohost.org/fr/packaging_apps_manifest).
|
||||
|
||||
#### Concernant la post-installation
|
||||
|
||||
Il est possible de compléter l'installation des applications par l'ajout de templates jinja de configuration ou de scripts que vous aurez écrit de votre côté.
|
||||
Pour activer cette fonctionnalité, définissez la variable `post_install` qui correspond à la liste des fichiers de post-installation de votre application.
|
||||
Cette tâche utilisant le module template, vous pouvez tout à fait utiliser vos propres variables et les appeler dans vos fichiers de template. Pour en savoir sur ce module, cliquez [ici](https://docs.ansible.com/ansible/latest/collections/ansible/builtin/template_module.html).
|
||||
|
||||
- `src` est obligatoire. Il s'agit du répertoire où le fichier de template se situe sur la machine qui execute Ansible.
|
||||
- `dest` est obligatoire. Il s'agit du répertoire où le fichier de template va être stocké.
|
||||
- `type` est obligatoire :
|
||||
- Si vous précisez comme valeur `script` alors le fichier de template aura pour droits 740. Il sera exécuté après son transfert sur le serveur Yunohost (généralement dans `/tmp/`) puis il sera supprimé.
|
||||
- Si vous précisez comme valeur `config` alors le fichier de template aura pour droits 660. Il sera transféré sur le serveur Yunohost (généralement dans `/var/www/AppName/`) et vous pourrez l'importer avec un script shell à côté par exemple.
|
||||
|
||||
Pour `owner` et `group`, par défaut le fichier va prendre comme utilisateur propriétaire le nom de l'application et comme groupe propriétaire www-data (groupe NGINX). Vous pouvez les changer en précisant des valeurs différentes.
|
||||
|
||||
## Dépendances
|
||||
|
||||
Aucune.
|
||||
|
@ -131,6 +74,7 @@ Aucune.
|
|||
|
||||
roles:
|
||||
- ynh_setup
|
||||
- ynh_apps
|
||||
- ynh_config
|
||||
- ynh_backup
|
||||
```
|
||||
|
|
|
@ -53,63 +53,6 @@ ynh_users:
|
|||
|
||||
- `ynh_users` is the list of users to create. Each field is mandatory. Some Yunohost applications require that a user be the app administrator. He will then have the right to manage the application from the server administration interface. You can learn more about Yunohost user management [here](https://yunohost.org/en/users).
|
||||
|
||||
### App management
|
||||
|
||||
```yml
|
||||
# The list of Yunohost apps.
|
||||
ynh_apps:
|
||||
- label: WikiJS
|
||||
link: wikijs
|
||||
args:
|
||||
domain: wiki.domain.tld
|
||||
path: /
|
||||
admin: user1
|
||||
is_public: no
|
||||
- label: Discourse
|
||||
link: discourse
|
||||
args:
|
||||
domain: forum.domain.tld
|
||||
path: /
|
||||
admin: user1
|
||||
is_public: yes
|
||||
post_install:
|
||||
- src: "templates/site_settings.yml.j2"
|
||||
dest: "/var/www/discourse/config/site_settings.yml"
|
||||
type: "config"
|
||||
|
||||
- src: "templates/configure_discourse.sh.j2"
|
||||
dest: "/tmp/configure_discourse.sh"
|
||||
type: "script"
|
||||
owner: root
|
||||
group: root
|
||||
```
|
||||
|
||||
- `ynh_apps` is the list of applications to install.
|
||||
- `label` allows you to give a custom name to the application on the user interface.
|
||||
- `link` is the name of the Yunohost application to install.
|
||||
|
||||
#### About the arguments
|
||||
|
||||
- `domain` is essential. You have to choose one of the domains of your Yunohost instance.
|
||||
- `path` is required. You have to choose a URL to access your application like `domain.tld/my_app`. Just use `/` if the application is to be installed on a subdomain.
|
||||
- `is_public` argument is a common one. Set to `yes`, the application will be accessible to everyone, even without authentication to the Yunohost SSO portal. Set to `no`, the application will be accessible only after authentication.
|
||||
|
||||
For the other arguments, you have to refer to the `manifest.json` available in the repository of the Yunohost application you install. You can learn more about this part [here](https://yunohost.org/fr/packaging_apps_manifest).
|
||||
|
||||
#### About the post-installation
|
||||
|
||||
It is possible to complete the installation of applications by adding jinja template configuration files or scripts written by yourself.
|
||||
To enable this feature, define the `post_install` variable which corresponds to the list of post-installation files of your applications.
|
||||
Because this task uses the template module, you can use your own variables and call them in your template files. To know more about this module, click [here](https://docs.ansible.com/ansible/latest/collections/ansible/builtin/template_module.html).
|
||||
|
||||
- `src` is mandatory. This is the directory where the template file is located on the machine running Ansible.
|
||||
- `dest` is mandatory. This is the directory where the template file will be stored.
|
||||
- `type` is mandatory:
|
||||
- If you specify `script` as the value, then the template file will have 740 rights. It will be executed after it is transferred to the Yunohost server (usually in `/tmp/`) and then deleted.
|
||||
- If you specify `config` as the value, then the template file will have 660 rights. It will be transferred to the Yunohost server (usually in `/var/www/AppName/`) and after you could import it with a shell script on the side for example.
|
||||
|
||||
For `owner` and `group`, by default the file will take as owner the name of the application and as owner www-data(NGINX group). You can change them by specifying different values.
|
||||
|
||||
## Dependencies
|
||||
|
||||
None.
|
||||
|
@ -131,6 +74,7 @@ None.
|
|||
|
||||
roles:
|
||||
- ynh_setup
|
||||
- ynh_apps
|
||||
- ynh_config
|
||||
- ynh_backup
|
||||
```
|
||||
|
|
|
@ -35,17 +35,3 @@ ynh_users: null
|
|||
# firstname: Jane
|
||||
# lastname: Doe
|
||||
# mail_domain: domain.tld
|
||||
|
||||
# The list of Yunohost apps.
|
||||
ynh_apps: null
|
||||
# - label: Tiny Tiny RSS
|
||||
# link: ttrss
|
||||
# args:
|
||||
# domain: domain.tld
|
||||
# path: /ttrss
|
||||
# post_install:
|
||||
# - src: "templates/file.sh.j2"
|
||||
# dest: "/tmp/script.sh"
|
||||
# type: script
|
||||
# owner: ttrss # Only provide if different from app name
|
||||
# group: ttrss # Only provide if different from www-data
|
||||
|
|
Loading…
Reference in a new issue