From a2986c05ee590f31b4f33c2f457e4c5899a98cc5 Mon Sep 17 00:00:00 2001 From: Arthur BOUDREAULT <boudreaultarthur@ik.me> Date: Tue, 2 Nov 2021 10:22:54 +0100 Subject: [PATCH] bug: copy templates to server ok --- defaults/main.yml | 3 --- tasks/app.yml | 29 +++++++++++++++++------------ tasks/apps.yml | 16 +++++++++------- templates/file.sh.j2 | 3 --- templates/file.yml.j2 | 7 ------- 5 files changed, 26 insertions(+), 32 deletions(-) delete mode 100644 templates/file.sh.j2 delete mode 100644 templates/file.yml.j2 diff --git a/defaults/main.yml b/defaults/main.yml index 682633e..14b42ca 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -56,6 +56,3 @@ ynh_apps: null # args: # domain: domain.tld # path: /ttrss - -ynh_apps_postinstall: null - diff --git a/tasks/app.yml b/tasks/app.yml index a23bd1e..38694ff 100644 --- a/tasks/app.yml +++ b/tasks/app.yml @@ -20,20 +20,25 @@ # Installation part +- name: debug + debug: + msg: "Voici le résultat :{{ ynh_app }}" + tags: apps + - name: Install yunohost apps (you are inside app.yml) - ansible.builtin.command: yunohost app install {{ item.link }} \ - --label "{{ item.label }}" \ - --args "{% for key, value in item.args.items() %}{{ key }}={{ value }}{% if not loop.last %}&{% endif %}{% endfor %}" - when: item.label not in ynh_installed_apps.values() + ansible.builtin.command: yunohost app install {{ ynh_app.link }} \ + --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: apps -- name: Transfer template to node (can be a config file or a script) +- name: Transfer template to node (can be a config file or a script) #loop item.post-install ansible.builtin.template: - src: "{{ item.post_install.src }}" - dest: "{{ item.post_install.dest }}" - type: "{{ item.post_install.type }}" - owner: "{{ item.post_install.owner }}" - group: "{{ item.post_install.group }}" - mode: "{{ item.post_install.mode }}" - when: item.post_install is defined + src: "{{ item.src }}" + dest: "{{ item.dest }}" + owner: "{{ item.owner }}" + group: "{{ item.group }}" + mode: "{{ item.mode }}" + loop: "{{ ynh_app.post_install }}" + when: ynh_app.post_install is defined tags: apps diff --git a/tasks/apps.yml b/tasks/apps.yml index d4c0812..e156a91 100644 --- a/tasks/apps.yml +++ b/tasks/apps.yml @@ -31,15 +31,17 @@ - name: Install yunohost apps and perform post-install (you are inside apps.yml) ansible.builtin.include_tasks: app.yml loop: "{{ ynh_apps }}" - when: item.label not in ynh_installed_apps.values() + loop_control: + loop_var: ynh_app + when: ynh_app.label not in ynh_installed_apps.values() tags: apps -- name: debug (you are in apps.yml) - debug: - msg: "Voici le résultat :{{ item.post_install.0.src }}" - loop: "{{ ynh_apps.post_install.key }}" - when: ynh_apps.post_install is defined - tags: apps +# - name: debug (you are in apps.yml) +# debug: +# msg: "Voici le résultat :{{ item.post_install.0.src }}" +# loop: "{{ ynh_apps.post_install.key }}" +# when: ynh_apps.post_install is defined +# tags: apps ## post-install: # boucler sur les apps et inclure ce fichier de tasks diff --git a/templates/file.sh.j2 b/templates/file.sh.j2 deleted file mode 100644 index 4f0467b..0000000 --- a/templates/file.sh.j2 +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash - -touch toto_{{ ynh_main_domain }}.txt diff --git a/templates/file.yml.j2 b/templates/file.yml.j2 deleted file mode 100644 index 16c03e2..0000000 --- a/templates/file.yml.j2 +++ /dev/null @@ -1,7 +0,0 @@ ---- -title: {{ ynh_discourse_settings.title }} -site_description: {{ ynh_discourse_settings.site_description }} -contact_email: {{ ynh_discourse_settings.contact_email }} -invite_only: {{ ynh_discourse_settings.invite_only }} -backup_frequency: {{ ynh_discourse_settings.backup_frequency }} -maximum_backups: {{ ynh_discourse_settings.maximum_backups }} -- GitLab