ansible-role-nagios/tasks/configure_custom_theme.yml

65 lines
1.4 KiB
YAML
Raw Normal View History

2023-03-27 10:49:35 +02:00
---
2023-03-27 10:55:51 +02:00
- name: Create custom theme folder
file:
path: /usr/src/nagio4_theme
state: directory
owner: www-data
group: www-data
2023-03-27 10:49:35 +02:00
- name: Get theme
unarchive:
remote_src: true
src: "{{ custom_theme_url }}"
dest: /usr/src/nagio4_theme
2023-03-27 11:18:33 +02:00
list_files: true
register: zip_files
- name: Show files
debug:
var: zip_files
2023-03-27 10:49:35 +02:00
- 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
2023-03-27 10:55:51 +02:00
owner: www-data
group: www-data
2023-03-27 10:51:03 +02:00
- name: Get custom theme index.php stats
stat:
path: /usr/src/nagio4_theme/index.php
register: index_php
2023-03-27 10:51:47 +02:00
- 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
2023-03-27 10:51:03 +02:00
- 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