mirror of
				https://gitea.0xace.cc/ansible-galaxy/monit.git
				synced 2025-11-03 22:07:24 +00:00 
			
		
		
		
	add monit service role
This commit is contained in:
		
							
								
								
									
										15
									
								
								README.md
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										15
									
								
								README.md
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,15 @@
 | 
			
		||||
Setup monit service
 | 
			
		||||
 | 
			
		||||
    monit:            
 | 
			
		||||
      configs:
 | 
			
		||||
        - name: bird
 | 
			
		||||
          data: |
 | 
			
		||||
            check process radosgw
 | 
			
		||||
                matching "radosgw"
 | 
			
		||||
                if does not exist for 1 cycles then exec "/usr/bin/systemctl stop bird"
 | 
			
		||||
            
 | 
			
		||||
            check process nginx
 | 
			
		||||
                matching "nginx"
 | 
			
		||||
                if does not exist for 1 cycles then exec "/usr/bin/systemctl stop bird"
 | 
			
		||||
            check_interval: "1"
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										2
									
								
								defaults/main.yaml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										2
									
								
								defaults/main.yaml
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,2 @@
 | 
			
		||||
---
 | 
			
		||||
monit_version: 5.26.0
 | 
			
		||||
							
								
								
									
										6
									
								
								handlers/main.yaml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										6
									
								
								handlers/main.yaml
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,6 @@
 | 
			
		||||
---
 | 
			
		||||
- name: Reload monit
 | 
			
		||||
  systemd:
 | 
			
		||||
    name: monit
 | 
			
		||||
    state: reloaded
 | 
			
		||||
  when: not monit_setup.changed
 | 
			
		||||
							
								
								
									
										7
									
								
								meta/main.yaml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										7
									
								
								meta/main.yaml
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,7 @@
 | 
			
		||||
---
 | 
			
		||||
galaxy_info:
 | 
			
		||||
  description: Monit
 | 
			
		||||
  galaxy_tags:
 | 
			
		||||
  - monit
 | 
			
		||||
 | 
			
		||||
dependencies: []
 | 
			
		||||
							
								
								
									
										29
									
								
								tasks/main.yaml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										29
									
								
								tasks/main.yaml
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,29 @@
 | 
			
		||||
---
 | 
			
		||||
- name: Install EPEL repository
 | 
			
		||||
  yum:
 | 
			
		||||
    package: epel-release
 | 
			
		||||
    state: latest
 | 
			
		||||
 | 
			
		||||
- name: Ensure monit {{ monit_version }} installed
 | 
			
		||||
  yum:
 | 
			
		||||
    package:
 | 
			
		||||
      name: monit-{{ monit_version }}
 | 
			
		||||
     state: present
 | 
			
		||||
  register: monit_setup
 | 
			
		||||
 | 
			
		||||
- name: Propagate configs
 | 
			
		||||
  copy:
 | 
			
		||||
    content: "{{ item.config }}"
 | 
			
		||||
    dest: "/etc/monit.d/{{ item.conf_name }}"
 | 
			
		||||
  notify: Reload monit
 | 
			
		||||
  with_items:
 | 
			
		||||
    - "{{ monit_configs }}"
 | 
			
		||||
  when:
 | 
			
		||||
    - (monit_configs is defined or monit_configs | length != 0)
 | 
			
		||||
 | 
			
		||||
- name: Ensure monit enabled and started
 | 
			
		||||
  systemd:
 | 
			
		||||
    name: monit
 | 
			
		||||
    state: started
 | 
			
		||||
    enabled: yes
 | 
			
		||||
    daemon_reload: yes
 | 
			
		||||
		Reference in New Issue
	
	Block a user