--- # Tasks for installation on RedHat Family - name: Ensure xinetd installed package: name: xinetd state: present notify: restart xinetd when: ansible_distribution_major_version != '9' - name: Start xinetd service: name: xinetd state: started when: ansible_distribution_major_version != '9' - 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 when: cmk_download_mode == 'samba' copy: src: /tmp/dls/{{ cmk_installer }} dest: /tmp/check-mk-agent.rpm - 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.rpm register: cmkrpm - name: Download the agent from Server get_url: url: '{{ cmk_rpm_agent }}{{ cmk_auth }}' dest: /tmp/check-mk-agent.rpm validate_certs: false when: not cmkrpm.stat.exists and cmk_dl_needs_auth|bool - name: Download the agent from Server get_url: url: '{{ cmk_rpm_agent }}' dest: /tmp/check-mk-agent.rpm validate_certs: false when: not cmkrpm.stat.exists and not cmk_dl_needs_auth|bool - name: Ensure check_mk_agent installed package: name: /tmp/check-mk-agent.rpm state: latest disable_gpg_check: true # Not gpg signed so bypass the check notify: - restart xinetd - cmk fresh install - ensure firewall open (rhel)