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
Commit e6cbbbda authored by Arthur BOUDREAULT's avatar Arthur BOUDREAULT
Browse files

refactor: restructuring role into collection #6

parent 65541ed1
No related branches found
No related tags found
No related merge requests found
Pipeline #3696 failed
Showing
with 141 additions and 21 deletions
......@@ -13,20 +13,35 @@
[🇬🇧 English version](README.md)
Cette collection vise à installer, configurer et sauvegarder [Yunohost](https://yunohost.org/#/).
Comme il s'agit d'une collection indépendante, elle peut être publiée selon sa propre cadence de publication.
Comme il s'agit d'une collection indépendante, elle peut être publiée selon sa propre cadence de publication. De plus, les rôles qu'elle contient sont mis à jour indépendamment.
## Prérequis
Votre serveur doit être basé sur du Debian Buster.
Votre serveur doit être basé sur du Debian Buster et Yunohost ne doit pas déjà être installé.
## Contenu de la collection
### Rôles
- `lydra.yunohost.ynh_setup` : Ce rôle prépare les serveurs à base de Debian-Buster à exécuter Yunohost.
- `lydra.yunohost.ynh_config` : Ce rôle gère la configuration et le démarrage des différents services de Yunohost (relais SMTP, mises à jour automatiques).
- `lydra.yunohost.ynh_setup` : Ce rôle prépare les serveurs à base de Debian-Buster à exécuter Yunohost. Il configure Yunohost avec ses paramètres initiaux et les domaines, utilisateurs et applications de votre choix.
- `lydra.yunohost.ynh_config` : Ce rôle gère la configuration de différents services de Yunohost (relais SMTP, mises à jour automatiques).
- `lydra.yunohost.ynh_backup` : Ce rôle gère la configuration des sauvegardes.
### lydra.yunohost Tags du rôle
Ces tags sont applicables suivant les rôles.
|tags|commentaires|
|----|-------|
|yunohost|Tâches spécifiques à Yunohost.|
|users|Tâches spécifiques aux utilisateurs de Yunohost.|
|domains|Tâches spécifiques aux domaines liés à Yunohost.|
|apps|Tâches spécifiques aux applications de Yunohost.|
|update|Tâches liées aux paramètres de mise à jour de Yunohost.|
|smtp|Tâches liées aux paramètres de relais smtp de Yunohost.|
|backup|Tâches liées aux sauvegardes de Yunohost.|
|pkg|Tâches d'installation de paquets.|
## License
[![ansible-yunohost Copyright 2021 Lydra](https://www.gnu.org/graphics/gplv3-with-text-136x68.png)](https://choosealicense.com/licenses/gpl-3.0/)
......
......@@ -13,19 +13,34 @@
[🇫🇷 French version](README-FR.md)
This collection aims at installing, configuring and backing up [Yunohost](https://yunohost.org/#/).
As this is an independent collection, it can be released on its own release cadence.
As this is an independent collection, it can be released on its own release cadence. Moreover, the roles it contains are updated independently.
# Prerequisites
Your server must be Debian-Buster based.
Your server must be Debian-Buster based and Yunohost shouldn't be already installed.
## Collection contents
### Roles
- `lydra.yunohost.ynh_setup` : This role prepares servers with Debian-Buster-based to run Yunohost.
- `lydra.yunohost.ynh_config` : This role manages configuring and starting various Yunohost services (SMTP relay, auto updates).
- `lydra.yunohost.ynh_backup` : This role manages configuring of backups.
- `lydra.yunohost.ynh_setup` : This role prepares servers with Debian-Buster-based to run Yunohost. It sets up Yunohost with its initial settings and domains, users and apps of your choice.
- `lydra.yunohost.ynh_config` : This role configures various Yunohost services (SMTP relay, auto updates).
- `lydra.yunohost.ynh_backup` : This role manages the configuration of backups.
## lydra.yunohost Role Tags
These tags are applicable to roles.
|tags|comment|
|----|-------|
|yunohost|Tasks specific to Yunohost.|
|users|Tasks specific to users in Yunohost.|
|domains|Tasks specific to domains linked to Yunohost.|
|apps|Tasks specific to Yunohost apps.|
|update|Tasks related to Yunohost update settings.|
|smtp|Tasks related to Yunohost smtp relay settings.|
|backup|Tasks related to Yunohost backups.|
|pkg|Tasks that install packages.|
## License
......
......@@ -56,17 +56,13 @@ Aucune.
```yml
---
- name: Install Yunohost on Debian Server
- name: Configure Yunohost backups
hosts: all
become: True
pre_tasks:
- name: Update all packages and index
ansible.builtin.apt:
upgrade: dist
update_cache: yes
roles:
collections:
- lydra.yunohost
roles:
- ynh_backup
```
## License
......
......@@ -59,6 +59,8 @@ None.
- name: Install Yunohost on Debian Server
hosts: all
become: True
collections:
- lydra.yunohost
pre_tasks:
- name: Update all packages and index
ansible.builtin.apt:
......@@ -66,7 +68,7 @@ None.
update_cache: yes
roles:
- ansible-yunohost
- ynh_backup
```
## License
......
......@@ -23,6 +23,8 @@
path: "{{ ynh_backup.directory | default('/home/yunohost.backup/archives') }}"
state: directory
mode: '0750'
tags:
- "backup"
- name: Create backup script
ansible.builtin.template:
......@@ -31,6 +33,9 @@
owner: root
group: root
mode: '0740'
tags:
- "backup"
- "cron"
- name: Create cron task to perform YNH backup
ansible.builtin.cron:
......@@ -42,3 +47,6 @@
user: root
job: "{{ ynh_backup.dest_script | default('/usr/local/bin/') }}ynh_backup.sh"
cron_file: ynh_backup_cron
tags:
- "backup"
- "cron"
......@@ -21,3 +21,5 @@
- name: Enable Yunohost apps backup
ansible.builtin.include_tasks: backup.yml
when: ynh_backup.scheduled
tags:
- "backup"
......@@ -68,9 +68,11 @@ Aucune.
```yml
---
- name: Configure Yunohost on Debian Server
- name: Install Yunohost on Debian Server
hosts: all
become: True
collections:
- lydra.yunohost
pre_tasks:
- name: Update all packages and index
ansible.builtin.apt:
......@@ -78,7 +80,7 @@ Aucune.
update_cache: yes
roles:
- lydra.yunohost
- ynh_config
```
## License
......
......@@ -71,6 +71,8 @@ None.
- name: Install Yunohost on Debian Server
hosts: all
become: True
collections:
- lydra.yunohost
pre_tasks:
- name: Update all packages and index
ansible.builtin.apt:
......@@ -78,7 +80,7 @@ None.
update_cache: yes
roles:
- ansible-yunohost
- ynh_config
```
## License
......
......@@ -25,6 +25,9 @@
owner: root
group: root
mode: '0740'
tags:
- "update"
- "cron"
- name: Creates cron task under /etc/cron.d to auto-update Yunohost
ansible.builtin.cron:
......@@ -34,3 +37,6 @@
user: root
job: "{{ ynh_autoupdate.dest_script | default('/usr/local/bin/') }}ynh_autoupdate.sh"
cron_file: ynh_autoupdate_cron
tags:
- "update"
- "cron"
......@@ -22,7 +22,11 @@
ansible.builtin.include_tasks: smtp_relay.yml
loop: "{{ ynh_smtp_relay | dict2items }}"
when: item.value
tags:
- "smtp"
- name: Configures Yunohost autoupdate
ansible.builtin.include_tasks: autoupdate.yml
when: ynh_autoupdate.scheduled
tags:
- "update"
......@@ -23,8 +23,12 @@
"yunohost settings get smtp.relay.{{ item.key }}"
register: _ynh_smtp_current_values
changed_when: False
tags:
- "smtp"
- 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
tags:
- "smtp"
......@@ -141,6 +141,8 @@ Aucune.
roles:
- ynh_setup
- ynh_config
- ynh_backup
```
## License
......
......@@ -141,6 +141,8 @@ None.
roles:
- ynh_setup
- ynh_config
- ynh_backup
```
## License
......
......@@ -24,6 +24,9 @@
--label "{{ ynh_app.label }}" \
--args "{% for key, value in ynh_app.args.items() %}{{ key }}={{ value }}{% if not loop.last %}&{% endif %}{% endfor %}"
changed_when: False
tags:
- "yunohost"
- "apps"
# Post-installation part
- name: Create post-install template
......@@ -35,6 +38,8 @@
mode: "{{ (item.type == 'script') | ternary('740', '660') }}"
loop: "{{ ynh_app.post_install|default([]) }}"
when: ynh_app.post_install
tags:
- "apps"
- name: Launch post-install script
ansible.builtin.command: "{{ ynh_app_post_install.dest }}"
......@@ -44,6 +49,8 @@
loop_control:
loop_var: ynh_app_post_install
when: ynh_app_post_install.type == "script"
tags:
- "apps"
- name: Remove script after execution
ansible.builtin.file:
......@@ -53,3 +60,5 @@
loop_control:
loop_var: ynh_app_post_install
when: ynh_app_post_install.type == "script"
tags:
- "apps"
......@@ -22,9 +22,15 @@
ansible.builtin.command: yunohost app map --output-as json
register: ynh_installed_apps_raw
changed_when: False
tags:
- "yunohost"
- "apps"
- name: Format json of apps
ansible.builtin.set_fact: ynh_installed_apps="{{ ynh_installed_apps_raw.stdout | from_json }}"
tags:
- "yunohost"
- "apps"
- name: Install yunohost apps and perform post-install
ansible.builtin.include_tasks: app.yml
......@@ -32,4 +38,7 @@
loop_control:
loop_var: ynh_app
when: ynh_app.label not in ynh_installed_apps.values()
tags:
- "yunohost"
- "apps"
......@@ -22,11 +22,20 @@
ansible.builtin.command: yunohost domain list --output-as json
register: ynh_installed_domains_raw
changed_when: False
tags:
- "yunohost"
- "domains"
- name: Format json of domains
ansible.builtin.set_fact: ynh_installed_domains="{{ ynh_installed_domains_raw.stdout | from_json }}"
tags:
- "yunohost"
- "domains"
- name: Create domains
ansible.builtin.command: yunohost domain add {{ item }}
with_items: "{{ ynh_extra_domains }}"
when: item not in ynh_installed_domains.domains
tags:
- "yunohost"
- "domains"
......@@ -24,10 +24,14 @@
- git
- dialog
state: present
tags:
- "pkg"
- name: Test if Yunohost is already installed
ansible.builtin.stat: path=/etc/yunohost/installed
register: ynh_file_install
tags:
- "yunohost"
- name: Download Yunohost install script
ansible.builtin.get_url:
......@@ -35,10 +39,14 @@
dest: /tmp/install_yunohost.sh
mode: 700
when: not ynh_file_install.stat.exists
tags:
- "yunohost"
- name: Launch Yunohost install script
ansible.builtin.command: /tmp/install_yunohost.sh -a
when: not ynh_file_install.stat.exists
tags:
- "yunohost"
- name: Launch Yunohost postinstall
ansible.builtin.command:
......@@ -47,23 +55,39 @@
--password "{{ ynh_admin_password }}" \
{% if ynh_ignore_dyndns_server %} --ignore-dyndns {% endif %}
when: not ynh_file_install.stat.exists
tags:
- "yunohost"
- "domains"
- name: Create extra domains
ansible.builtin.include_tasks: domains.yml
when: ynh_extra_domains
tags:
- "yunohost"
- "domains"
- name: Run first Yunohost diagnosis
ansible.builtin.command: yunohost diagnosis run
when: not ynh_file_install.stat.exists
tags:
- "yunohost"
- name: Install domain certificates
ansible.builtin.command: yunohost domain cert-install
changed_when: False
tags:
- "yunohost"
- name: Add Yunohost users
ansible.builtin.include_tasks: users.yml
when: ynh_users
tags:
- "yunohost"
- "users"
- name: Install Yunohost apps
ansible.builtin.include_tasks: apps.yml
when: ynh_apps
tags:
- "yunohost"
- "apps"
......@@ -22,9 +22,15 @@
ansible.builtin.command: yunohost user list --output-as json
register: ynh_registered_users_raw
changed_when: False
tags:
- "yunohost"
- "users"
- name: Format json of users
ansible.builtin.set_fact: ynh_registered_users="{{ ynh_registered_users_raw.stdout | from_json }}"
tags:
- "yunohost"
- "users"
- name: Create missing Yunohost users
ansible.builtin.command:
......@@ -35,3 +41,6 @@
-p "{{ item.pass }}"
loop: "{{ ynh_users }}"
when: item.name not in ynh_registered_users.users.keys()
tags:
- "yunohost"
- "users"
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment