Skip to content

Commit

Permalink
zwischencommit - ausbau der mysqlconfig
Browse files Browse the repository at this point in the history
  • Loading branch information
DO1JLR committed Jan 8, 2021
1 parent 93d67f6 commit 343fad1
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 2 deletions.
2 changes: 1 addition & 1 deletion roles/dotfiles
37 changes: 36 additions & 1 deletion roles/mailserver_preperation/templates/mysqlconfig.sql.j2
Original file line number Diff line number Diff line change
@@ -1,4 +1,39 @@
{#- which table are we setting up #}
use vmail;
{#-
setup mailserver domain
#}
insert into domains (domain) values ('{{ mailserver_domain }}');
insert into accounts (username, domain, password, quota, enabled, sendonly) values ('{{ mail_user }}', '{{ domain }}', '{{ mail_user_pass_hash }}', 2048, true, false);
{#-
create all mail users, domains and enter password hashes...
CREATE TABLE `accounts` (
`id` int unsigned NOT NULL AUTO_INCREMENT,
`username` varchar(64) NOT NULL,
`domain` varchar(255) NOT NULL,
`password` varchar(255) NOT NULL,
`quota` int unsigned DEFAULT '0',
`enabled` boolean DEFAULT '0',
`sendonly` boolean DEFAULT '0',
PRIMARY KEY (id),
UNIQUE KEY (`username`, `domain`),
FOREIGN KEY (`domain`) REFERENCES `domains` (`domain`)
);
mailserver_accounts:
- username: 'foo'
domain: 'example.com'
password_hash:
quota: '0'
enabled: true
sendonly: false
#}
{% 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' }});
{% endfor %}
{#-
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);

0 comments on commit 343fad1

Please sign in to comment.