ansible-role-tinystatus/tasks/main.yml

74 lines
1.9 KiB
YAML
Raw Normal View History

2021-05-24 14:20:54 +00:00
---
- name: Installation des prérequis
yum:
name:
- git
2022-07-31 17:33:18 +00:00
- iputils
- nmap-ncat
- curl
2021-05-24 14:20:54 +00:00
state: present
- name: Clonage du dépôt
git:
repo: "{{ tinstatus_gitrepo }}"
dest: "{{ tinystatus_bindir }}"
force: yes
- name: Mise en place du contectexte selinux
file:
path: "{{ tinystatus_bindir }}/tinystatus"
setype: bin_t
- name: Création du répertoire de configuration
file:
state: directory
path: "{{ tinystatus_configdir }}"
mode: 0555
- name: Déployment des fichiers de configuration
template:
src: "{{ item }}.j2"
dest: "{{ tinystatus_configdir }}/{{ item }}"
mode: 0444
loop:
- checks.csv
- incidents.txt
- name: Création du scritp d'éxécution
template:
src: tinystatus.sh.j2
dest: "{{ tinystatus_bindir }}/tinystatus.sh"
mode: 0555
setype: bin_t
- name: Création des fichiers systemd
template:
src: "{{ item }}.j2"
dest: "/etc/systemd/system/{{ item }}"
mode: 0644
loop:
- tinystatus.service
- tinystatus.timer
notify: systemd daemon-reload
- name: Flush handlers
meta: flush_handlers
- name: Création du répertoire de site web pour génération du fichier
file:
state: directory
path: "{{ tinystatus_webdir }}"
owner: "{{ tinystatus_webuser }}"
group: "{{ tinystatus_webgrp }}"
setype: httpd_sys_content_t
mode: u=rx,g=rxs,o=rx
- name: Création du fichier si il n'existe pas
shell:
cmd: "{{ tinystatus_bindir }}/tinystatus.sh"
creates: "{{ tinystatus_webdir }}/{{ tinystatus_pagefile }}"
- name: Mise en place des permissions
2021-05-24 14:20:54 +00:00
file:
path: "{{ tinystatus_webdir }}/{{ tinystatus_pagefile }}"
state: file
2021-05-24 14:20:54 +00:00
owner: "{{ tinystatus_user }}"
group: "{{ tinystatus_grp }}"
setype: httpd_sys_content_t
mode: 0644
- name: Active et démarre tinystatus.timer
systemd:
name: tinystatus.timer
enabled: yes
state: started