{"id":39459816,"url":"https://github.com/id-unibe-ch/ansible-role-postfix","last_synced_at":"2026-01-18T04:41:58.108Z","repository":{"id":196061701,"uuid":"630440311","full_name":"id-unibe-ch/ansible-role-postfix","owner":"id-unibe-ch","description":"This ansible role manages the postfix configuration including the alias file","archived":false,"fork":false,"pushed_at":"2025-11-13T15:32:32.000Z","size":85,"stargazers_count":0,"open_issues_count":3,"forks_count":1,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-11-13T16:29:34.530Z","etag":null,"topics":["ansible","ansible-role"],"latest_commit_sha":null,"homepage":null,"language":"Jinja","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/id-unibe-ch.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2023-04-20T11:40:13.000Z","updated_at":"2025-11-03T15:09:48.000Z","dependencies_parsed_at":"2024-10-22T07:39:43.824Z","dependency_job_id":null,"html_url":"https://github.com/id-unibe-ch/ansible-role-postfix","commit_stats":null,"previous_names":["id-unibe-ch/ansible-role-postfix"],"tags_count":9,"template":false,"template_full_name":null,"purl":"pkg:github/id-unibe-ch/ansible-role-postfix","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/id-unibe-ch%2Fansible-role-postfix","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/id-unibe-ch%2Fansible-role-postfix/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/id-unibe-ch%2Fansible-role-postfix/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/id-unibe-ch%2Fansible-role-postfix/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/id-unibe-ch","download_url":"https://codeload.github.com/id-unibe-ch/ansible-role-postfix/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/id-unibe-ch%2Fansible-role-postfix/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28529984,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-18T00:39:45.795Z","status":"online","status_checked_at":"2026-01-18T02:00:07.578Z","response_time":98,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ansible","ansible-role"],"created_at":"2026-01-18T04:41:58.036Z","updated_at":"2026-01-18T04:41:58.092Z","avatar_url":"https://github.com/id-unibe-ch.png","language":"Jinja","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Ansible Role: Postfix\n\nAn Ansible role that manages Postfix. Currently the role has the following\nfeatures:\n\n* Install Postfix\n* Manage config settings in `/etc/postfix/main.cf`, see\n  [role variables](#role-variables)\n* Manage the file-base alias db `/etc/alias`.\n* Completely uninstall Postfix\n\n## Requirements\n\nNo prerequisites necessary at the moment.\n\n## Role Variables\n\nAvailable variables are listed below, along with default values (see also `defaults/main.yml`):\n\nVariables of the form `$varname` are literally transported to the config file as\nPostfix is internally interpolating these on service startup. In other words,\ntechnically, setting an `postfix_myorigin` to \"$nyhostname\" has the very same outcome\nas setting it to `\"{{ ansible_fqdn }}\"`.\n\n### postfix_myhostname\n\n    postfix_myhostname: \"{{ ansible_fqdn }}\"\n\nThe `myhostname` parameter specifies the internet hostname of this mail system.\nThe default is to use the fully-qualified domain name\n\n### postfix_mydomain\n\n    postfix_mydomain: \"undef\"\n\nThe `mydomain` parameter specifies the local internet domain name. The default\nis \"undef\" that meas Postfix will compute the value based on its defaults, which\nresults in $myhostname minus the first component.\n\n### postfix_myorigin\n\n    postfix_myorigin: \"undef\"\n\nThe `myorigin` parameter specifies the domain that locally-posted mail appears to\ncome from. The default is to append $myhostname, which is fine for small\nsites.\n\n### postfix_mydestination\n\n    postfix_mydestination: \"$myhostname, localhost.$mydomain, localhost\"\n\nThe `mydestination` parameter specifies the list of domains that this machine\nconsiders itself the final destination for.  \nThe default is \\$myhostname + localhost.$mydomain + localhost.  On a mail domain\ngateway, you should also include $mydomain.\n\n### postfix_inet_interfaces\n\n    postfix_inet_interfaces: all\n\nThe `inet_interfaces` parameter specifies the network interfaces addresses that\nthis mail system receives mail on. The default is to listen on `all`. You can\nspecify more than one address by comma separating them. Set to `loopback-only`\nto listen only to localhost or to a comma-separated list of IP addresses. See\n[postconf manpage](https://www.postfix.org/postconf.5.html#inet_interfaces) for\nthe details about this option.\n\n### postfix_inet_protocols\n\n    postfix_inet_protocols: all\n\nThis parameter specifies the internet protocols to support. The default is\n`all`, which means IPv4, and IPv6 if supported. See [postconf\nmanpage](https://www.postfix.org/postconf.5.html#inet_protocols) manpage for the\ndetails about this option.\n\n### postfix_relayhost\n\n    postfix_relayhost: undef\n\nThe relayhost parameter specifies the default host to send mail to. Specify a\ndomain, host, host:port, [host]:port, [address] or [address]:port; the form\n[host] turns off MX lookups. Examples:\n\n    # Set to $mydomain =\u003e mail will be sent to the smtp found in the MX entry of\n    $mydomain\n    postfix_relayhost = $mydomain\n\n    # No MX lookup is done, all mails are sent the given MTA\n    postfix_relayhost = [gateway.my.domain]\n\n    # Same as above, MTA set by IP address\n    postfix_relayhost = [an.ip.add.ress]\n\n    postfix_state: started\n\n### Manipulating Postfix Lookup Maps\n\n#### Alias Map\n\n    postfix_alias_map: {}\n\nThis allows manipulations of the `hash:/etc/alises` map. The default is not to edit\nthis file in any way. Use this to forward local mails to external addresses,\nwhich is useful for mails to the local root account.\n\nExamples:\n\n    postfix_alias_map:\n      www: \"user1@test.com\"\n      root: [\"user2@test.com\", \"user3@example.com\"]\n\nUse the local account you want to forward mails for as the key and either a\nstring or list of strings for the mail addresses to forward these mails to. In\nthe above example, mails to root are forwarded to two external addresses instead.\n\n#### sender_canonical map\n\n##### hash type map\n\n    postfix_sender_canonicals: []\n\nThis allows setting sender canonical addresses in the database\n`hash:/etc/postfix/sender_canonical` in order to rewrite sender addresses to be\nsure bounces can be routed back to valid address.\nThis can be used to rewrite local accounts:\n\nExamples:\n\n    postfix_sender_canonicals:\n      - root: existing.user@example.com\n\nBy adding mappings here the hash map is automatically added to the\nsender_canonical_map configuration option of Postfix.\n\n##### ldap type map\n\n    postfix_ldap_sender_canonincal_config: {}\n\nThis config dictionary allows to configure lookups of sender_canonicals stored\nin an LDAP directory. Use configuration parameters as described in the official\ndocumentation on [that topic](https://www.postfix.org/ldap_table.5.html). An\nexample using two LDAP servers as a failover setup and transport encryption\nmight look as follows:\n\n    postfix_ldap_sender_canonincal_config:\n      server_host: \"ldap://ldap01.mycompany.com ldap://ldap02.mycompany.com\"\n      start_tls: \"yes\"\n      version: \"3\"\n      bind: \"no\"\n      search_base: \"ou=users,dc=mycompany,dc=com\"\n      query_filter: \"(uid=%s)\"\n      result_attribute: \"mail\"\n\nBy adding a configuration here the ldap map is automatically added to the\nsender_canonical_map configuration option of Postfix.\n\n#### recipient_canonical map\n\n##### hash type map\n\n    postfix_recipient_canonicals: []\n\nThis allows setting recipient canonical addresses in the database\n`hash:/etc/postfix/recipient_canonical` in order to rewrite recipient addresses to be\nsure bounces can be routed back to valid address.\nThis can be used to rewrite local accounts:\n\nExamples:\n\n    postfix_recipient_canonicals:\n      - root: existing.user@example.com\n\nBy adding mappings here the hash map is automatically added to the\nrecipient_canonical_map configuration option of Postfix.\n\n##### ldap type map\n\n    postfix_ldap_recipient_canonincal_config: {}\n\nThis config dictionary allows to configure lookups of recipient_canonicals stored\nin an LDAP directory. Use configuration parameters as described in the official\ndocumentation on [that topic](https://www.postfix.org/ldap_table.5.html). An\nexample using two LDAP servers as a failover setup and transport encryption\nmight look as follows:\n\n    postfix_ldap_recipient_canonincal_config:\n      server_host: \"ldap://ldap01.mycompany.com ldap://ldap02.mycompany.com\"\n      start_tls: \"yes\"\n      version: \"3\"\n      bind: \"no\"\n      search_base: \"ou=users,dc=mycompany,dc=com\"\n      query_filter: \"(uid=%s)\"\n      result_attribute: \"mail\"\n\nBy adding a configuration here the ldap map is automatically added to the\nrecipient_canonical_map configuration option of Postfix.\n\n### Configuring Package and Service State\n\n    postfix_enabled: true\n\nThis sets the boot time status of the Postfix daemon. Should remain to `true`\nunless the daemon shouldn't be automatically started at boot time.\n\n    postfix_state: started\n\nSet the initial state of the postfix daemon when this role is run. This should\ngenerally remain `started`. There occasions where setting this to `stopped`\nmight come in handy, i.e. during a maintenance down. In combination with the\n`postfix_packages_state` this also allows to purge Postfix from a system.\n\n    postfix_restart_state: restarted\n\nThis determines the measure that is taken when the `postfix` handlers\ncalled. The default is to restart the Postfix process, when the handlers kicks\nin. Can be set to `reloaded` to only reload the Postfix process.\n\n    postfix_packages_state: present\n\nThe state of the Postfix installation packages. Defaults to `present` to make\nsure it's installed. Can also be set to `latest` if Postfix should get removed\nfrom the machine or prior switching repo or the like.\n\n## Dependencies\n\nThis role has no dependencies to other roles.\n\n## Example Playbook\n\nIncluding an example of how to use your role (for instance, with variables\npassed in as parameters) is always nice for users too:\n\n    - hosts: servers\n\n      roles:\n         - unibeid.postfix\n\n\u003c!-- add an example which illustrates a standard usage internally? --\u003e\n\nThe following example illustrates how to remove Postfix from the systems again:\n\n    - hosts: servers\n\n      roles:\n        - role: unibeid.postfix\n          vars:\n            postfix_service_state: stopped\n            postfix_packages_state: absent\n\n**Note:** Removing Postfix from the system will also purge any configuration in\n`/etc/postfix`. If you want to preserve it, make a backup before applying the\nabove play.\n\n## Compatibility\n\nThis role has been written for and tested on and is therefore compatible with:\n\n* CentOS-7\n* Rocky-8, Rocky-9\n* Ubuntu-20.04, Ubuntu-22.04, Ubuntu-24.04\n\n## License\n\nMIT\n\n## Author Information\n\nThe role was created in 2023 by the IT-Services Office of the University of Bern\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fid-unibe-ch%2Fansible-role-postfix","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fid-unibe-ch%2Fansible-role-postfix","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fid-unibe-ch%2Fansible-role-postfix/lists"}