92 lines
2.2 KiB
YAML
92 lines
2.2 KiB
YAML
---
|
|
- hosts: http
|
|
gather_facts: true
|
|
become: true
|
|
roles: [common]
|
|
vars:
|
|
playbook_type: install
|
|
tasks:
|
|
- name: Installing required packages
|
|
ansible.builtin.apt: name={{ item }} state=present
|
|
with_items:
|
|
- clamav-daemon
|
|
- clamav-unofficial-sigs
|
|
- ffmpeg
|
|
- git
|
|
- libpq-dev
|
|
- nginx-full
|
|
- postfix # to be able to configure /etc/aliases for cron
|
|
- postgresql-client
|
|
- python3.10
|
|
- python3-pip
|
|
- python3.10-venv
|
|
- vim
|
|
tags:
|
|
- deps
|
|
|
|
- name: Configuring ClamAV
|
|
ansible.builtin.lineinfile:
|
|
path: /etc/clamav/clamd.conf
|
|
regexp: "{{ item.regexp }}"
|
|
line: "{{ item.line }}"
|
|
state: present
|
|
backup: true
|
|
with_items:
|
|
- regexp: ^#*\s*MaxScanSize\s
|
|
line: MaxScanSize 200M
|
|
- regexp: ^#*\s*MaxFileSize\s
|
|
line: MaxFileSize 200M
|
|
- regexp: ^#*\s*PCREMaxFileSize\s
|
|
line: PCREMaxFileSize 200M
|
|
- regexp: ^#*\s*StreamMaxLength\s
|
|
line: StreamMaxLength 200M
|
|
notify:
|
|
- Restart ClamAV daemon
|
|
tags:
|
|
- deps
|
|
- clamav
|
|
|
|
- name: Creating user "{{ user }}:{{ group }}"
|
|
ansible.builtin.user:
|
|
name: "{{ user }}"
|
|
group: "{{ group }}"
|
|
|
|
- import_tasks: common/tasks/add_alias.yaml
|
|
|
|
- name: Creating various directories
|
|
ansible.builtin.file: path={{ item }} state=directory owner={{ user }} group={{ group }} recurse=yes
|
|
with_items:
|
|
- "{{ dir.errors }}"
|
|
- "{{ dir.media }}"
|
|
- "{{ dir.source }}"
|
|
|
|
- import_tasks: tasks/pull.yaml
|
|
|
|
- name: Creating {{ env_file }}
|
|
ansible.builtin.template:
|
|
src: templates/dotenv
|
|
dest: "{{ env_file }}"
|
|
mode: 0644
|
|
backup: true
|
|
tags:
|
|
- dotenv
|
|
|
|
- import_tasks: tasks/configure_uwsgi.yaml
|
|
|
|
- import_tasks: tasks/deploy.yaml
|
|
|
|
- import_tasks: tasks/configure_nginx.yaml
|
|
tags:
|
|
- nginx
|
|
|
|
- import_tasks: tasks/setup_other_services.yaml
|
|
tags:
|
|
- services
|
|
|
|
handlers:
|
|
- name: Restart ClamAV daemon
|
|
ansible.builtin.systemd:
|
|
name: clamav-daemon.service
|
|
state: restarted
|
|
enabled: true
|