test configure and deconfigure

This commit is contained in:
2023-02-12 22:28:32 +01:00
parent 1e605b0109
commit 7d5f86b045
10 changed files with 56 additions and 37 deletions

View File

@@ -19,6 +19,8 @@
cron_file: "blacklist_cron"
minute: "*/5"
job: "bash /usr/local/bin/sentinel/blacklist.sh"
user: root
vars:
ansible_become: yes
ansible_become_method: sudo

View File

@@ -9,18 +9,19 @@
ansible_become: yes
ansible_become_method: sudo
ansible_become_password: "{{ sudo_password }}"
tags: [ "configure", "stats", "blacklist", "supervision"]
when: script is not defined
- name: Deploy stats script
import_tasks: stats.yml
tags: [ "configure", "stats"]
when: script is not defined or script == "stats"
- name: Configure blacklist script
import_tasks: blacklist.yml
tags: [ "configure", "blacklist" ]
when: script is not defined or script == "blacklist"
- name: Configure supervision script
import_tasks: supervision.yml
tags: [ "configure", "supervision" ]
when: script is not defined or script == "supervision"

View File

@@ -3,18 +3,19 @@
- name: Deconfigure stats script
import_tasks: deconfigure_stats.yml
tags: [ "deconfigure", "stats"]
when: script is not defined or script == "stats"
- name: Deconfigure blacklist script
import_tasks: deconfigure_blacklist.yml
tags: [ "deconfigure", "blacklist" ]
when: script is not defined or script == "blacklist"
- name: Deconfigure supervision script
import_tasks: deconfigure_supervision.yml
tags: [ "deconfigure", "supervision" ]
when: script is not defined or script == "supervision"
- name: Remove sentinel directory
- name: Remove sentinel directory
file:
state: absent
path: "{{ item }}/sentinel"
@@ -25,4 +26,4 @@
ansible_become: yes
ansible_become_method: sudo
ansible_become_password: "{{ sudo_password }}"
tags: [ "deconfigure", "stats", "blacklist", "supervision"]
when: script is not defined

View File

@@ -1,7 +1,7 @@
# tasks file for stats script
- name: Crontab get info day
- name: Remove crontab get info day
ansible.builtin.cron:
name: "get info day"
cron_file: "get_info_day_cron"
@@ -11,7 +11,7 @@
ansible_become_method: sudo
ansible_become_password: "{{ sudo_password }}"
- name: Crontab get info week
- name: Remove crontab get info week
ansible.builtin.cron:
name: "get info week"
cron_file: "get_info_week_cron"
@@ -21,7 +21,7 @@
ansible_become_method: sudo
ansible_become_password: "{{ sudo_password }}"
- name: Crontab get info month
- name: Remove crontab get info month
ansible.builtin.cron:
name: "get info month"
cron_file: "get_info_month_cron"
@@ -45,6 +45,15 @@
ansible_become_method: sudo
ansible_become_password: "{{ sudo_password }}"
- name: Remove token
file:
path: "/etc/sentinel/token"
state: absent
vars:
ansible_become: yes
ansible_become_method: sudo
ansible_become_password: "{{ sudo_password }}"
- name: Remove template virtualhost
file:
path: /etc/sentinel/virtualhost

View File

@@ -11,6 +11,6 @@
import_tasks: destroy.yml
tags: ["destroy"]
- name: Configure project web
import_tasks: configure.yml
- name: Deconfigure project web
import_tasks: deconfigure.yml
tags: [ "deconfigure" ]

View File

@@ -10,22 +10,23 @@
ansible_become_method: sudo
ansible_become_password: "{{ sudo_password }}"
- name: Template getinfo day script
- name: Template token ipinfo
template:
src: getinfo_day.sh.j2
dest: /usr/local/bin/sentinel/getinfo_day.sh
src: token.j2
dest: /etc/sentinel/token
mode: "0555"
vars:
ansible_become: yes
ansible_become_method: sudo
ansible_become_password: "{{ sudo_password }}"
- name: Copy getinfo month and week script
- name: Copy getinfo script
copy:
src: "getinfo_{{ item }}.sh.j2"
src: "getinfo_{{ item }}.sh"
dest: "/usr/local/bin/sentinel/getinfo_{{ item }}.sh"
mode: "0555"
with_items:
- day
- week
- month
vars:
@@ -39,6 +40,7 @@
cron_file: "get_info_day_cron"
minute: "0"
hour: "3"
user: root
job: "bash /usr/local/bin/sentinel/getinfo_day.sh"
vars:
ansible_become: yes
@@ -52,6 +54,7 @@
minute: "15"
hour: "3"
weekday: "1"
user: root
job: "bash /usr/local/bin/sentinel/getinfo_week.sh"
vars:
ansible_become: yes
@@ -65,6 +68,7 @@
minute: "30"
hour: "3"
day: "1"
user: root
job: "bash /usr/local/bin/sentinel/getinfo_month.sh"
vars:
ansible_become: yes

View File

@@ -15,6 +15,7 @@
name: "check ssl script"
cron_file: "check_ssl_cron"
minute: "*/30"
user: root
job: "bash /usr/local/bin/sentinel/check_ssl.sh"
vars:
ansible_become: yes