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

refactor: restructuring role into collection #7

parent e6cbbbda
No related branches found
No related tags found
No related merge requests found
Pipeline #3717 passed with warnings
This commit is part of merge request !24. Comments created here will be created in the context of that merge request.
# Collections Plugins Directory
This directory can be used to ship various plugins inside an Ansible collection. Each plugin is placed in a folder that
is named after the type of plugin it is in. It can also include the `module_utils` and `modules` directory that
would contain module utils and modules respectively.
Here is an example directory of the majority of plugins currently supported by Ansible:
```
└── plugins
├── action
├── become
├── cache
├── callback
├── cliconf
├── connection
├── filter
├── httpapi
├── inventory
├── lookup
├── module_utils
├── modules
├── netconf
├── shell
├── strategy
├── terminal
├── test
└── vars
```
A full list of plugin types can be found at [Working With Plugins](https://docs.ansible.com/ansible/2.10/plugins/plugins.html).
......@@ -56,17 +56,11 @@ None.
```yml
---
- name: Install Yunohost on Debian Server
- name: Configure Yunohost backups
hosts: all
become: True
collections:
- lydra.yunohost
pre_tasks:
- name: Update all packages and index
ansible.builtin.apt:
upgrade: dist
update_cache: yes
roles:
- ynh_backup
```
......
......@@ -23,7 +23,7 @@
path: "{{ ynh_backup.directory | default('/home/yunohost.backup/archives') }}"
state: directory
mode: '0750'
tags:
tags:
- "backup"
- name: Create backup script
......@@ -33,7 +33,7 @@
owner: root
group: root
mode: '0740'
tags:
tags:
- "backup"
- "cron"
......@@ -47,6 +47,6 @@
user: root
job: "{{ ynh_backup.dest_script | default('/usr/local/bin/') }}ynh_backup.sh"
cron_file: ynh_backup_cron
tags:
tags:
- "backup"
- "cron"
......@@ -21,5 +21,5 @@
- name: Enable Yunohost apps backup
ansible.builtin.include_tasks: backup.yml
when: ynh_backup.scheduled
tags:
tags:
- "backup"
......@@ -68,17 +68,11 @@ Aucune.
```yml
---
- name: Install Yunohost on Debian Server
- name: Configure Yunohost on Debian Server
hosts: all
become: True
collections:
- lydra.yunohost
pre_tasks:
- name: Update all packages and index
ansible.builtin.apt:
upgrade: dist
update_cache: yes
roles:
- ynh_config
```
......
......@@ -56,7 +56,7 @@ A cron job can been set up to automate the check for system and application upda
- `ynh_autoupdate.system`: is mandatory. Enables 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.
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.
To learn more about how updates work in Yunohost you can go [here](https://yunohost.org/fr/update). The changelog of Yunohost versions is also available [here](https://forum.yunohost.org/tag/ynh_release).
......@@ -68,17 +68,11 @@ None.
```yml
---
- name: Install Yunohost on Debian Server
- name: Configure Yunohost on Debian Server
hosts: all
become: True
collections:
- lydra.yunohost
pre_tasks:
- name: Update all packages and index
ansible.builtin.apt:
upgrade: dist
update_cache: yes
roles:
- ynh_config
```
......
......@@ -25,7 +25,7 @@
owner: root
group: root
mode: '0740'
tags:
tags:
- "update"
- "cron"
......@@ -37,6 +37,6 @@
user: root
job: "{{ ynh_autoupdate.dest_script | default('/usr/local/bin/') }}ynh_autoupdate.sh"
cron_file: ynh_autoupdate_cron
tags:
tags:
- "update"
- "cron"
......@@ -28,5 +28,5 @@
- name: Configures Yunohost autoupdate
ansible.builtin.include_tasks: autoupdate.yml
when: ynh_autoupdate.scheduled
tags:
tags:
- "update"
......@@ -24,7 +24,7 @@
--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:
tags:
- "yunohost"
- "apps"
......@@ -38,7 +38,7 @@
mode: "{{ (item.type == 'script') | ternary('740', '660') }}"
loop: "{{ ynh_app.post_install|default([]) }}"
when: ynh_app.post_install
tags:
tags:
- "apps"
- name: Launch post-install script
......@@ -49,7 +49,7 @@
loop_control:
loop_var: ynh_app_post_install
when: ynh_app_post_install.type == "script"
tags:
tags:
- "apps"
- name: Remove script after execution
......@@ -60,5 +60,5 @@
loop_control:
loop_var: ynh_app_post_install
when: ynh_app_post_install.type == "script"
tags:
tags:
- "apps"
......@@ -22,13 +22,13 @@
ansible.builtin.command: yunohost app map --output-as json
register: ynh_installed_apps_raw
changed_when: False
tags:
tags:
- "yunohost"
- "apps"
- name: Format json of apps
ansible.builtin.set_fact: ynh_installed_apps="{{ ynh_installed_apps_raw.stdout | from_json }}"
tags:
tags:
- "yunohost"
- "apps"
......@@ -38,7 +38,7 @@
loop_control:
loop_var: ynh_app
when: ynh_app.label not in ynh_installed_apps.values()
tags:
tags:
- "yunohost"
- "apps"
......@@ -22,13 +22,13 @@
ansible.builtin.command: yunohost domain list --output-as json
register: ynh_installed_domains_raw
changed_when: False
tags:
tags:
- "yunohost"
- "domains"
- name: Format json of domains
ansible.builtin.set_fact: ynh_installed_domains="{{ ynh_installed_domains_raw.stdout | from_json }}"
tags:
tags:
- "yunohost"
- "domains"
......@@ -36,6 +36,6 @@
ansible.builtin.command: yunohost domain add {{ item }}
with_items: "{{ ynh_extra_domains }}"
when: item not in ynh_installed_domains.domains
tags:
tags:
- "yunohost"
- "domains"
......@@ -24,13 +24,13 @@
- git
- dialog
state: present
tags:
tags:
- "pkg"
- name: Test if Yunohost is already installed
ansible.builtin.stat: path=/etc/yunohost/installed
register: ynh_file_install
tags:
tags:
- "yunohost"
- name: Download Yunohost install script
......@@ -39,13 +39,13 @@
dest: /tmp/install_yunohost.sh
mode: 700
when: not ynh_file_install.stat.exists
tags:
tags:
- "yunohost"
- name: Launch Yunohost install script
ansible.builtin.command: /tmp/install_yunohost.sh -a
when: not ynh_file_install.stat.exists
tags:
tags:
- "yunohost"
- name: Launch Yunohost postinstall
......@@ -55,39 +55,39 @@
--password "{{ ynh_admin_password }}" \
{% if ynh_ignore_dyndns_server %} --ignore-dyndns {% endif %}
when: not ynh_file_install.stat.exists
tags:
tags:
- "yunohost"
- "domains"
- name: Create extra domains
ansible.builtin.include_tasks: domains.yml
when: ynh_extra_domains
tags:
tags:
- "yunohost"
- "domains"
- name: Run first Yunohost diagnosis
ansible.builtin.command: yunohost diagnosis run
when: not ynh_file_install.stat.exists
tags:
tags:
- "yunohost"
- name: Install domain certificates
ansible.builtin.command: yunohost domain cert-install
changed_when: False
tags:
tags:
- "yunohost"
- name: Add Yunohost users
ansible.builtin.include_tasks: users.yml
when: ynh_users
tags:
tags:
- "yunohost"
- "users"
- name: Install Yunohost apps
ansible.builtin.include_tasks: apps.yml
when: ynh_apps
tags:
tags:
- "yunohost"
- "apps"
......@@ -22,13 +22,13 @@
ansible.builtin.command: yunohost user list --output-as json
register: ynh_registered_users_raw
changed_when: False
tags:
tags:
- "yunohost"
- "users"
- name: Format json of users
ansible.builtin.set_fact: ynh_registered_users="{{ ynh_registered_users_raw.stdout | from_json }}"
tags:
tags:
- "yunohost"
- "users"
......@@ -41,6 +41,6 @@
-p "{{ item.pass }}"
loop: "{{ ynh_users }}"
when: item.name not in ynh_registered_users.users.keys()
tags:
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