templatizing virtualhost getinfo_day
This commit is contained in:
@@ -1 +0,0 @@
|
||||
clarissa
|
147
roles/deploy-web/tasks/stats.yml
Normal file
147
roles/deploy-web/tasks/stats.yml
Normal 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 }}"
|
@@ -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)
|
3
roles/deploy-web/templates/virtualhost.j2
Normal file
3
roles/deploy-web/templates/virtualhost.j2
Normal file
@@ -0,0 +1,3 @@
|
||||
{% for host in virtualhosts %}
|
||||
{{ host }}
|
||||
{% endfor %}
|
Reference in New Issue
Block a user