maxhoesel.postfix_nullclient

maxhoesel.postfix_nullclient

=========

This is a simple role designed to install and set up Postfix as a null client, which allows sending emails from your local machine to a remote server. It supports SSL/TLS authentication and can run multiple instances.

Requirements


  • You need a recent version of Ansible. This role works with the two latest major Ansible releases. Older versions may work, but they are not officially supported.
  • The host must be running:
    • Ubuntu 20.04 LTS or newer
    • Debian 11 or newer
    • Other Linux distributions might work, but they aren't officially supported (You can help out by adding support through a pull request!)

Role Variables


Relayhost and Authentication

Name Description Default Required
postfix_relayhost The hostname or IP address for sending emails undefined Yes
postfix_port You can optionally set a port other than the default see below No
postfix_relayhost_auth Set this to yes if you need to log in with a username and password true No
postfix_relayhost_username The username for logging into the relay host undefined Required if postfix_relayhost_auth is true
postfix_relayhost_password The password for logging into the relay host undefined Required if postfix_relayhost_auth is true

Domain Management

Name Description Default Required
postfix_masquerade_domains Shortens subdomains when sending emails for these domains [] No
postfix_sender_canonical Define contents for a sender_canonical_maps file "" No

Port Auto-Selection

This role will automatically choose the correct remote port to use based on how you're connecting:

  • If postfix_tls is false, use Port 25
  • If postfix_tls is true:
    • For SSL/TLS (implicit TLS), use Port 465
    • For STARTTLS (explicit TLS), use Port 587

TLS

Name Description Default Required
postfix_tls Whether to use TLS when connecting to the relay host true No
postfix_tls_mode Choose between implicit (SSL/TLS) or explicit/upgrade (STARTTLS) SSL/TLS No
postfix_tls_verify_cert Whether to verify the remote TLS certificate. Only turn this off if using a self-signed certificate and you know what you're doing true No
postfix_tls_custom_cafile Optionally set a custom CA certificate for the relay host. If not set, it uses the system's default CA cert store "" No

Multi-Instance

Name Description Default Required
postfix_multi_instance_enable Enable support for running multiple instances true No
postfix_multi_instance_list List of Postfix instances as paths to their configuration directories. This takes precedence over postfix_multi_instance_search [] No
postfix_multi_instance_search_path Path to search for Postfix multi-instance directories (all directories that match postfix-*). The postfix_multi_instance_list overrides this "/etc" No

Example Playbook


- hosts: all
  tasks:
    - name: Install postfix
      include_role:
        name: maxhoesel.postfix_nullclient
      vars:
        postfix_relayhost: smtp.gmail.com
        postfix_relayhost_username: [email protected]
        postfix_relayhost_password: your gmail password

License


GPL 3 or later

Author Information


Created and maintained by Max Hösel (@maxhoesel)

Informazioni sul progetto

Configure a simple postfix nullclient

Installa
ansible-galaxy install maxhoesel.postfix_nullclient
Licenza
Unknown
Download
73.5k
Proprietario
Junior Automation and Infrastructure Engineer, Bachelor in CompSci. I write Ansible content and DevOps-related tools, mostly in Rust