templatizing virtualhost getinfo_day

This commit is contained in:
Valentin CZERYBA 2023-02-12 18:38:38 +01:00
parent 6b7d2ff9a9
commit 87ea635874
5 changed files with 168 additions and 15 deletions

View File

@ -1,14 +1,18 @@
$ANSIBLE_VAULT;1.1;AES256
37656337323032643834333437363330363932363462306332646166616531616265646536373530
6234313633353137656665653536663964393264303532610a633664613332343333363034396238
61643465363532383661636238356566616161343034343166656364353538353564333235373663
3336313930643062370a316439666335626265306338383939306433343439666333646632613366
65663766326333623033643933613962393163313566636238353964656636633265373936626364
65313565663265613532623563366533393030643539346363613035656632323762666131643530
61616338616637336333663363323761653564633137633361333364663232656136353966346134
38313435653131326161383564386261356333356164393034663538326262633036383438666330
65393939363338363932653461393234346431653661626338653536353562396664313932346432
39353035373263633938336337346461306162656662363461306538353436353063363764323631
30386334356534663238656166666432636233353935623331366130323264393231306265363761
37323163663561393938366662373963303634636564346663363239346332316336366636636235
64343466333931353861346164656234393265653034623335636266393262323234
62643736353737643733623031373139626437396435656664636661373730646535326539303362
3562383661323166643437636233633838303861373230380a623939366265356531356131343062
65306666333065336633333036626163313633646233313238373032323561626665356531653661
6661393439386438360a376339663536313366653633363362323264346565313332366230326331
66333630383639626262386332633462653635386137396231363763373466663463343961356137
38643432316330366432333534343639663433333361343665376461333465306236353833313866
37643531396639626461303538313465323663396436393365323663333363653835366637356339
63316435346132383766363562356262396565303233336337366430323034383832633738616135
64646232646237613736643134653264383963373935333766626461383939663538346466383731
37643131663830653630633864306439613637363836646164356464623732356137656331343233
66356534396239646266313063356333353232343263323139386337306135623063316439643861
36323839393536323562323462376161376561653934366135376165656338656361333530646431
39396461353432316537366433353765663234393932393536323963643631306563663133323930
32396465646635336566623636353437626232343135623762343338323661363332653837316363
39346334616339643062623731353035363433653163303062636362353235636265623533636634
62326461356462363562373537363630303263653864323334326561326637636166346364626563
3761

View File

@ -1 +0,0 @@
clarissa

View File

@ -0,0 +1,147 @@
# tasks file for stats script
- name: Create sentinel directory
file:
state: directory
path: /usr/local/bin/sentinel
vars:
ansible_become: yes
ansible_become_method: sudo
ansible_become_password: "{{ sudo_password }}"
- name: "all create directory "
file:
path: "/var/www/{{ item.git_name }}"
state: directory
owner: www-data
group: www-data
mode: '500'
when: "item.git_name is defined and project_name is not defined and conf_name is not defined"
with_items:
- "{{ project }}"
vars:
ansible_become: yes
ansible_become_method: sudo
ansible_become_password: "{{ sudo_password }}"
- name: "all extract repo "
unarchive:
src: "/tmp/{{ item.git_name }}.tar.gz"
dest: "/var/www/{{ item.git_name }}"
owner: www-data
group: www-data
mode: '500'
when: "item.git_name is defined and project_name is not defined and conf_name is not defined"
with_items:
- "{{ project }}"
vars:
ansible_become: yes
ansible_become_method: sudo
ansible_become_password: "{{ sudo_password }}"
- name: "single git archive"
local_action:
module: git
repo: "https://{{ git_username | urlencode }}:{{ git_password | urlencode }}@git.valczeryba.ovh/v4l3n71n/{{ project_name }}.git"
dest: "/home/valentin/src/"
archive: "/tmp/{{ project_name }}.tar.gz"
force: yes
update: yes
when: "project_name is defined"
- name: "single create directory "
file:
path: "/var/www/{{ project_name }}"
state: directory
owner: www-data
group: www-data
mode: '500'
when: "project_name is defined"
vars:
ansible_become: yes
ansible_become_method: sudo
ansible_become_password: "{{ sudo_password }}"
- name: "single extract repo "
unarchive:
src: "/tmp/{{ project_name }}.tar.gz"
dest: "/var/www/{{ project_name }}"
owner: www-data
group: www-data
mode: '500'
when: "project_name is defined"
vars:
ansible_become: yes
ansible_become_method: sudo
ansible_become_password: "{{ sudo_password }}"
- name: "copy nginx.conf"
copy:
src: "nginx.conf"
dest: "/etc/nginx/"
vars:
ansible_become: yes
ansible_become_method: sudo
ansible_become_password: "{{ sudo_password }}"
- name: "all copy configure nginx"
copy:
src: "{{ item.conf_name }}"
dest: "/etc/nginx/sites-available"
when: "item.conf_name is defined and project_name is not defined and conf_name is not defined"
with_items:
- "{{ project }}"
vars:
ansible_become: yes
ansible_become_method: sudo
ansible_become_password: "{{ sudo_password }}"
- name: "all create symlink"
file:
src: "/etc/nginx/sites-available/{{ item.conf_name }}"
dest: "/etc/nginx/sites-enabled/{{ item.conf_name }}"
state: link
when: "item.conf_name is defined and project_name is not defined and conf_name is not defined"
with_items:
- "{{ project }}"
vars:
ansible_become: yes
ansible_become_method: sudo
ansible_become_password: "{{ sudo_password }}"
- name: "single copy configure nginx"
copy:
src: "{{ conf_name }}"
dest: "/etc/nginx/sites-available"
when: "conf_name is defined"
vars:
ansible_become: yes
ansible_become_method: sudo
ansible_become_password: "{{ sudo_password }}"
- name: "single create symlink"
file:
src: "/etc/nginx/sites-available/{{ conf_name }}"
dest: "/etc/nginx/sites-enabled/{{ conf_name }}"
state: link
when: "conf_name is defined"
vars:
ansible_become: yes
ansible_become_method: sudo
ansible_become_password: "{{ sudo_password }}"
- name: restart nginx
service:
name: nginx
state: restarted
vars:
ansible_become: yes
ansible_become_method: sudo
ansible_become_password: "{{ sudo_password }}"

View File

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

View File

@ -0,0 +1,3 @@
{% for host in virtualhosts %}
{{ host }}
{% endfor %}