This commit is contained in:
Kekskurse 2021-01-18 00:34:34 +01:00
parent 58f3cebc0c
commit e2ac53e627
3 changed files with 89 additions and 3 deletions

View file

@ -29,9 +29,9 @@ class Kernel extends ConsoleKernel
*/ */
protected function schedule(Schedule $schedule) protected function schedule(Schedule $schedule)
{ {
$schedule->command('calculate:space')->hourlyAt(10)->withoutOverlapping(); //$schedule->command('calculate:space')->hourlyAt(10)->withoutOverlapping();
//$schedule->command('calculate:traffic')->hourlyAt(10)->withoutOverlapping(); //$schedule->command('calculate:traffic')->hourlyAt(10)->withoutOverlapping();
$schedule->command('calculate:traffic')->everyFiveMinutes(); //$schedule->command('calculate:traffic')->everyFiveMinutes();
} }
/** /**

View file

@ -1,9 +1,13 @@
all: all:
children: children:
pweb:
hosts:
www1.fra.kuvia.cloud:
http_domain: www.kuvia.cloud
web: web:
hosts: hosts:
www1.fra.kuvia.cloud: www1.fra.kuvia.cloud:
domain: www1.fra.kuvia.cloud www.kuvia.cloud kuvia.cloud domain: www1.fra.kuvia.cloud
mysql: mysql:
hosts: hosts:

View file

@ -153,6 +153,10 @@
rule: allow rule: allow
port: '443' port: '443'
proto: tcp proto: tcp
- name: Check if certificat exists
stat:
path: "/etc/letsencrypt/live/{{domain}}/privkey.pem"
register: ssl_result
- name: Template a file to /etc/file.conf - name: Template a file to /etc/file.conf
ansible.builtin.template: ansible.builtin.template:
src: nginx.j2 src: nginx.j2
@ -160,6 +164,8 @@
owner: root owner: root
group: root group: root
mode: '0644' mode: '0644'
vars:
- ssl: "{{ ssl_result.stat.exists }}"
- name: Create a symbolic link - name: Create a symbolic link
ansible.builtin.file: ansible.builtin.file:
src: /etc/nginx/sites-available/kuvia src: /etc/nginx/sites-available/kuvia
@ -192,3 +198,79 @@
state: restarted state: restarted
daemon_reload: no daemon_reload: no
name: php7.4-fpm name: php7.4-fpm
- name: Install certbot
apt:
name: certbot
state: present
- name: Install python3-certbot-nginx
apt:
name: python3-certbot-nginx
state: present
- name: Cert bot
ansible.builtin.shell: "certbot --nginx -d {{domain}} -n --agree-tos -m hello@kekskurse.de"
when: not ssl_result.stat.exists
- name: Template a file to /etc/file.conf
ansible.builtin.template:
src: nginx.j2
dest: /etc/nginx/sites-available/kuvia_main
owner: root
group: root
mode: '0644'
vars:
- ssl: "{{ ssl_result.stat.exists }}"
- name: Restart nginx
ansible.builtin.systemd:
state: restarted
daemon_reload: no
name: nginx
- hosts: pweb
tasks:
- name: Domain
ansible.builtin.debug:
msg: "Domain: {{http_domain}}"
- name: Check if certificat exists
stat:
path: "/etc/letsencrypt/live/{{http_domain}}/privkey.pem"
register: ssl_result
- name: Template a file to /etc/file.conf
ansible.builtin.template:
src: nginx.j2
dest: /etc/nginx/sites-available/kuvia_main
owner: root
group: root
mode: '0644'
vars:
- ssl: "{{ ssl_result.stat.exists }}"
- domain: "{{ http_domain }}"
- name: Create a symbolic link
ansible.builtin.file:
src: /etc/nginx/sites-available/kuvia_main
dest: /etc/nginx/sites-enabled/kuvia_main
state: link
- name: Restart nginx
ansible.builtin.systemd:
state: restarted
daemon_reload: no
name: nginx
- name: Cert bot
ansible.builtin.shell: "certbot --nginx -d {{http_domain}} -n --agree-tos -m hello@kekskurse.de"
when: not ssl_result.stat.exists
- name: Check if certificat exists
stat:
path: "/etc/letsencrypt/live/{{http_domain}}/privkey.pem"
register: ssl_result
- name: Template a file to /etc/file.conf
ansible.builtin.template:
src: nginx.j2
dest: /etc/nginx/sites-available/kuvia_main
owner: root
group: root
mode: '0644'
vars:
- ssl: "{{ ssl_result.stat.exists }}"
- domain: "{{ http_domain }}"
- name: Restart nginx
ansible.builtin.systemd:
state: restarted
daemon_reload: no
name: nginx