第 10 章 系统角色中的 postfix 角色的变量
postfix
角色变量允许用户安装、配置和启动 postfix
邮件传输代理 (MTA)。
本节中定义了以下角色变量:
-
postfix_conf
:它包含所有支持的postfix
配置参数的键/值对。默认情况下,postfix_conf
没有值。
postfix_conf: relayhost: example.com
postfix_conf:
relayhost: example.com
如果您的场景需要删除任何现有配置并在干净 postfix
安装之上应用所需的配置,请在 postfix_conf
字典中指定 previous: replaced
选项:
带有 previous: replaced
选项的示例:
postfix_conf: relayhost: example.com previous: replaced
postfix_conf:
relayhost: example.com
previous: replaced
-
postfix_check
:它会确定在启动postfix
前是否执行了检查以验证配置更改。默认值为 true。
例如:
postfix_check: true
postfix_check: true
-
postfix_backup
:它决定是否已创建了配置的一个备份副本。默认情况下,postfix_backup
值为 false。
要覆盖以前的备份,请运行以下命令:
*cp /etc/postfix/main.cf /etc/postfix/main.cf.backup*
# *cp /etc/postfix/main.cf /etc/postfix/main.cf.backup*
如果 postfix_backup
值更改为 true
,则还必须将 postfix_backup_multiple
值设为 false。
例如:
postfix_backup: true postfix_backup_multiple: false
postfix_backup: true
postfix_backup_multiple: false
-
postfix_backup_multiple
:它决定角色是否生成配置的时间戳备份副本。
要保留多个备份副本,请运行以下命令:
*cp /etc/postfix/main.cf /etc/postfix/main.cf.$(date -Isec)*
# *cp /etc/postfix/main.cf /etc/postfix/main.cf.$(date -Isec)*
默认情况下,postfix _backup_multiple
的值为 true。postfix_backup_multiple:true
设置将覆盖 postfix_backup
。如果要使用 postfix_backup
,您必须设置 postfix_backup_multiple:false
。
-
postfix_manage_firewall
:将postfix
角色与firewall
角色集成,以管理端口访问。默认情况下,变量设为false
。如果要从postfix
角色自动管理端口访问,请将变量设置为true
。 -
postfix_manage_selinux
:将postfix
角色与selinux
角色集成,以管理端口访问。默认情况下,变量设为false
。如果要从postfix
角色自动管理端口访问,请将变量设置为true
。
重要
不能删除配置参数。在运行 postfix
角色之前,请将 postfix_conf
设置为所有必需的配置参数,并使用 file 模块删除 /etc/postfix/main.cf
。