1
0
Fork 0
mirror of https://github.com/DO1JLR/ansible_playbook_servers.git synced 2024-09-14 19:53:56 +02:00

improve mysql template

This commit is contained in:
L3D 2021-01-09 01:41:21 +01:00
parent 6621bf164e
commit 752fcf1ae9
Signed by: l3d
GPG key ID: CD08445BFF4313D1

View file

@ -42,12 +42,12 @@ insert into domains (domain) values ('{{ mailserver_domain }}');
#}
{% for account in mailserver__accounts %}
{#
INSERT into accounts (username, domain, password, quota, enabled, sendonly) values ('{{ account["username"] }}', '{{ account["domain"] }}', '{{ account["password_hash"] }}', {{ account["quota"]|default(0) | int }}, {{ account["enabled"] | default(true) | | ternary('true', 'false') }} , {{ account["sendonly"] | default(false) | | ternary('true', 'false' }});
INSERT into accounts (username, domain, password, quota, enabled, sendonly) values ('{{ account["username"] }}', '{{ account["domain"] }}', '{{ account["password_hash"] }}', {{ account["quota"]|default(0) | int }}, {{ account["enabled"] | bool |ternary('true', 'false') }} , {{ account["sendonly"] | bool |ternary('true', 'false' }});
#}
REPLACE into accounts
(username, domain, password, quota, enabled, sendonly)
values
('{{ account["username"] }}', '{{ account["domain"] }}', '{{ account["password_hash"] }}', {{ account["quota"]|default(0) | int }}, {{ account["enabled"] | default(true) | | ternary('true', 'false') }} , {{ account["sendonly"] | default(false) | | ternary('true', 'false' }});
('{{ account["username"] }}', '{{ account["domain"] }}', '{{ account["password_hash"] }}', {{ account["quota"]|default(0) | int }}, {{ account["enabled"] | bool | ternary('true', 'false') }} , {{ account["sendonly"] | bool | ternary('true', 'false' )}});
{% endfor %}
{#-
create all mail aliases and stuff like that...
@ -57,16 +57,16 @@ values
INSERT into aliases
(source_username, source_domain, destination_username, destination_domain, enabled)
values
('{{ alias["src_username"] }}', '{{ alias["src_domain"] }}', '{{ alias["dest_username"] }}', '{{ alias["dest_domain"] }}', {{ alias["enabled"] | default(true) | | ternary('true', 'false') }});
('{{ alias["src_username"] }}', '{{ alias["src_domain"] }}', '{{ alias["dest_username"] }}', '{{ alias["dest_domain"] }}', {{ alias["enabled"] | bool | ternary('true', 'false') }});
#}
REPLACE into aliases
(source_username, source_domain, destination_username, destination_domain, enabled)
values
(
{%- if {{ alias["src_username"] }} == 'null' -%}
{%- if alias["src_username"] == 'null' -%}
null
{%- else -%}
'{{ alias["src_username"] }}'
{%- endif -%}
, '{{ alias["src_domain"] }}', '{{ alias["dest_username"] }}', '{{ alias["dest_domain"] }}', {{ alias["enabled"] | default(true) | | ternary('true', 'false') }});
, '{{ alias["src_domain"] }}', '{{ alias["dest_username"] }}', '{{ alias["dest_domain"] }}', {{ alias["enabled"] | bool | ternary('true', 'false') }});
{% endfor %}