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)
{
$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')->everyFiveMinutes();
//$schedule->command('calculate:traffic')->everyFiveMinutes();
}
/**

View file

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

View file

@ -153,6 +153,10 @@
rule: allow
port: '443'
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
ansible.builtin.template:
src: nginx.j2
@ -160,6 +164,8 @@
owner: root
group: root
mode: '0644'
vars:
- ssl: "{{ ssl_result.stat.exists }}"
- name: Create a symbolic link
ansible.builtin.file:
src: /etc/nginx/sites-available/kuvia
@ -192,3 +198,79 @@
state: restarted
daemon_reload: no
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