1
0
forked from infra/ansible
infra/roles/zammad/tasks/main.yml

58 lines
2.0 KiB
YAML
Raw Normal View History

2024-01-08 20:08:25 +01:00
---
- name: Enable elasic apt-key
apt_key: url="https://artifacts.elastic.co/GPG-KEY-elasticsearch" keyring="/etc/apt/trusted.gpg.d/elastic.gpg"
- name: Enable elastic repository
apt_repository: repo="deb https://artifacts.elastic.co/packages/7.x/apt stable main"
- name: Install elasticsearch
apt: name=elasticsearch
register: elasticsearch_install
- name: Install attachment plugin
command: /usr/share/elasticsearch/bin/elasticsearch-plugin install ingest-attachment --batch
when: elasticsearch_install.changed
- name: Start the elasticsearch service
service: name=elasticsearch state=started enabled=yes
- name: Enable zammad apt-key
apt_key: url="https://dl.packager.io/srv/zammad/zammad/key" keyring="/etc/apt/trusted.gpg.d/zammad.gpg"
- name: Enable zammad repository
apt_repository: repo="deb https://dl.packager.io/srv/deb/zammad/zammad/stable/debian 12 main"
- name: Install zammad
apt: name=zammad
register: zammad_install
- name: Configure zammad for ES
command: zammad run rails r "Setting.set('es_url', 'http://localhost:9200')"
when: zammad_install.changed
- name: Build search index
command: zammad run rake zammad:searchindex:rebuild
when: zammad_install.changed
- name: Ensure certificates are available
command: openssl req -x509 -nodes -newkey rsa:2048 -keyout /etc/nginx/ssl/{{ zammad_domain }}.key -out /etc/nginx/ssl/{{ zammad_domain }}.crt -days 730 -subj "/CN={{ zammad_domain }}" creates=/etc/nginx/ssl/{{ zammad_domain }}.crt
notify: Restart nginx
- name: Configure certificate manager for zammad
template: src=certs.j2 dest=/etc/acertmgr/{{ zammad_domain }}.conf
notify: Run acertmgr
- name: Configure vhost
template: src=vhost.j2 dest=/etc/nginx/sites-available/zammad
notify: Restart nginx
- name: Enable vhost
file: src=/etc/nginx/sites-available/zammad dest=/etc/nginx/sites-enabled/zammad state=link
notify: Restart nginx
- name: Enable monitoring
include_role: name=icinga-monitor tasks_from=http
vars:
vhost: "{{ zammad_domain }}"