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 335cb75c 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 #3716 failed
# 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. ...@@ -56,17 +56,11 @@ None.
```yml ```yml
--- ---
- name: Install Yunohost on Debian Server - name: Configure Yunohost backups
hosts: all hosts: all
become: True become: True
collections: collections:
- lydra.yunohost - lydra.yunohost
pre_tasks:
- name: Update all packages and index
ansible.builtin.apt:
upgrade: dist
update_cache: yes
roles: roles:
- ynh_backup - ynh_backup
``` ```
......
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
path: "{{ ynh_backup.directory | default('/home/yunohost.backup/archives') }}" path: "{{ ynh_backup.directory | default('/home/yunohost.backup/archives') }}"
state: directory state: directory
mode: '0750' mode: '0750'
tags: tags:
- "backup" - "backup"
- name: Create backup script - name: Create backup script
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
owner: root owner: root
group: root group: root
mode: '0740' mode: '0740'
tags: tags:
- "backup" - "backup"
- "cron" - "cron"
...@@ -47,6 +47,6 @@ ...@@ -47,6 +47,6 @@
user: root user: root
job: "{{ ynh_backup.dest_script | default('/usr/local/bin/') }}ynh_backup.sh" job: "{{ ynh_backup.dest_script | default('/usr/local/bin/') }}ynh_backup.sh"
cron_file: ynh_backup_cron cron_file: ynh_backup_cron
tags: tags:
- "backup" - "backup"
- "cron" - "cron"
...@@ -21,5 +21,5 @@ ...@@ -21,5 +21,5 @@
- name: Enable Yunohost apps backup - name: Enable Yunohost apps backup
ansible.builtin.include_tasks: backup.yml ansible.builtin.include_tasks: backup.yml
when: ynh_backup.scheduled when: ynh_backup.scheduled
tags: tags:
- "backup" - "backup"
...@@ -68,17 +68,11 @@ Aucune. ...@@ -68,17 +68,11 @@ Aucune.
```yml ```yml
--- ---
- name: Install Yunohost on Debian Server - name: Configure Yunohost on Debian Server
hosts: all hosts: all
become: True become: True
collections: collections:
- lydra.yunohost - lydra.yunohost
pre_tasks:
- name: Update all packages and index
ansible.builtin.apt:
upgrade: dist
update_cache: yes
roles: roles:
- ynh_config - ynh_config
``` ```
......
...@@ -56,7 +56,7 @@ A cron job can been set up to automate the check for system and application upda ...@@ -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.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`. - `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). 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. ...@@ -68,17 +68,11 @@ None.
```yml ```yml
--- ---
- name: Install Yunohost on Debian Server - name: Configure Yunohost on Debian Server
hosts: all hosts: all
become: True become: True
collections: collections:
- lydra.yunohost - lydra.yunohost
pre_tasks:
- name: Update all packages and index
ansible.builtin.apt:
upgrade: dist
update_cache: yes
roles: roles:
- ynh_config - ynh_config
``` ```
......
...@@ -28,5 +28,5 @@ ...@@ -28,5 +28,5 @@
- name: Configures Yunohost autoupdate - name: Configures Yunohost autoupdate
ansible.builtin.include_tasks: autoupdate.yml ansible.builtin.include_tasks: autoupdate.yml
when: ynh_autoupdate.scheduled when: ynh_autoupdate.scheduled
tags: tags:
- "update" - "update"
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
--label "{{ ynh_app.label }}" \ --label "{{ ynh_app.label }}" \
--args "{% for key, value in ynh_app.args.items() %}{{ key }}={{ value }}{% if not loop.last %}&{% endif %}{% endfor %}" --args "{% for key, value in ynh_app.args.items() %}{{ key }}={{ value }}{% if not loop.last %}&{% endif %}{% endfor %}"
changed_when: False changed_when: False
tags: tags:
- "yunohost" - "yunohost"
- "apps" - "apps"
...@@ -38,7 +38,7 @@ ...@@ -38,7 +38,7 @@
mode: "{{ (item.type == 'script') | ternary('740', '660') }}" mode: "{{ (item.type == 'script') | ternary('740', '660') }}"
loop: "{{ ynh_app.post_install|default([]) }}" loop: "{{ ynh_app.post_install|default([]) }}"
when: ynh_app.post_install when: ynh_app.post_install
tags: tags:
- "apps" - "apps"
- name: Launch post-install script - name: Launch post-install script
...@@ -49,7 +49,7 @@ ...@@ -49,7 +49,7 @@
loop_control: loop_control:
loop_var: ynh_app_post_install loop_var: ynh_app_post_install
when: ynh_app_post_install.type == "script" when: ynh_app_post_install.type == "script"
tags: tags:
- "apps" - "apps"
- name: Remove script after execution - name: Remove script after execution
...@@ -60,5 +60,5 @@ ...@@ -60,5 +60,5 @@
loop_control: loop_control:
loop_var: ynh_app_post_install loop_var: ynh_app_post_install
when: ynh_app_post_install.type == "script" when: ynh_app_post_install.type == "script"
tags: tags:
- "apps" - "apps"
...@@ -22,13 +22,13 @@ ...@@ -22,13 +22,13 @@
ansible.builtin.command: yunohost app map --output-as json ansible.builtin.command: yunohost app map --output-as json
register: ynh_installed_apps_raw register: ynh_installed_apps_raw
changed_when: False changed_when: False
tags: tags:
- "yunohost" - "yunohost"
- "apps" - "apps"
- name: Format json of apps - name: Format json of apps
ansible.builtin.set_fact: ynh_installed_apps="{{ ynh_installed_apps_raw.stdout | from_json }}" ansible.builtin.set_fact: ynh_installed_apps="{{ ynh_installed_apps_raw.stdout | from_json }}"
tags: tags:
- "yunohost" - "yunohost"
- "apps" - "apps"
...@@ -38,7 +38,7 @@ ...@@ -38,7 +38,7 @@
loop_control: loop_control:
loop_var: ynh_app loop_var: ynh_app
when: ynh_app.label not in ynh_installed_apps.values() when: ynh_app.label not in ynh_installed_apps.values()
tags: tags:
- "yunohost" - "yunohost"
- "apps" - "apps"
...@@ -22,13 +22,13 @@ ...@@ -22,13 +22,13 @@
ansible.builtin.command: yunohost domain list --output-as json ansible.builtin.command: yunohost domain list --output-as json
register: ynh_installed_domains_raw register: ynh_installed_domains_raw
changed_when: False changed_when: False
tags: tags:
- "yunohost" - "yunohost"
- "domains" - "domains"
- name: Format json of domains - name: Format json of domains
ansible.builtin.set_fact: ynh_installed_domains="{{ ynh_installed_domains_raw.stdout | from_json }}" ansible.builtin.set_fact: ynh_installed_domains="{{ ynh_installed_domains_raw.stdout | from_json }}"
tags: tags:
- "yunohost" - "yunohost"
- "domains" - "domains"
...@@ -36,6 +36,6 @@ ...@@ -36,6 +36,6 @@
ansible.builtin.command: yunohost domain add {{ item }} ansible.builtin.command: yunohost domain add {{ item }}
with_items: "{{ ynh_extra_domains }}" with_items: "{{ ynh_extra_domains }}"
when: item not in ynh_installed_domains.domains when: item not in ynh_installed_domains.domains
tags: tags:
- "yunohost" - "yunohost"
- "domains" - "domains"
...@@ -24,13 +24,13 @@ ...@@ -24,13 +24,13 @@
- git - git
- dialog - dialog
state: present state: present
tags: tags:
- "pkg" - "pkg"
- name: Test if Yunohost is already installed - name: Test if Yunohost is already installed
ansible.builtin.stat: path=/etc/yunohost/installed ansible.builtin.stat: path=/etc/yunohost/installed
register: ynh_file_install register: ynh_file_install
tags: tags:
- "yunohost" - "yunohost"
- name: Download Yunohost install script - name: Download Yunohost install script
...@@ -39,13 +39,13 @@ ...@@ -39,13 +39,13 @@
dest: /tmp/install_yunohost.sh dest: /tmp/install_yunohost.sh
mode: 700 mode: 700
when: not ynh_file_install.stat.exists when: not ynh_file_install.stat.exists
tags: tags:
- "yunohost" - "yunohost"
- name: Launch Yunohost install script - name: Launch Yunohost install script
ansible.builtin.command: /tmp/install_yunohost.sh -a ansible.builtin.command: /tmp/install_yunohost.sh -a
when: not ynh_file_install.stat.exists when: not ynh_file_install.stat.exists
tags: tags:
- "yunohost" - "yunohost"
- name: Launch Yunohost postinstall - name: Launch Yunohost postinstall
...@@ -55,39 +55,39 @@ ...@@ -55,39 +55,39 @@
--password "{{ ynh_admin_password }}" \ --password "{{ ynh_admin_password }}" \
{% if ynh_ignore_dyndns_server %} --ignore-dyndns {% endif %} {% if ynh_ignore_dyndns_server %} --ignore-dyndns {% endif %}
when: not ynh_file_install.stat.exists when: not ynh_file_install.stat.exists
tags: tags:
- "yunohost" - "yunohost"
- "domains" - "domains"
- name: Create extra domains - name: Create extra domains
ansible.builtin.include_tasks: domains.yml ansible.builtin.include_tasks: domains.yml
when: ynh_extra_domains when: ynh_extra_domains
tags: tags:
- "yunohost" - "yunohost"
- "domains" - "domains"
- name: Run first Yunohost diagnosis - name: Run first Yunohost diagnosis
ansible.builtin.command: yunohost diagnosis run ansible.builtin.command: yunohost diagnosis run
when: not ynh_file_install.stat.exists when: not ynh_file_install.stat.exists
tags: tags:
- "yunohost" - "yunohost"
- name: Install domain certificates - name: Install domain certificates
ansible.builtin.command: yunohost domain cert-install ansible.builtin.command: yunohost domain cert-install
changed_when: False changed_when: False
tags: tags:
- "yunohost" - "yunohost"
- name: Add Yunohost users - name: Add Yunohost users
ansible.builtin.include_tasks: users.yml ansible.builtin.include_tasks: users.yml
when: ynh_users when: ynh_users
tags: tags:
- "yunohost" - "yunohost"
- "users" - "users"
- name: Install Yunohost apps - name: Install Yunohost apps
ansible.builtin.include_tasks: apps.yml ansible.builtin.include_tasks: apps.yml
when: ynh_apps when: ynh_apps
tags: tags:
- "yunohost" - "yunohost"
- "apps" - "apps"
...@@ -22,13 +22,13 @@ ...@@ -22,13 +22,13 @@
ansible.builtin.command: yunohost user list --output-as json ansible.builtin.command: yunohost user list --output-as json
register: ynh_registered_users_raw register: ynh_registered_users_raw
changed_when: False changed_when: False
tags: tags:
- "yunohost" - "yunohost"
- "users" - "users"
- name: Format json of users - name: Format json of users
ansible.builtin.set_fact: ynh_registered_users="{{ ynh_registered_users_raw.stdout | from_json }}" ansible.builtin.set_fact: ynh_registered_users="{{ ynh_registered_users_raw.stdout | from_json }}"
tags: tags:
- "yunohost" - "yunohost"
- "users" - "users"
...@@ -41,6 +41,6 @@ ...@@ -41,6 +41,6 @@
-p "{{ item.pass }}" -p "{{ item.pass }}"
loop: "{{ ynh_users }}" loop: "{{ ynh_users }}"
when: item.name not in ynh_registered_users.users.keys() when: item.name not in ynh_registered_users.users.keys()
tags: tags:
- "yunohost" - "yunohost"
- "users" - "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