2021-11-14 10:19:29 -06:00
2021-11-14 11:33:13 -06:00
2021-11-14 10:19:29 -06:00
2021-11-14 11:33:13 -06:00
2021-11-14 10:19:29 -06:00
2021-11-14 16:02:42 +00:00
2021-11-14 10:19:29 -06:00
2021-11-14 16:02:42 +00:00
2021-12-05 11:54:39 -06:00

Role Name

A brief description of the role goes here.

Requirements

Create database for MySQL/MariaDB with :

CREATE DATABASE IF NOT EXISTS `mailserver` DEFAULT CHARACTER SET utf8mb4;
USE `mailserver`;

CREATE TABLE IF NOT EXISTS `virtual_domains` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(255) NOT NULL,
  PRIMARY KEY (`id`)
) DEFAULT CHARSET=utf8mb4 CHECKSUM=1;

CREATE TABLE IF NOT EXISTS `virtual_aliases` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `domain_id` int(11) NOT NULL,
  `source` varchar(255) NOT NULL,
  `destination` varchar(255) NOT NULL,
  PRIMARY KEY (`id`),
  KEY `domain_id` (`domain_id`),
  CONSTRAINT `virtual_aliases_ibfk_1` FOREIGN KEY (`domain_id`) REFERENCES `virtual_domains` (`id`) ON DELETE CASCADE
) DEFAULT CHARSET=utf8mb4 CHECKSUM=1;

CREATE TABLE IF NOT EXISTS `virtual_users` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `domain_id` int(11) NOT NULL,
  `password` varchar(106) NOT NULL,
  `email` varchar(255) NOT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `email` (`email`),
  KEY `domain_id` (`domain_id`),
  CONSTRAINT `virtual_users_ibfk_1` FOREIGN KEY (`domain_id`) REFERENCES `virtual_domains` (`id`) ON DELETE CASCADE
) DEFAULT CHARSET=utf8mb4 CHECKSUM=1;

Create an account to access MySQL/MariaDB with :

GRANT SELECT ON mailserver.* TO 'mailserver'@'%' IDENTIFIED BY 'changeme';
FLUSH PRIVLEGES;

New users created via the following SQL :

INSERT INTO `virtual_domains`
  (`name`)
VALUES
  ('example.com');

SELECT *
FROM `virtual_domains`
WHERE `name`='example.com';

INSERT INTO `virtual_users`
  (`domain_id`, `password`, `email`)
VALUES
  ('1', ENCRYPT('changeme', CONCAT('$6$', SUBSTRING(SHA(RAND()), -16))), 'webmaster@example.com');

In the above example, the MySQL/MariaDB ENCRYPT() function calls the OS crypt(3) function. The above uses a random 16 character SALT to encrypt, and selects the SHA-512 crypt method. Other available crypt methods are as follows :

ID Method
1 MD5
5 SHA-256 (glibc >= 2.7)
6 SHA-512 (glibc >= 2.7)

Role Variables

Variable Default Description
dovecot_mysql_server undefined Server to connect to
dovecot_mysql_database undefined Database with MySQL to use
dovecot_mysql_username undefined Username with read only rights
dovecot_mysql_password undefined Password for read only user

Dependencies

A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles.

Example Playbook

Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too:

- hosts: servers
  roles:
     - { role: username.rolename, x: 42 }

License

BSD

Author Information

An optional section for the role authors to include contact information, or a website (HTML is not allowed).

Description
No description provided
Readme 105 KiB
Languages
desktop 100%