Debian Codegraph @

ansible_collections/community/general/tests/integration/targets/monit/tasks/main.yml

raw
1 ---
2 ####################################################################
3 # WARNING: These are designed specifically for Ansible tests #
4 # and should not be used as examples of how to write Ansible roles #
5 ####################################################################
6
7 # Copyright (c) Ansible Project
8 # GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
9 # SPDX-License-Identifier: GPL-3.0-or-later
10
11 - block:
12 - name: Install EPEL repository (only effective in RHEL)
13 include_role:
14 name: setup_epel
15
16 - name: create required directories
17 become: true
18 file:
19 path: "{{ item }}"
20 state: directory
21 loop:
22 - /var/lib/monit
23 - /var/run/monit
24 - "{{ process_root }}"
25
26 - name: install monit
27 become: true
28 package:
29 name: monit
30 state: present
31
32 - include_vars: '{{ item }}'
33 with_first_found:
34 - files:
35 - "{{ ansible_facts.distribution }}-{{ ansible_facts.distribution_major_version }}.yml"
36 - '{{ ansible_facts.os_family }}.yml'
37 - 'defaults.yml'
38
39 - name: monit config
40 become: true
41 template:
42 src: "monitrc.j2"
43 dest: "{{ monitrc }}"
44
45 - name: copy process file
46 become: true
47 copy:
48 src: httpd_echo.py
49 dest: "{{ process_file }}"
50
51 - name: Install virtualenv on Arch Linux
52 pip:
53 name: virtualenv
54 state: present
55 when: ansible_facts.os_family == 'Archlinux'
56
57 - name: install dependencies
58 pip:
59 name: "{{ item }}"
60 virtualenv: "{{ process_venv }}"
61 virtualenv_command: "{{ virtualenv_command }}"
62 extra_args: "-c {{ remote_constraints }}"
63 loop:
64 - setuptools
65 - python-daemon
66
67 - name: restart monit
68 become: true
69 service:
70 name: monit
71 state: restarted
72
73 - include_tasks: test.yml
74
75 always:
76 - name: stop monit
77 become: true
78 service:
79 name: monit
80 state: stopped
81
82 - name: uninstall monit
83 become: true
84 package:
85 name: monit
86 state: absent
87
88 - name: remove process files
89 file:
90 path: "{{ process_root }}"
91 state: absent