1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2026-04-27 05:58:50 +00:00
community.general/tests/integration/targets/monit/tasks/main.yml
Alexei Znamensky f4e5fc09d7
monit: re-enable tests in RHEL (#11690)
* re-enable monit tests in rhel

* enable EPEL for RHEL<11

* rollback EPEL setup, skip only specific versions

* remove skip entirely

* change download URL in setup_epel, adjusted code to use it

* claude tries to install virtualenv, round 1

* claude tries python3 -m venv instead

* remove outdated centos6 file
2026-03-31 22:17:38 +13:00

97 lines
2.4 KiB
YAML

---
####################################################################
# WARNING: These are designed specifically for Ansible tests #
# and should not be used as examples of how to write Ansible roles #
####################################################################
# Copyright (c) Ansible Project
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
# SPDX-License-Identifier: GPL-3.0-or-later
- block:
- name: Install EPEL repository (only effective in RHEL)
include_role:
name: setup_epel
- name: create required directories
become: true
file:
path: "{{ item }}"
state: directory
loop:
- /var/lib/monit
- /var/run/monit
- "{{ process_root }}"
- name: install monit
become: true
package:
name: monit
state: present
- include_vars: '{{ item }}'
with_first_found:
- files:
- "{{ ansible_facts.distribution }}-{{ ansible_facts.distribution_major_version }}.yml"
- '{{ ansible_facts.os_family }}.yml'
- 'defaults.yml'
- name: monit config
become: true
template:
src: "monitrc.j2"
dest: "{{ monitrc }}"
- name: copy process file
become: true
copy:
src: httpd_echo.py
dest: "{{ process_file }}"
- name: Install virtualenv on CentOS 8
package:
name: virtualenv
state: present
when: ansible_facts.distribution == 'CentOS' and ansible_facts.distribution_major_version == '8'
- name: Install virtualenv on Arch Linux
pip:
name: virtualenv
state: present
when: ansible_facts.os_family == 'Archlinux'
- name: install dependencies
pip:
name: "{{ item }}"
virtualenv: "{{ process_venv }}"
virtualenv_command: "{{ virtualenv_command }}"
extra_args: "-c {{ remote_constraints }}"
loop:
- setuptools
- python-daemon
- name: restart monit
become: true
service:
name: monit
state: restarted
- include_tasks: test.yml
always:
- name: stop monit
become: true
service:
name: monit
state: stopped
- name: uninstall monit
become: true
package:
name: monit
state: absent
- name: remove process files
file:
path: "{{ process_root }}"
state: absent