Manage `xymon` server configuration (/etc)

This commit is contained in:
Jeremy Gardais 2018-03-02 11:21:07 +01:00
parent 3c05d6bf5d
commit 532e37a474
4 changed files with 38 additions and 3 deletions

View File

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

View File

@ -16,6 +16,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`].
## Example Playbook ## Example Playbook
@ -31,8 +32,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 and service. * Manage `xymon` server configuration (/etc).
* Add 'xymon' user to new groups.
## Development ## Development

View File

@ -26,6 +26,23 @@ xymon_server__base_packages:
# TODO # TODO
# #
xymon_server__deploy_state: 'present' xymon_server__deploy_state: 'present'
# ]]]
# ]]]
# Server configuration [[[
# -----------------------------
# .. envvar:: xymon_server__etc_src [[[.
# Directory with templates used to provide server configuration (usually in
# '/etc/xymon').
#
# Must be a relative path to default/ directory of this role
# or to your ansible inventory directory.
#
xymon_server__etc_src: '../templates/etc/xymon'
# ]]] # ]]]
# ]]] # ]]]

View File

@ -1,7 +1,7 @@
--- ---
# .. vim: foldmarker=[[[,]]]:foldmethod=marker # .. vim: foldmarker=[[[,]]]:foldmethod=marker
# #
# tasks file for ipr.ansible.xymon # tasks file for ipr-cnrs.xymon_server
# Server Manage required system packages [[[1 # Server Manage required system packages [[[1
- name: Ensure required packages are in there desired state - name: Ensure required packages are in there desired state
@ -12,3 +12,20 @@
with_flattened: with_flattened:
- '{{ xymon_server__base_packages }}' - '{{ xymon_server__base_packages }}'
# 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'
- name: Ensure /etc files are populated from templates
template:
src: '{{ item.src }}'
dest: "/etc/xymon/{{ item.path | replace('.j2','') }}"
with_filetree: '{{ xymon_server__etc_src }}'
when: item.state == 'file'