diff --git a/defaults/main.yml b/defaults/main.yml index 8998b42..23ad724 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -1,5 +1,6 @@ --- configure_apache: false +custom_theme_url: https://gitlab.com/bz0qyz/nagios4-dark-theme/-/archive/master/nagios4-dark-theme-master.zip nagios4_config: admin_email: 'monitor-admin@example.org' admin_pager: 'monitor-admin-pager@example.com' diff --git a/tasks/configure_custom_theme.yml b/tasks/configure_custom_theme.yml new file mode 100644 index 0000000..70b4f2d --- /dev/null +++ b/tasks/configure_custom_theme.yml @@ -0,0 +1,30 @@ +--- +- name: Get theme + unarchive: + remote_src: true + src: "{{ custom_theme_url }}" + dest: /usr/src/nagio4_theme + +- name: Get current stylesheets stats + stat: + path: /etc/nagios4/stylesheets + register: stylesheets + +- name: Copy old stylesheets + copy: + remote_src: true + src: /etc/nagios4/stylesheets + dest: /etc/nagios4/stylesheets_original + when: not stylesheets.stat.islnk + +- name: Remove old stylesheets + file: + state: absent + path: /etc/nagios4/stylesheets + when: not stylesheets.stat.islnk + +- name: Create link to custom theme + file: + state: link + path: /etc/nagios4/stylesheets + src: /usr/src/nagio4_theme/stylesheets diff --git a/tasks/main.yml b/tasks/main.yml index fea3602..9815af7 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -8,3 +8,7 @@ - name: Ensure Apache is configured for Nagios include_tasks: configure_apache.yml when: configure_apache + +- name: Ensure custom theme is configured for Nagios + include_tasks: configure_custom_theme.yml + when: custom_theme_url != ''