Pour tout problème contactez-nous par mail : support@froggit.fr | La FAQ :grey_question: | Rejoignez-nous sur le Chat :speech_balloon:

Skip to content
Snippets Groups Projects
Name Last commit Last update
..
defaults
meta
tasks
templates
README-FR.md
README.md

Ansible Role: Yunohost Apps

🇫🇷 French version

Install Yunohost apps with Ansible! You can find the list of available Yunohost applications here.

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

# 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.

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.

  • 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.

Docker container management

By default, YunoHost applications are pre-packaged by community members. We decided to go further, by simply adding the ability to deploy Docker containers using Docker Compose and integrate them into the YunoHost application panel.

Step 1: Install and launch Docker containers

enable_ynh_docker: true
geerlingguy_docker_version: 5.2.1
docker_compose_src_template: templates/compose.yml.j2
docker_compose_dest_template: /tmp/compose.yml
docker_compose_version: 3.9
docker_compose_apps:
  - name: app1
    image: "recordsansible/ara-api:latest"
    ports:
      - "8000:8000"
    volumes:
      - "/home/{{ ynh_admin }}/.ara/server:/opt/ara"
    environment: null
  • enable_ynh_docker: Enables / disables the feature to install and launch Docker Compose services.
  • geerlingguy_docker_version: Allows you to specify the version of the Ansible Docker role you wish to use. The default version of the role is 5.2.1, but you can check the role versions here.
  • docker_compose_src_template: Path where the Docker Compose template file is located. By default a template file is provided by us but you can also provide your custom Docker Compose file.
  • docker_compose_dest_template`: Path where the Docker Compose file will be on the remote machine.
  • docker_compose_version`: Version of Docker Compose used for the file.
  • docker_compose_apps`: Dictionaries of one or more Docker Compose services. In each dictionary you will be able to define: name (required), image (required), ports (optional), volumes (optional) and environment (optional, environment variables). If you don't define one of the optional keys, you will have to leave the value blank or set it to "null". Removing a key from the dictionary will make Ansible make an error.

Step 2: Installing Yunohost redirect applications

If you want to integrate containerized applications with the YunoHost UI or easily manage a redirect using Nginx, there is the YunoHost redirect application.

ynh_apps:
  - label: "ara application redirect"
      link: "redirect"
      args:
        domain: "ara.example.com"
        path: "/"
        redirect_path: "http://0.0.0.0:8000"
        redirect_type: "public_proxy"

In the example above. We will redirect the application available on port 8000 of the machine to be exposed on the internet from the url "ara.example.com".

Dependencies

None.

Example Playbook

---
- name: Install Yunohost apps
  hosts: all
  become: True

  roles:
    - lydra.yunohost.ynh_apps

License

ansible-yunohost Copyright 2021 Lydra

ansible-yunohost is maintained by Lydra and released under the GPL3 license.