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

continue templating

This commit is contained in:
L3D 2021-01-08 23:47:14 +01:00
parent 343fad1b9f
commit 5b84e726fb
Signed by: l3d
GPG key ID: CD08445BFF4313D1
2 changed files with 29 additions and 5 deletions

@ -1 +1 @@
Subproject commit d9d4ce15d8360ed07c698608408b97800dba028c Subproject commit d5f15917d007b0bdad39dfaf20a358f76d222ef7

View file

@ -21,19 +21,43 @@ insert into domains (domain) values ('{{ mailserver_domain }}');
FOREIGN KEY (`domain`) REFERENCES `domains` (`domain`) FOREIGN KEY (`domain`) REFERENCES `domains` (`domain`)
); );
mailserver_accounts: mailserver__accounts:
- username: 'foo' - username: 'alice'
domain: 'example.com' domain: 'example.com'
password_hash: password_hash:
quota: '0' quota: '0'
enabled: true enabled: true
sendonly: false sendonly: false
mailserver__alias:
- src_username: 'bob'
src_domain: 'example.com'
dest_username: 'alice'
dest_domain: 'example.com'
enabled: true
#} #}
{% for account in mailserver__accounts %} {% 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"] | default(true) | | ternary('true', 'false') }} , {{ account["sendonly"] | default(false) | | 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' }});
{% endfor %} {% endfor %}
{#- {#-
create all mail aliases and stuff like that... create all mail aliases and stuff like that...
#} #}
insert into aliases (source_username, source_domain, destination_username, destination_domain, enabled) values ('alias', '{{ domain }}', '{{ mail_user }}', '{{ domain }}', true); {% for alias in mailserver__alias %}
{#
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') }});
#}
REPLACE 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') }});
{% endfor %}