Add custom theme

This commit is contained in:
Antonio J. Delgado 2023-03-27 11:49:35 +03:00
parent 5cd8136f0e
commit 0236d26274
3 changed files with 35 additions and 0 deletions

View file

@ -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'

View file

@ -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

View file

@ -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 != ''