--- # .. vim: foldmarker=[[[,]]]:foldmethod=marker # # tasks file for ipr-cnrs.xymon_server # 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: - '{{ xymon_server__base_packages }}' register: server_pkg_result until: server_pkg_result is success # 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' notify: ['restart xymon server service'] - name: Generate Xymon configuration files template: src: '{{ item.src }}' dest: "/etc/xymon/{{ item.path | replace('.j2','') }}" mode: '{{ item.mode }}' with_filetree: '{{ xymon_server__etc_src }}' when: item.state == 'file' notify: ['restart xymon server service'] - 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'] # Manage service [[[1 - name: Manage Xymon server service service: name: '{{ xymon_server__service_name }}' state: '{{ "started" if (xymon_server__deploy_state == "present" and (xymon_server__service_manage | d(True) | bool)) else "stopped" }}' enabled: '{{ (xymon_server__deploy_state == "present") and (xymon_server__service_manage | d(True) | bool) }}'