Files
ansible-role-checkmk-agent/tasks/Debian.yml
2024-01-09 14:33:55 +13:00

84 lines
2.5 KiB
YAML

---
# Tasks for installation on RedHat Family
- name: Ensure xinetd installed
package:
name: xinetd
state: present
notify: restart xinetd
- name: Ensure python openssl available
package:
name: python3-openssl,python3-requests
state: present
- name: Fix SeLinux Auto-Updates
when: ansible_selinux|bool
tags: selinux-pre
block:
- name: list installed selinux modules
command: /usr/sbin/semodule -l
register: installed_mods
- name: check_mk_mod_installed
set_fact:
cmk_mod_installed: true
when: '"checkmk-agent-autoupgrade" in installed_mods.stdout'
- name: copy file
copy:
src: files/checkmk-agent-autoupgrade.pp
dest: /tmp/checkmk-agent-autoupgrade.pp
when: cmk_mod_installed is not defined
- name: install the module
command: /usr/sbin/semodule -i /tmp/checkmk-agent-autoupgrade.pp
when: cmk_mod_installed is not defined
notify: remove selinux policy file
- name: Gather facts of packages
package_facts:
manager: auto
- name: Remove check-mk if force install
package:
name: check-mk-agent
state: absent
when: cmk_force_install and 'check-mk-agent' in ansible_facts.packages
- name: Re-check check-mk-agent status
package_facts:
manager: auto
when: cmk_force_install
# Download agent by samba share
- include_tasks: downloads/samba/main.yml
when: cmk_download_mode == 'samba'
- name: Copy installer to node
copy:
src: /tmp/dls/{{ cmk_installer }}
dest: /tmp/check-mk-agent.deb
- name: Install check-mk-agent
when: "'check-mk-agent' not in ansible_facts.packages or cmk_force_install"
tags: [check_mk_agent]
block:
- name: Check if check-mk-agent is present on server
stat:
path: /tmp/check-mk-agent.deb
register: cmkdeb
- name: Download the agent from Server
get_url:
url: '{{ cmk_deb_agent }}{{ cmk_auth }}'
dest: /tmp/check-mk-agent.deb
validate_certs: false
when: not cmkdeb.stat.exists and cmk_dl_needs_auth|bool
- name: Download the agent from Server
get_url:
url: '{{ cmk_deb_agent }}'
dest: /tmp/check-mk-agent.deb
validate_certs: false
when: not cmkdeb.stat.exists and not cmk_dl_needs_auth|bool
- name: Ensure check_mk_agent installed
package:
deb: /tmp/check-mk-agent.deb
state: present
allow_unauthenticated: true # Not gpg signed so bypass the check
notify:
- restart xinetd
- cmk fresh install
- ensure firewall open (debian)