ansible.xymon/tasks/main.yml

193 lines
5.0 KiB
YAML
Raw Permalink Normal View History

---
2018-06-22 15:24:32 +02:00
# .. vim: foldmarker=[[[,]]]:foldmethod=marker
#
# tasks file for ipr.ansible.xymon
- name: Load specific OS vars for xymon
include_vars: "{{ item }}"
with_first_found:
- "{{ ansible_distribution|lower }}-{{ ansible_distribution_version }}.yml"
- "{{ ansible_distribution|lower }}.yml"
- "{{ ansible_os_family|lower }}.yml"
2018-06-22 15:24:32 +02:00
# Manage required client packages [[[1
- name: client package
package:
name: '{{ item }}'
state: '{{ xymon_cli_pkg_state }}'
with_items:
- '{{ xymon_cli_pkg_list }}'
register: cli_result
until: cli_result is success
when: xymon_cli_manage|bool
2018-06-22 15:24:32 +02:00
# Manage client configuration [[[1
- name: CONFIG xymon-client service
template:
src: '{{ xymon_cli_default_conf_tpl }}'
dest: '{{ xymon_cli_default_conf_path }}'
2018-06-22 15:24:32 +02:00
owner: root
group: root
mode: 0644
backup: true
when: xymon_cli_manage|bool
notify: restart xymon-client service
- name: CONFIG xymon user's groups
user:
name: xymon
groups: '{{ xymon_user_groups }}'
2018-06-22 15:24:32 +02:00
append: true
when: xymon_cli_manage|bool
notify: restart xymon-client service
2018-06-22 15:24:32 +02:00
# Manage service [[[1
2017-08-11 14:14:51 +02:00
- name: SERVICE manage '{{ xymon_cli_service_name }}'
service:
name: '{{ xymon_cli_service_name }}'
state: started
enabled: '{{ xymon_cli_service_enabled }}'
when: (xymon_cli_manage|bool and
xymon_cli_service_manage|bool)
2017-09-04 17:24:40 +02:00
2018-06-22 15:24:32 +02:00
# Manage apt plugin [[[1
- name: PLUGIN apt packages
package:
name: '{{ item }}'
state: '{{ "present" if xymon_plug_apt_state else "absent" }}'
with_items:
- '{{ xymon_plug_apt_package }}'
when: (xymon_cli_manage|bool and
xymon_plug_manage|bool)
register: apt_plug_result
until: apt_plug_result is success
notify: restart xymon-client service
- name: PLUGIN apt
template:
src: '{{ xymon_plug_apt_tpl }}'
dest: '{{ xymon_plug_apt_path }}'
2018-06-22 15:24:32 +02:00
owner: root
group: root
mode: 0644
when: (xymon_cli_manage|bool and
xymon_plug_manage|bool)
notify: restart xymon-client service
- name: PLUGIN apt no_repo_accept whitelist
template:
src: 'etc/xymon/apt_no_repo_accept.j2'
dest: '/etc/xymon/apt_no_repo_accept'
owner: root
group: root
mode: 0644
when: (xymon_cli_manage|bool and
xymon_plug_manage|bool)
notify: restart xymon-client service
2018-06-22 15:24:32 +02:00
# Manage mq plugin [[[1
- name: PLUGIN mq packages
package:
name: '{{ item }}'
state: '{{ "present" if xymon_plug_mq_state else "absent" }}'
with_items:
- '{{ xymon_plug_mq_package }}'
register: mq_plug_result
until: mq_plug_result is success
when: (xymon_cli_manage|bool and
xymon_plug_manage|bool)
notify: restart xymon-client service
2017-09-04 17:24:40 +02:00
- name: PLUGIN mq
template:
src: '{{ xymon_plug_mq_tpl }}'
dest: '{{ xymon_plug_mq_path }}'
2018-06-22 15:24:32 +02:00
owner: root
group: root
mode: 0644
when: (xymon_cli_manage|bool and
xymon_plug_manage|bool)
2017-09-04 17:24:40 +02:00
notify: restart xymon-client service
2017-09-04 17:42:53 +02:00
# Manage ipmi plugin [[[1
- name: PLUGIN ipmi packages
package:
name: '{{ item }}'
state: '{{ "present" if xymon_cli__plug_ipmi_state else "absent" }}'
with_items:
- '{{ xymon_cli__plug_ipmi_package }}'
register: ipmi_plug_result
until: ipmi_plug_result is success
when: (xymon_cli_manage|bool and
xymon_plug_manage|bool)
notify: restart xymon-client service
- name: PLUGIN ipmi
template:
src: '{{ xymon_cli__plug_ipmi_tpl }}'
dest: '{{ xymon_cli__plug_ipmi_path }}'
owner: root
group: root
mode: 0644
when: (xymon_cli_manage|bool and
xymon_plug_manage|bool)
notify: restart xymon-client service
2018-06-22 15:24:32 +02:00
# Manage libs plugin [[[1
- name: PLUGIN libs packages
package:
name: '{{ item }}'
state: '{{ "present" if xymon_plug_libs_state else "absent" }}'
with_items:
- '{{ xymon_plug_libs_package }}'
register: libs_plug_result
until: libs_plug_result is success
when: (xymon_cli_manage|bool and
xymon_plug_manage|bool)
notify: restart xymon-client service
2017-09-04 17:42:53 +02:00
- name: PLUGIN libs
template:
src: '{{ xymon_plug_libs_tpl }}'
dest: '{{ xymon_plug_libs_path }}'
2018-06-22 15:24:32 +02:00
owner: root
group: root
mode: 0644
when: (xymon_cli_manage|bool and
xymon_plug_manage|bool)
2017-09-04 17:42:53 +02:00
notify: restart xymon-client service
- name: PLUGIN libs whitelist
template:
src: 'etc/xymon/libs.local.yaml.j2'
dest: '/etc/xymon/libs.local.yaml'
owner: root
group: root
mode: 0644
when: (xymon_cli_manage|bool and
xymon_plug_manage|bool)
notify: restart xymon-client service
# Manage zfs plugin [[[1
- name: PLUGIN zfs config file
template:
src: '{{ xymon_cli__plug_zfs_tpl }}'
dest: '{{ xymon_cli__plug_zfs_path }}'
owner: root
group: root
mode: 0644
when: (xymon_cli_manage|bool and
xymon_plug_manage|bool)
notify: restart xymon-client service
- name: PLUGIN zfs script file
template:
src: '{{ xymon_cli__plug_zfs_script_tpl }}'
dest: '{{ xymon_cli__plug_zfs_script_path }}'
owner: root
group: xymon
mode: 0755
when: (xymon_cli_manage|bool and
xymon_plug_manage|bool)
notify: restart xymon-client service