ansible-role-nagios/tasks/configure_custom_theme.yml

70 lines
1.7 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:
2023-04-03 17:05:29 +02:00
path: /usr/src/nagios4_theme
2023-03-27 10:55:51 +02:00
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 }}"
2023-04-03 17:05:29 +02:00
dest: /usr/src/nagios4_theme
2023-03-27 11:18:33 +02:00
list_files: true
2023-04-03 17:05:29 +02:00
owner: www-data
group: www-data
2023-03-27 11:18:33 +02:00
register: zip_files
2023-03-28 13:09:00 +02:00
- name: Set permissions to custom theme folder
file:
2023-04-03 17:05:29 +02:00
path: "/usr/src/nagios4_theme/{{ zip_files.files[0] }}"
2023-03-28 13:09:00 +02:00
state: directory
owner: www-data
group: www-data
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
2023-03-27 11:24:17 +02:00
when: stylesheets.stat.isdir is defined and stylesheets.stat.isdir
2023-03-27 10:49:35 +02:00
- name: Remove old stylesheets
file:
state: absent
path: /etc/nagios4/stylesheets
2023-03-27 11:31:13 +02:00
when: stylesheets.stat.isdir is defined and stylesheets.stat.isdir
2023-03-27 10:49:35 +02:00
- name: Create link to custom theme
file:
state: link
path: /etc/nagios4/stylesheets
2023-04-03 17:05:29 +02:00
src: /usr/src/nagios4_theme/{{ zip_files.files[0] }}/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:
2023-04-03 17:05:29 +02:00
path: /usr/src/nagios4_theme//{{ zip_files.files[0] }}/index.php
2023-03-27 10:51:03 +02:00
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
2023-04-03 17:05:29 +02:00
src: /usr/src/nagios4_theme//{{ zip_files.files[0] }}/index.php
2023-03-27 10:51:03 +02:00
dest: /usr/share/nagios4/htdocs/index.php
when: index_php.stat.exists