From cd6358514d0cab3e660aa916a7b6f5420888c0ac Mon Sep 17 00:00:00 2001 From: A Holt Date: Thu, 28 Jul 2022 16:55:16 -0400 Subject: [PATCH] Modernize matomo/tasks/main.yml for skip_role_on_error #3255 --- roles/matomo/tasks/main.yml | 52 +++++++++++++++++++++---------------- 1 file changed, 29 insertions(+), 23 deletions(-) diff --git a/roles/matomo/tasks/main.yml b/roles/matomo/tasks/main.yml index 7453b4821..eec80e81a 100644 --- a/roles/matomo/tasks/main.yml +++ b/roles/matomo/tasks/main.yml @@ -19,31 +19,37 @@ quiet: yes -- name: Enable/Disable/Reload NGINX for OSM, if nginx_enabled - include_tasks: nginx.yml +- block: + - name: Enable/Disable/Reload NGINX for OSM, if nginx_enabled + include_tasks: nginx.yml -- name: Install Matomo if 'matomo_installed' not defined, e.g. in {{ iiab_state_file }} # /etc/iiab/iiab_state.yml - include_tasks: install.yml - when: matomo_installed is undefined + - name: Install Matomo if 'matomo_installed' not defined, e.g. in {{ iiab_state_file }} # /etc/iiab/iiab_state.yml + include_tasks: install.yml + when: matomo_installed is undefined + # LET'S ADD THIS "ON/OFF SWITCH" IF POSS! + # - include_tasks: enable-or-disable.yml -# LET'S ADD THIS "ON/OFF SWITCH" IF POSS! -# - include_tasks: enable-or-disable.yml + - name: Add 'matomo' variable values to {{ iiab_ini_file }} + ini_file: + path: "{{ iiab_ini_file }}" # /etc/iiab/iiab.ini + section: matomo + option: "{{ item.option }}" + value: "{{ item.value | string }}" + with_items: + - option: name + value: Matomo + - option: description + value: '"Matomo is a web analytics alternative to Google Analytics, emphasizing privacy and data ownership."' + - option: matomo_install + value: "{{ matomo_install }}" + - option: matomo_enabled + value: "{{ matomo_enabled }}" + + rescue: - -- name: Add 'matomo' variable values to {{ iiab_ini_file }} - ini_file: - path: "{{ iiab_ini_file }}" # /etc/iiab/iiab.ini - section: matomo - option: "{{ item.option }}" - value: "{{ item.value | string }}" - with_items: - - option: name - value: Matomo - - option: description - value: '"Matomo is a web analytics alternative to Google Analytics, emphasizing privacy and data ownership."' - - option: matomo_install - value: "{{ matomo_install }}" - - option: matomo_enabled - value: "{{ matomo_enabled }}" + - name: 'SEE ERROR ABOVE (skip_role_on_error: {{ skip_role_on_error }})' + fail: + msg: "" + when: not skip_role_on_error