1
0
Fork 0
mirror of https://github.com/roles-ansible/ansible_role_rspamd.git synced 2024-08-16 17:09:51 +02:00

make this role idempotent with lots of magic

This commit is contained in:
L3D 2021-01-25 01:21:38 +01:00
parent c4848bcaa3
commit 5920e18555
Signed by: l3d
GPG key ID: CD08445BFF4313D1
3 changed files with 19 additions and 12 deletions

View file

@ -1,5 +1,7 @@
--- ---
- name: Einstellung des Worker controllers - name: rspamd password generation
block:
- name: configure rspamd password
become: true become: true
ansible.builtin.template: ansible.builtin.template:
src: templates/worker-controller.inc.j2 src: templates/worker-controller.inc.j2
@ -8,6 +10,10 @@
owner: "{{ rspamd__default_owner }}" owner: "{{ rspamd__default_owner }}"
group: "{{ rspamd__default_group }}" group: "{{ rspamd__default_group }}"
notify: systemctl restart rspamd notify: systemctl restart rspamd
rescue:
- name: you have to install passlib
fail:
msg: 'I caught an error. Maybe you have to install passlib via pip3'
- name: Einstellung des logging - name: Einstellung des logging
become: true become: true

View file

@ -1 +1 @@
password = "{{ _rspamd__admin_password }}" password = "{{ rspamd__admin_password_with_salt }}"

View file

@ -1,6 +1,7 @@
--- ---
# versionscheck # versionscheck
playbook_version_number: 6 # should be a integer playbook_version_number: 7 # should be a integer
playbook_version_path: 'do1jlr.rspamd.version' playbook_version_path: 'do1jlr.rspamd.version'
_rspamd__admin_password: "{{ rspamd__admin_password | password_hash('bcrypt') }}" # https://github.com/ansible/ansible/issues/36129
rspamd__admin_password_with_salt: "{{ rspamd__admin_password | password_hash('bcrypt', ('abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890' | shuffle(seed=inventory_hostname) | join)[:21] + ('Oeu' | shuffle(seed=inventory_hostname) | join)[1], rounds=9) }}"