ansible.xymon/tasks/main.yml

198 lines
5.7 KiB
YAML
Raw 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:
2023-01-24 11:45:30 +01:00
name: '{{ xymon_cli__pkg_list | flatten }}'
2020-11-03 15:17:08 +01:00
state: '{{ xymon_cli__pkg_state }}'
register: cli_result
until: cli_result is success
2020-11-03 15:17:08 +01:00
when: xymon_cli__manage|bool
2018-06-22 15:24:32 +02:00
# Manage client configuration [[[1
- name: CONFIG xymon-client service
template:
2020-11-03 15:17:08 +01:00
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
2020-11-03 15:17:08 +01:00
when: xymon_cli__manage|bool
notify: restart xymon-client service
- name: CONFIG xymon user's groups
user:
name: xymon
2020-11-03 15:17:08 +01:00
groups: '{{ xymon_cli__user_groups }}'
2018-06-22 15:24:32 +02:00
append: true
2020-11-03 15:17:08 +01:00
when: xymon_cli__manage|bool
notify: restart xymon-client service
2018-06-22 15:24:32 +02:00
# Manage service [[[1
2020-11-03 15:17:08 +01:00
- name: SERVICE manage '{{ xymon_cli__service_name }}'
2017-08-11 14:14:51 +02:00
service:
2020-11-03 15:17:08 +01:00
name: '{{ xymon_cli__service_name }}'
2017-08-11 14:14:51 +02:00
state: started
2020-11-03 15:17:08 +01:00
enabled: '{{ xymon_cli__service_enabled }}'
when: (xymon_cli__manage|bool and
xymon_cli__service_manage|bool)
2017-09-04 17:24:40 +02:00
# Manage all plugins's packages [[[1
- name: PLUGINS package and dependencies
package:
2023-01-24 11:45:30 +01:00
name: '{{ xymon_cli__plug_combined_packages | flatten }}'
2019-05-24 10:08:06 +02:00
state: 'present'
2020-11-03 15:17:08 +01:00
when: (xymon_cli__manage|bool and
xymon_cli__plug_manage|bool)
register: combined_packages_plug_result
until: combined_packages_plug_result is success
notify: restart xymon-client service
# Manage plugins clientlaunch files [[[1
- name: PLUGINS clientlaunch files
template:
src: '{{ item.template }}'
dest: '{{ item.path }}'
2018-06-22 15:24:32 +02:00
owner: root
group: root
mode: 0644
with_items:
- '{{ xymon_cli__plug_combined_clientlaunch }}'
2020-11-03 15:17:08 +01:00
when: (xymon_cli__manage|bool and
xymon_cli__plug_manage|bool)
notify: restart xymon-client service
# Manage apt plugin [[[1
- 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
2020-11-03 15:17:08 +01:00
when: (xymon_cli__manage|bool and
xymon_cli__plug_manage|bool)
notify: restart xymon-client service
2018-06-22 15:24:32 +02:00
# Manage libs plugin [[[1
- name: PLUGIN libs whitelist
template:
src: 'etc/xymon/libs.local.yaml.j2'
dest: '/etc/xymon/libs.local.yaml'
owner: root
group: root
mode: 0644
2020-11-03 15:17:08 +01:00
when: (xymon_cli__manage|bool and
xymon_cli__plug_manage|bool)
notify: restart xymon-client service
2020-10-29 17:52:19 +01:00
# Manage net plugin [[[1
- name: PLUGIN net config template
template:
src: '{{ xymon_cli__plug_net_conf_tpl }}'
dest: '{{ xymon_cli__plug_net_conf_path }}'
owner: root
group: root
mode: 0644
2020-11-03 15:17:08 +01:00
when: (xymon_cli__manage|bool and
xymon_cli__plug_manage|bool)
2019-05-24 09:49:54 +02:00
notify: restart xymon-client service
# Manage sge plugin [[[1
- name: PLUGIN sge script file from template
template:
src: '{{ xymon_cli__plug_sge_script_tpl }}'
dest: '{{ xymon_cli__plug_sge_script_path }}'
owner: root
group: xymon
mode: 0755
2020-11-03 15:17:08 +01:00
when: (xymon_cli__manage|bool and
xymon_cli__plug_manage|bool and
xymon_cli__plug_sge_script_url|length == 0 )
notify: restart xymon-client service
- name: PLUGIN sge script file from URL
get_url:
url: '{{ xymon_cli__plug_sge_script_url }}'
dest: '{{ xymon_cli__plug_sge_script_path }}'
owner: root
group: xymon
mode: 0755
2020-11-03 15:17:08 +01:00
when: (xymon_cli__manage|bool and
xymon_cli__plug_manage|bool and
xymon_cli__plug_sge_script_url|length > 0 )
notify: restart xymon-client service
# Manage smartoverall plugin [[[1
- name: PLUGIN smartoverall script file from template
template:
src: '{{ xymon_cli__plug_smartoverall_script_tpl }}'
dest: '{{ xymon_cli__plug_smartoverall_script_path }}'
owner: root
group: xymon
mode: 0755
2020-11-03 15:17:08 +01:00
when: (xymon_cli__manage|bool and
xymon_cli__plug_manage|bool and
xymon_cli__plug_smartoverall_script_url|length == 0 )
notify: restart xymon-client service
- name: PLUGIN smartoverall script file from URL
get_url:
url: '{{ xymon_cli__plug_smartoverall_script_url }}'
dest: '{{ xymon_cli__plug_smartoverall_script_path }}'
owner: root
group: xymon
mode: 0755
2020-11-03 15:17:08 +01:00
when: (xymon_cli__manage|bool and
xymon_cli__plug_manage|bool and
xymon_cli__plug_smartoverall_script_url|length > 0 )
notify: restart xymon-client service
2020-02-18 14:24:31 +01:00
# Manage smart plugin [[[1
- name: PLUGIN smart script file from template
2020-02-18 14:24:31 +01:00
template:
src: '{{ xymon_cli__plug_smart_script_tpl }}'
dest: '{{ xymon_cli__plug_smart_script_path }}'
owner: root
group: xymon
mode: 0755
2020-11-03 15:17:08 +01:00
when: (xymon_cli__manage|bool and
xymon_cli__plug_manage|bool and
xymon_cli__plug_smart_script_url|length == 0 )
notify: restart xymon-client service
- name: PLUGIN smart script file from URL
get_url:
url: '{{ xymon_cli__plug_smart_script_url }}'
dest: '{{ xymon_cli__plug_smart_script_path }}'
owner: root
group: xymon
mode: 0755
2020-11-03 15:17:08 +01:00
when: (xymon_cli__manage|bool and
xymon_cli__plug_manage|bool and
xymon_cli__plug_smart_script_url|length > 0 )
2020-02-18 14:24:31 +01:00
notify: restart xymon-client service
# Manage zfs plugin [[[1
- 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
2020-11-03 15:17:08 +01:00
when: (xymon_cli__manage|bool and
xymon_cli__plug_manage|bool)
notify: restart xymon-client service