test configure and deconfigure

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

View File

@ -1,18 +1,18 @@
$ANSIBLE_VAULT;1.1;AES256 $ANSIBLE_VAULT;1.1;AES256
62643736353737643733623031373139626437396435656664636661373730646535326539303362 31393265313635666339373930656266363533626234383533313734323964386463363739363664
3562383661323166643437636233633838303861373230380a623939366265356531356131343062 3362323965366165643139326433646535303931616338390a316232656464383534383361313032
65306666333065336633333036626163313633646233313238373032323561626665356531653661 39303032376339303830643866356464303235633736623134313334646361363265393330653432
6661393439386438360a376339663536313366653633363362323264346565313332366230326331 6338626261383734380a333662613238323038616637643162626436376536326461396461303866
66333630383639626262386332633462653635386137396231363763373466663463343961356137 36383835363639633530653238353564643438616238663263363837343436636531656332303266
38643432316330366432333534343639663433333361343665376461333465306236353833313866 37303663303139393636663334313130356231643639633833636563356137393930383639613337
37643531396639626461303538313465323663396436393365323663333363653835366637356339 31353336346531313561336464643332333234656236386330316236376234306463663164623435
63316435346132383766363562356262396565303233336337366430323034383832633738616135 62386665383332316133383035366162323636323638323965643532356634333836323562303132
64646232646237613736643134653264383963373935333766626461383939663538346466383731 61396539633336346436346466306339316461613732383738666663366233373261396366353039
37643131663830653630633864306439613637363836646164356464623732356137656331343233 61303966326130326531393837333562383337646463393435643336303465393935623938346530
66356534396239646266313063356333353232343263323139386337306135623063316439643861 64623864313332613633333162623736643030363833346133643838383534656430336332333331
36323839393536323562323462376161376561653934366135376165656338656361333530646431 61383661353932383961303537306233333864623531316239653131346436313035643461633032
39396461353432316537366433353765663234393932393536323963643631306563663133323930 33376338326466616230373465643236343937653839316562633630393162373936306364633765
32396465646635336566623636353437626232343135623762343338323661363332653837316363 32306337656639386330386334653262313663363062356263623165366164663764646430373162
39346334616339643062623731353035363433653163303062636362353235636265623533636634 36353539376234386465393637303533323662353965663936623464633066386239623637373539
62326461356462363562373537363630303263653864323334326561326637636166346364626563 39323637653361663730633735396133636539303133306164373838623930663364306135353938
3761 3935

View File

@ -2,7 +2,7 @@
MAIL=/tmp/mail MAIL=/tmp/mail
DIRECTORY=/home/valentin/mail DIRECTORY=/home/valentin/mail
SERVER_LOG=/var/log/nginx SERVER_LOG=/var/log/nginx
TOKEN={{ token_ipinfo }} TOKEN=$(cat /etc/sentinel/token)
DATE=$(date +%Y%m%d-%H%M%S) DATE=$(date +%Y%m%d-%H%M%S)
HOST=($(cat /etc/sentinel/virtualhost)) HOST=($(cat /etc/sentinel/virtualhost))
WEEK=$(date +%V) WEEK=$(date +%V)

View File

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

View File

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

View File

@ -3,16 +3,17 @@
- name: Deconfigure stats script - name: Deconfigure stats script
import_tasks: deconfigure_stats.yml import_tasks: deconfigure_stats.yml
tags: [ "deconfigure", "stats"] when: script is not defined or script == "stats"
- name: Deconfigure blacklist script - name: Deconfigure blacklist script
import_tasks: deconfigure_blacklist.yml import_tasks: deconfigure_blacklist.yml
tags: [ "deconfigure", "blacklist" ] when: script is not defined or script == "blacklist"
- name: Deconfigure supervision script - name: Deconfigure supervision script
import_tasks: deconfigure_supervision.yml 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: file:
@ -25,4 +26,4 @@
ansible_become: yes ansible_become: yes
ansible_become_method: sudo ansible_become_method: sudo
ansible_become_password: "{{ sudo_password }}" 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 # tasks file for stats script
- name: Crontab get info day - name: Remove crontab get info day
ansible.builtin.cron: ansible.builtin.cron:
name: "get info day" name: "get info day"
cron_file: "get_info_day_cron" cron_file: "get_info_day_cron"
@ -11,7 +11,7 @@
ansible_become_method: sudo ansible_become_method: sudo
ansible_become_password: "{{ sudo_password }}" ansible_become_password: "{{ sudo_password }}"
- name: Crontab get info week - name: Remove crontab get info week
ansible.builtin.cron: ansible.builtin.cron:
name: "get info week" name: "get info week"
cron_file: "get_info_week_cron" cron_file: "get_info_week_cron"
@ -21,7 +21,7 @@
ansible_become_method: sudo ansible_become_method: sudo
ansible_become_password: "{{ sudo_password }}" ansible_become_password: "{{ sudo_password }}"
- name: Crontab get info month - name: Remove crontab get info month
ansible.builtin.cron: ansible.builtin.cron:
name: "get info month" name: "get info month"
cron_file: "get_info_month_cron" cron_file: "get_info_month_cron"
@ -45,6 +45,15 @@
ansible_become_method: sudo ansible_become_method: sudo
ansible_become_password: "{{ sudo_password }}" 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 - name: Remove template virtualhost
file: file:
path: /etc/sentinel/virtualhost path: /etc/sentinel/virtualhost

View File

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

View File

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

View File

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

View File

@ -0,0 +1 @@
{{ token_ipinfo }}