ansible-role-nagios/tasks/configure_custom_theme.yml
2023-03-27 11:55:51 +03:00

58 lines
1.3 KiB
YAML

---
- name: Create custom theme folder
file:
path: /usr/src/nagio4_theme
state: directory
owner: www-data
group: www-data
- 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
owner: www-data
group: www-data
- name: Get custom theme index.php stats
stat:
path: /usr/src/nagio4_theme/index.php
register: index_php
- name: Backup previous index.php
copy:
remote_src: true
src: /usr/share/nagios4/htdocs/index.php
dest: /usr/share/nagios4/htdocs/index_previous.php
when: index_php.stat.exists
- name: Copy custom index.php
copy:
remote_src: true
src: /usr/src/nagio4_theme/index.php
dest: /usr/share/nagios4/htdocs/index.php
when: index_php.stat.exists