Update to 2020-10-16 00:00

master
Daniel Berteaud 4 years ago
parent d9d4e412a7
commit 03b7fa343a
  1. 12
      roles/mayan_edms/defaults/main.yml
  2. 2
      roles/mayan_edms/meta/main.yml
  3. 1
      roles/mayan_edms/tasks/facts.yml
  4. 1
      roles/mayan_edms/tasks/install.yml
  5. 4
      roles/mayan_edms/templates/env.j2
  6. 4
      roles/mayan_edms/templates/mayan-edms-worker-fast.service.j2
  7. 9
      roles/postgresql_server/tasks/main.yml
  8. 10
      roles/rabbitmq_server/defaults/main.yml
  9. 4
      roles/rabbitmq_server/handlers/main.yml
  10. 6
      roles/rabbitmq_server/tasks/conf.yml
  11. 8
      roles/rabbitmq_server/tasks/install.yml
  12. 8
      roles/rabbitmq_server/tasks/iptables.yml
  13. 7
      roles/rabbitmq_server/tasks/main.yml
  14. 5
      roles/rabbitmq_server/tasks/services.yml
  15. 12
      roles/rabbitmq_server/templates/rabbitmq.config.j2

@ -17,14 +17,14 @@ mayan_db_name: mayanedms
# URL of the redis server to use
mayan_redis_url: redis://{% if redis_pass is defined %}:{{ redis_pass }}{% endif %}127.0.0.1:6379
# Mayan EDMS needs 2 redis DB. Set here the ID
# of the DB you want to use
mayan_redis_db:
result_backend: 0
broker: 1
# ID of the redis DB mayan will use
mayan_redis_db: 0
# URL of the amqp broker
mayan_amqp_url: amqp://127.0.0.1:5672/
# Number of web workers
mayan_web_workers: 2
mayan_web_workers: 3
# Port and list of allowed IP
mayan_port: 8000

@ -13,3 +13,5 @@ dependencies:
- mayan_db_server == '127.0.0.1' or mayan_db_server == 'localhost'
- role: redis_server
when: mayan_redis_url | urlsplit('hostname') == '127.0.0.1' or mayan_redis_url | urlsplit('hostname') == 'localhost'
- role: rabbitmq_server
when: mayan_amqp_url | urlsplit('hostname') == '127.0.0.1' or mayan_amqp_url | urlsplit('hostname') == 'localhost'

@ -27,6 +27,7 @@
- import_tasks: ../includes/get_rand_pass.yml
vars:
- pass_file: "{{ mayan_root_dir }}/meta/ansible_dbpass"
- complex: False
- set_fact: mayan_db_pass={{ rand_pass }}
when: mayan_db_pass is not defined
tags: mayan

@ -25,6 +25,7 @@
- python3-pip
- python3-virtualenv
- python-setuptools
- rabbitmq-server
tags: mayan
- name: Install MySQL support

@ -2,8 +2,8 @@ MAYAN_ALLOWED_HOSTS="['*']"
PYTHONPATH="{{ mayan_root_dir }}/data/mayan_settings"
DJANGO_SETTINGS_MODULE={{ mayan_ldap_auth | ternary('auth','mayan.settings.production') }}
MAYAN_MEDIA_ROOT="{{ mayan_root_dir }}/data"
MAYAN_CELERY_RESULT_BACKEND="{{ mayan_redis_url }}/{{ mayan_redis_db.result_backend }}"
MAYAN_CELERY_BROKER_URL="{{ mayan_redis_url }}/{{ mayan_redis_db.broker }}"
MAYAN_CELERY_RESULT_BACKEND="{{ mayan_redis_url }}/{{ mayan_redis_db }}"
MAYAN_CELERY_BROKER_URL="{{ mayan_amqp_url }}"
MAYAN_DATABASE_ENGINE="django.db.backends.{{ (mayan_db_engine == 'mysql') | ternary('mysql','postgresql') }}"
MAYAN_DATABASE_NAME={{ mayan_db_name | quote }}
MAYAN_DATABASE_PASSWORD={{ mayan_db_pass | quote }}

@ -1,12 +1,12 @@
[Unit]
Description=Mayan EDMS fast celery worker
After=redis.service {{ (pg_version is defined and pg_version != 'default') | ternary('postgresql-' + pg_version | string,'postgresql') }}.service mysql.service mariadb.service
After=redis.service {{ (pg_version is defined and pg_version != 'default') | ternary('postgresql-' + pg_version | string,'postgresql') }}.service mysql.service mariadb.service rabbitmq-server.service
[Service]
User={{ mayan_user }}
WorkingDirectory={{ mayan_root_dir }}/
EnvironmentFile={{ mayan_root_dir }}/config/.env
ExecStart={{ mayan_root_dir }}/venv/bin/celery worker -A mayan -Ofair -l ERROR -Q document_states_fast,converter,sources_fast -n mayan-worker-fast.%%h --concurrency=1
ExecStart={{ mayan_root_dir }}/venv/bin/celery worker -A mayan -Ofair -l ERROR -Q document_states_fast,converter,sources_fast -n mayan-worker-fast.%%h --concurrency={{ ansible_processor_vcpus + 1 }}
Nice=1
PrivateTmp=yes
ProtectSystem=full

@ -8,6 +8,15 @@
gpgcheck: True
gpgkey: https://download.postgresql.org/pub/repos/yum/RPM-GPG-KEY-PGDG-{{ pg_version }}
state: "{{ (pg_version != 'default') | ternary('present','absent') }}"
register: pg_repo
tags: pg,repo
- name: Clear PostgreSQL repo cache
file: path=/var/cache/yum/{{ ansible_architecture }}/{{ ansible_distribution_major_version }}/postgresql/{{ item }} state=absent
loop:
- cachecookie
- repomd.xml
when: pg_repo.changed
tags: pg
- name: Install dependencies

@ -0,0 +1,10 @@
---
# Plain TCP port
rabbitmq_port: 5672
# Access to the plain port
rabbitmq_src_ip: []
# Should the guest user available from anywhere ? If False, it'll only be accepted from loopback
rabbitmq_guest_from_anywhere: False

@ -0,0 +1,4 @@
---
- name: restart rabbitmq-server
service: name=rabbitmq-server state=reloaded

@ -0,0 +1,6 @@
---
- name: Deploy configuration
template: src=rabbitmq.config.j2 dest=/etc/rabbitmq/rabbitmq.config
notify: restart rabbitmq-server
tags: rabbitmq

@ -0,0 +1,8 @@
---
- name: Install RabbitMQ
yum:
name:
- rabbitmq-server
tags: rabbitmq

@ -0,0 +1,8 @@
---
- name: Handle RabbitMQ Server port in the firewall
iptables_raw:
name: rabbitmq_port
state: "{{ (rabbitmq_src_ip | length > 0) | ternary('present','absent') }}"
rules: "-A INPUT -m state --state NEW -p tcp --dport {{ rabbitmq_port }} -s {{ rabbitmq_src_ip | join(',') }} -j ACCEPT"
tags: firewall,rabbitmq

@ -0,0 +1,7 @@
---
- include: install.yml
- include: conf.yml
- include: iptables.yml
when: iptables_manage | default(True)
- include: services.yml

@ -0,0 +1,5 @@
---
- name: Start and enable the service
service: name=rabbitmq-server state=started enabled=True
tags: rabbitmq

@ -0,0 +1,12 @@
%% {{ ansible_managed }}
[
{rabbit, [
{tcp_listeners, [{{ rabbitmq_port }}]}
,{reverse_dns_lookups, false}
{% if rabbitmq_guest_from_anywhere %}
,{loopback_users, []}
{% endif %}
]
}
].
Loading…
Cancel
Save