maxhoesel.postfix_nullclient

maxhoesel.postfix_nullclient

这是一个非常简约的角色,用于安装和配置Postfix作为一个无客户端(从本地主机发送邮件到远程服务器)。 支持SSL/TLS认证和多实例操作作为主实例。

要求

  • 需要使用较新的Ansible版本。该角色支持最近的两个主版本。 旧版本可能仍然有效,但不再支持。
  • 运行以下操作系统的主机:
    • Ubuntu 20.04 LTS或更新版本
    • Debian 11或更新版本
    • 其他发行版可能有效,但不再支持(欢迎通过提交PR添加支持!)

角色变量

中继主机和认证

名称 描述 默认值 是否必需
postfix_relayhost 发送邮件的主机名或IP地址 未定义
postfix_port 可选择性地覆盖自动选择的端口 见下文
postfix_relayhost_auth 如果需要用用户名和密码登录,设置为是 true
postfix_relayhost_username 用于在中继主机登录的用户名 未定义 如果postfix_relayhost_authtrue
postfix_relayhost_password 用于在中继主机登录的密码 未定义 如果postfix_relayhost_authtrue

域管理

名称 描述 默认值 是否必需
postfix_masquerade_domains 发送这些域的邮件时截断子域 []
postfix_sender_canonical 将这些内容写入sender_canonical_maps文件 ""

端口自动选择

该角色将根据使用的连接方式自动设置远程连接端口:

  • 如果postfix_tlsfalse => 端口25
  • 如果postfix_tlstruepostfix_tls_mode是:
    • SSL/TLS(隐式TLS) => 端口465
    • STARTTLS(显式TLS) => 端口587

TLS

名称 描述 默认值 是否必需
postfix_tls 连接到中继主机时是否使用TLS true
postfix_tls_mode 是否使用隐式(SSL/TLS)或显式/升级(STARTTLS)TLS连接。 SSL/TLS
postfix_tls_verify_cert 是否验证远程TLS证书。只有在使用自签名证书且知道自己在做什么时才能关闭此选项 true
postfix_tls_custom_cafile 可选择性地为Postfix提供自定义CA证书。如果未设置,将使用系统默认的CA证书存储 ""

多实例

名称 描述 默认值 是否必需
postfix_multi_instance_enable 是否启用多实例操作支持 true
postfix_multi_instance_list Postfix实例的配置目录路径列表。覆盖postfix_multi_instance_search []
postfix_multi_instance_search_path 在该路径中搜索Postfix多实例目录(所有匹配postfix-*的目录)。postfix_multi_instance_list会覆盖此值 "/etc"

示例剧本

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

许可证

GPL 3或更高版本

作者信息

由Max Hösel(@maxhoesel)创建和维护

关于项目

Configure a simple postfix nullclient

安装
ansible-galaxy install maxhoesel.postfix_nullclient
许可证
Unknown
下载
73.5k
拥有者
Junior Automation and Infrastructure Engineer, Bachelor in CompSci. I write Ansible content and DevOps-related tools, mostly in Rust