2018-03-01 13:46:21 +01:00
|
|
|
---
|
|
|
|
# .. vim: foldmarker=[[[,]]]:foldmethod=marker
|
|
|
|
#
|
2018-03-02 11:21:07 +01:00
|
|
|
# tasks file for ipr-cnrs.xymon_server
|
2018-03-01 13:46:21 +01:00
|
|
|
|
|
|
|
# Server Manage required system packages [[[1
|
|
|
|
- name: Ensure required packages are in there desired state
|
|
|
|
package:
|
|
|
|
name: '{{ item }}'
|
|
|
|
state: '{{ "present" if (xymon_server__deploy_state == "present") else "absent" }}'
|
|
|
|
install_recommends: False
|
|
|
|
with_flattened:
|
2019-02-27 11:23:34 +01:00
|
|
|
- '{{ xymon_server__base_packages | to_nice_json }}'
|
2019-02-26 13:54:30 +01:00
|
|
|
register: server_pkg_result
|
|
|
|
until: server_pkg_result is success
|
2018-03-01 13:46:21 +01:00
|
|
|
|
2018-03-02 11:21:07 +01:00
|
|
|
# Server Manage /etc configuration files [[[1
|
|
|
|
|
|
|
|
- name: Ensure /etc directory structure exists
|
|
|
|
file:
|
|
|
|
path: '/etc/xymon/{{ item.path }}'
|
|
|
|
state: directory
|
|
|
|
with_filetree: '{{ xymon_server__etc_src }}'
|
|
|
|
when: item.state == 'directory'
|
2018-03-02 14:21:59 +01:00
|
|
|
notify: ['restart xymon server service']
|
2018-03-02 11:21:07 +01:00
|
|
|
|
2018-07-12 09:38:20 +02:00
|
|
|
- name: Generate Xymon configuration files
|
2018-03-02 11:21:07 +01:00
|
|
|
template:
|
|
|
|
src: '{{ item.src }}'
|
|
|
|
dest: "/etc/xymon/{{ item.path | replace('.j2','') }}"
|
2018-07-12 09:38:20 +02:00
|
|
|
mode: '{{ item.mode }}'
|
2018-03-02 11:21:07 +01:00
|
|
|
with_filetree: '{{ xymon_server__etc_src }}'
|
|
|
|
when: item.state == 'file'
|
2018-03-02 14:21:59 +01:00
|
|
|
notify: ['restart xymon server service']
|
2018-03-02 11:21:07 +01:00
|
|
|
|
2018-07-12 09:39:42 +02:00
|
|
|
- name: Generate Xymon configuration symlinks
|
|
|
|
template:
|
|
|
|
src: '{{ item.src }}'
|
|
|
|
dest: "/etc/xymon/{{ item.path }}"
|
|
|
|
mode: '{{ item.mode }}'
|
|
|
|
state: 'link'
|
|
|
|
force: true
|
|
|
|
with_filetree: '{{ xymon_server__etc_src }}'
|
|
|
|
when: item.state == 'link'
|
|
|
|
notify: ['restart xymon server service']
|
|
|
|
|
2018-03-02 14:21:59 +01:00
|
|
|
# Manage service [[[1
|
2018-03-02 11:39:51 +01:00
|
|
|
|
|
|
|
- name: Manage Xymon server service
|
|
|
|
service:
|
2018-03-02 14:21:59 +01:00
|
|
|
name: '{{ xymon_server__service_name }}'
|
2018-03-02 11:39:51 +01:00
|
|
|
state: '{{ "started" if (xymon_server__deploy_state == "present" and
|
|
|
|
(xymon_server__service_manage | d(True) | bool))
|
|
|
|
else "stopped" }}'
|
2018-03-09 12:08:05 +01:00
|
|
|
enabled: '{{ (xymon_server__deploy_state == "present") and
|
|
|
|
(xymon_server__service_manage | d(True) | bool) }}'
|