Ensure `xymon` server service is enabled and started

This commit is contained in:
Jeremy Gardais 2018-03-02 11:39:51 +01:00
parent 532e37a474
commit 052c2fd7fe
4 changed files with 26 additions and 0 deletions

View File

@ -4,3 +4,4 @@
### Features ### Features
* Install `xymon` packages for Debian based distros. * Install `xymon` packages for Debian based distros.
* Manage `xymon` server configuration (/etc). * Manage `xymon` server configuration (/etc).
* Ensure `xymon` server service is enabled and started.

View File

@ -17,6 +17,7 @@ Manage Xymon server installation and configuration.
* **xymon_server__base_packages**: List of base packages in order to provide `xymon` server [default: `xymon`]. * **xymon_server__base_packages**: List of base packages in order to provide `xymon` server [default: `xymon`].
* **xymon_server__deploy_state**: The desired state this role should achieve [default: `present`]. * **xymon_server__deploy_state**: The desired state this role should achieve [default: `present`].
* **ymon_server__etc_src**: Directory used as source to templating /etc configuration content [default: `etc/xymon`]. * **ymon_server__etc_src**: Directory used as source to templating /etc configuration content [default: `etc/xymon`].
* **xymon_server__service_manage**: If the Xymon server service should be managed [default: `True`].
## Example Playbook ## Example Playbook
@ -33,6 +34,7 @@ Manage Xymon server installation and configuration.
This role will: This role will:
* Install needed packages to provide `xymon` server. * Install needed packages to provide `xymon` server.
* Manage `xymon` server configuration (/etc). * Manage `xymon` server configuration (/etc).
* Ensure `xymon` server service is enabled and started.
## Development ## Development

View File

@ -28,6 +28,19 @@ xymon_server__base_packages:
xymon_server__deploy_state: 'present' xymon_server__deploy_state: 'present'
# ]]] # ]]]
# .. envvar:: xymon_server__service_manage [[[
#
# If the Xymon server service should be managed? Possible options:
#
# ``True``
# Default. The service is started and enabled.
#
# ``False``
# The service is stopped and disabled from startup.
#
xymon_server__service_manage: True
# ]]]
# ]]] # ]]]

View File

@ -29,3 +29,13 @@
with_filetree: '{{ xymon_server__etc_src }}' with_filetree: '{{ xymon_server__etc_src }}'
when: item.state == 'file' when: item.state == 'file'
# Manage services [[[1
- name: Manage Xymon server service
service:
name: 'xymon'
state: '{{ "started" if (xymon_server__deploy_state == "present" and
(xymon_server__service_manage | d(True) | bool))
else "stopped" }}'
enabled: '{{ xymon_server__service_manage | d(True) | bool }}'