Compare commits
No commits in common. "main" and "v2.0.0" have entirely different histories.
11 changed files with 107 additions and 159 deletions
.forgejo/workflows
.gitlab-ci.yml.yamllintCHANGELOG.mdREADME.mddefaults
handlers
meta
molecule/default
tasks
|
@ -1,18 +0,0 @@
|
||||||
---
|
|
||||||
on: ["push"]
|
|
||||||
jobs:
|
|
||||||
lint:
|
|
||||||
runs-on: "docker"
|
|
||||||
container:
|
|
||||||
image: "code.waks.be/nishiki/molecule:docker"
|
|
||||||
steps:
|
|
||||||
- uses: "actions/checkout@v3"
|
|
||||||
- run: "ansible-lint ."
|
|
||||||
- run: "yamllint ."
|
|
||||||
molecule:
|
|
||||||
runs-on: "docker"
|
|
||||||
container:
|
|
||||||
image: "code.waks.be/nishiki/molecule:docker"
|
|
||||||
steps:
|
|
||||||
- uses: "actions/checkout@v3"
|
|
||||||
- run: "molecule test"
|
|
|
@ -1,10 +0,0 @@
|
||||||
---
|
|
||||||
image: "nishiki/molecule:docker"
|
|
||||||
|
|
||||||
before_script:
|
|
||||||
- "molecule --version"
|
|
||||||
|
|
||||||
molecule:
|
|
||||||
stage: "test"
|
|
||||||
script:
|
|
||||||
- "molecule test"
|
|
16
.yamllint
16
.yamllint
|
@ -1,22 +1,12 @@
|
||||||
---
|
---
|
||||||
extends: "default"
|
extends: default
|
||||||
|
|
||||||
ignore: |
|
ignore: |
|
||||||
|
.kitchen/*
|
||||||
vendor/
|
vendor/
|
||||||
|
|
||||||
rules:
|
rules:
|
||||||
line-length:
|
line-length:
|
||||||
max: 120
|
max: 120
|
||||||
level: "warning"
|
level: warning
|
||||||
truthy: false
|
truthy: false
|
||||||
comments:
|
|
||||||
min-spaces-from-content: 1
|
|
||||||
comments-indentation: false
|
|
||||||
braces:
|
|
||||||
max-spaces-inside: 1
|
|
||||||
octal-values:
|
|
||||||
forbid-implicit-octal: true
|
|
||||||
forbid-explicit-octal: true
|
|
||||||
quoted-strings:
|
|
||||||
quote-type: "double"
|
|
||||||
required: true
|
|
||||||
|
|
16
CHANGELOG.md
16
CHANGELOG.md
|
@ -5,20 +5,6 @@ Which is based on [Keep A Changelog](http://keepachangelog.com/)
|
||||||
|
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
|
|
||||||
## v2.1.0 - 2025-05-26
|
|
||||||
|
|
||||||
### Added
|
|
||||||
|
|
||||||
- test: add support debian 13
|
|
||||||
|
|
||||||
### Changed
|
|
||||||
|
|
||||||
- test: use personal docker registry
|
|
||||||
|
|
||||||
### Removed
|
|
||||||
|
|
||||||
- test: remove support debian 11
|
|
||||||
|
|
||||||
## v2.0.0 - 2021-08-20
|
## v2.0.0 - 2021-08-20
|
||||||
|
|
||||||
### Breaked
|
### Breaked
|
||||||
|
@ -27,7 +13,7 @@ Which is based on [Keep A Changelog](http://keepachangelog.com/)
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
||||||
- test: add support debian 10 and 11
|
- test: add suport debian 10 and 11
|
||||||
- feat: add bsd-mailx package
|
- feat: add bsd-mailx package
|
||||||
- feat: add transport map
|
- feat: add transport map
|
||||||
- feat: add aliases
|
- feat: add aliases
|
||||||
|
|
37
README.md
37
README.md
|
@ -1,21 +1,20 @@
|
||||||
# Ansible role: Postfix MTA
|
# Ansible role: Postfix MTA
|
||||||
|
|
||||||
[](https://code.waks.be/nishiki/ansible-role-postfix_mta/releases)
|
[](https://git.yaegashi.fr/nishiki/ansible-role-postfix_mta/releases)
|
||||||
[](https://code.waks.be/nishiki/ansible-role-postfix_mta/src/branch/main/LICENSE)
|
[](https://git.yaegashi.fr/nishiki/ansible-role-postfix_mta/src/branch/master/LICENSE)
|
||||||
[](https://code.waks.be/nishiki/ansible-role-postfix_mta/actions?workflow=molecule.yml)
|
|
||||||
|
|
||||||
Install and configure an simple mta with postfix
|
Install and configure an simple mta with postfix
|
||||||
|
|
||||||
## Requirements
|
## Requirements
|
||||||
|
|
||||||
- Ansible >= 2.9
|
* Ansible >= 2.9
|
||||||
- Debian
|
* Debian
|
||||||
- Bookworm
|
* Buster
|
||||||
- Trixie
|
* Bullseye
|
||||||
|
|
||||||
## Role variables
|
## Role variables
|
||||||
|
|
||||||
- `postfix_config` - hash with config
|
* `postfix_config` - hash with config
|
||||||
|
|
||||||
```
|
```
|
||||||
smtpd_banner: $myhostname ESMTP $mail_name (Debian/GNU)
|
smtpd_banner: $myhostname ESMTP $mail_name (Debian/GNU)
|
||||||
|
@ -34,13 +33,13 @@ Install and configure an simple mta with postfix
|
||||||
inet_protocols: all
|
inet_protocols: all
|
||||||
```
|
```
|
||||||
|
|
||||||
- `postfix_transports` - hash with the transport configuration
|
* `postfix_transports` - hash with the transport configuration
|
||||||
|
|
||||||
```
|
```
|
||||||
google.com: smtp:127.0.0.1
|
google.com: smtp:127.0.0.1
|
||||||
```
|
```
|
||||||
|
|
||||||
- `postfix_aliases` - hash with the aliases
|
* `postfix_aliases` - hash with the aliases
|
||||||
|
|
||||||
```
|
```
|
||||||
root:
|
root:
|
||||||
|
@ -61,18 +60,18 @@ Install and configure an simple mta with postfix
|
||||||
|
|
||||||
### Test with molecule and docker
|
### Test with molecule and docker
|
||||||
|
|
||||||
- install [docker](https://docs.docker.com/engine/installation/)
|
* install [docker](https://docs.docker.com/engine/installation/)
|
||||||
- install `python3` and `python3-pip`
|
* install `python3` and `python3-pip`
|
||||||
- install molecule and dependencies `pip3 install molecule molecule-docker docker ansible-lint pytest-testinfra yamllint`
|
* install molecule and dependencies `pip3 install molecule molecule-docker docker ansible-lint pytest-testinfra yamllint`
|
||||||
- run `molecule test`
|
* run `molecule test`
|
||||||
|
|
||||||
### Tests with docker
|
### Tests with docker
|
||||||
|
|
||||||
- install [docker](https://docs.docker.com/engine/installation/)
|
* install [docker](https://docs.docker.com/engine/installation/)
|
||||||
- install ruby
|
* install ruby
|
||||||
- install bundler `gem install bundler`
|
* install bundler `gem install bundler`
|
||||||
- install dependencies `bundle install`
|
* install dependencies `bundle install`
|
||||||
- run the tests `kitchen test`
|
* run the tests `kitchen test`
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
|
|
|
@ -1,22 +1,22 @@
|
||||||
---
|
---
|
||||||
postfix_hostname: "{{ ansible_fqdn }}"
|
postfix_hostname: '{{ ansible_fqdn }}'
|
||||||
postfix_origin: "$myhostname"
|
postfix_origin: '$myhostname'
|
||||||
postfix_config: {}
|
postfix_config: {}
|
||||||
postfix_default_config:
|
postfix_default_config:
|
||||||
smtpd_banner: "$myhostname ESMTP $mail_name (Debian/GNU)"
|
smtpd_banner: $myhostname ESMTP $mail_name (Debian/GNU)
|
||||||
biff: "no"
|
biff: 'no'
|
||||||
append_dot_mydomain: "no"
|
append_dot_mydomain: 'no'
|
||||||
readme_directory: "no"
|
readme_directory: 'no'
|
||||||
compatibility_level: 2
|
compatibility_level: 2
|
||||||
myhostname: "{{ ansible_fqdn }}"
|
myhostname: '{{ ansible_fqdn }}'
|
||||||
myorigin: "$myhostname"
|
myorigin: $myhostname
|
||||||
mydestination: "$myhostname, localhost"
|
mydestination: $myhostname, localhost
|
||||||
default_transport: "smtp"
|
default_transport: smtp
|
||||||
mynetworks: "127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128"
|
mynetworks: 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
|
||||||
mailbox_size_limit: "0"
|
mailbox_size_limit: '0'
|
||||||
recipient_delimiter: "+"
|
recipient_delimiter: '+'
|
||||||
inet_interfaces: "localhost"
|
inet_interfaces: localhost
|
||||||
inet_protocols: "all"
|
inet_protocols: all
|
||||||
postfix_full_config: "{{ postfix_default_config | combine(postfix_config) }}"
|
postfix_full_config: '{{ postfix_default_config|combine(postfix_config) }}'
|
||||||
postfix_transports: {}
|
postfix_transports: {}
|
||||||
postfix_aliases: {}
|
postfix_aliases: {}
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
---
|
---
|
||||||
- name: "Reload postfix"
|
- name: reload postfix
|
||||||
ansible.builtin.service:
|
ansible.builtin.service:
|
||||||
name: "postfix"
|
name: postfix
|
||||||
state: "reloaded"
|
state: reloaded
|
||||||
|
|
||||||
- name: "Map transport" # noqa no-changed-when
|
- name: map transport
|
||||||
ansible.builtin.command: "postmap /etc/postfix/transport"
|
ansible.builtin.command: postmap /etc/postfix/transport
|
||||||
|
|
||||||
- name: "Map aliases" # noqa no-changed-when
|
- name: map aliases
|
||||||
ansible.builtin.command: "postalias /etc/postfix/aliases"
|
ansible.builtin.command: postalias /etc/postfix/aliases
|
||||||
|
|
|
@ -1,22 +1,21 @@
|
||||||
---
|
---
|
||||||
galaxy_info:
|
galaxy_info:
|
||||||
role_name: "postfix_mta"
|
role_name: postfix_mta
|
||||||
namespace: "nishiki"
|
author: Adrien Waksberg
|
||||||
author: "Adrien Waksberg"
|
company: Adrien Waksberg
|
||||||
company: "Adrien Waksberg"
|
description: Install and configure a simple mta with postfix
|
||||||
description: "Install and configure a simple mta with postfix"
|
license: Apache2
|
||||||
license: "Apache2"
|
min_ansible_version: 2.9
|
||||||
min_ansible_version: "2.9"
|
|
||||||
|
|
||||||
platforms:
|
platforms:
|
||||||
- name: "Debian"
|
- name: Debian
|
||||||
versions:
|
versions:
|
||||||
- "bookworm"
|
- buster
|
||||||
- "trixie"
|
- bullseye
|
||||||
|
|
||||||
galaxy_tags:
|
galaxy_tags:
|
||||||
- "postfix"
|
- postfix
|
||||||
- "mta"
|
- mta
|
||||||
- "mail"
|
- mail
|
||||||
|
|
||||||
dependencies: []
|
dependencies: []
|
||||||
|
|
|
@ -1,22 +1,22 @@
|
||||||
---
|
---
|
||||||
- name: "Converge"
|
- name: Converge
|
||||||
hosts: "all"
|
hosts: all
|
||||||
roles:
|
roles:
|
||||||
- "nishiki.postfix_mta"
|
- ansible-role-postfix_mta
|
||||||
vars:
|
vars:
|
||||||
postfix_config:
|
postfix_config:
|
||||||
inet_protocols: "ipv4"
|
inet_protocols: ipv4
|
||||||
transport_maps: "hash:/etc/postfix/transport"
|
transport_maps: hash:/etc/postfix/transport
|
||||||
aliases_maps: "hash:/etc/postfix/aliases"
|
aliases_maps: hash:/etc/postfix/aliases
|
||||||
postfix_transports:
|
postfix_transports:
|
||||||
google.com: "smtp:127.0.0.1"
|
google.com: smtp:127.0.0.1
|
||||||
postfix_aliases:
|
postfix_aliases:
|
||||||
root:
|
root:
|
||||||
- "admin"
|
- admin
|
||||||
- "abuse"
|
- abuse
|
||||||
admin: "admin@localhost.loc"
|
admin: admin@localhost.loc
|
||||||
|
|
||||||
pre_tasks:
|
pre_tasks:
|
||||||
- name: "Update apt cache"
|
- name: update apt cache
|
||||||
ansible.builtin.apt:
|
ansible.builtin.apt:
|
||||||
update_cache: true
|
update_cache: true
|
||||||
|
|
|
@ -1,24 +1,26 @@
|
||||||
---
|
---
|
||||||
driver:
|
driver:
|
||||||
name: "docker"
|
name: docker
|
||||||
platforms:
|
platforms:
|
||||||
- name: "debian12"
|
- name: debian10
|
||||||
image: "code.waks.be/nishiki/molecule:debian12"
|
image: nishiki/debian10:molecule
|
||||||
privileged: true
|
privileged: true
|
||||||
volumes:
|
volumes:
|
||||||
- "/sys/fs/cgroup:/sys/fs/cgroup:rw"
|
- /sys/fs/cgroup:/sys/fs/cgroup:ro
|
||||||
cgroupns_mode: "host"
|
command: /bin/systemd
|
||||||
command: "/bin/systemd"
|
|
||||||
capabilities:
|
capabilities:
|
||||||
- "SYS_ADMIN"
|
- SYS_ADMIN
|
||||||
- name: "debian13"
|
- name: debian11
|
||||||
image: "code.waks.be/nishiki/molecule:debian13"
|
image: nishiki/debian11:molecule
|
||||||
privileged: true
|
privileged: true
|
||||||
volumes:
|
volumes:
|
||||||
- "/sys/fs/cgroup:/sys/fs/cgroup:rw"
|
- /sys/fs/cgroup:/sys/fs/cgroup:ro
|
||||||
cgroupns_mode: "host"
|
command: /bin/systemd
|
||||||
command: "/usr/lib/systemd/systemd"
|
|
||||||
capabilities:
|
capabilities:
|
||||||
- "SYS_ADMIN"
|
- SYS_ADMIN
|
||||||
|
lint: |
|
||||||
|
set -e
|
||||||
|
yamllint .
|
||||||
|
ansible-lint .
|
||||||
verifier:
|
verifier:
|
||||||
name: "testinfra"
|
name: testinfra
|
||||||
|
|
|
@ -1,31 +1,31 @@
|
||||||
---
|
---
|
||||||
- name: "Install packages"
|
- name: install packages
|
||||||
ansible.builtin.package:
|
ansible.builtin.package:
|
||||||
name:
|
name:
|
||||||
- "postfix"
|
- postfix
|
||||||
- "bsd-mailx"
|
- bsd-mailx
|
||||||
tags: "postfix"
|
tags: postfix
|
||||||
|
|
||||||
- name: "Copy file configuration"
|
- name: copy file configuration
|
||||||
ansible.builtin.template:
|
template:
|
||||||
src: "{{ item }}.j2"
|
src: '{{ item }}.j2'
|
||||||
dest: "/etc/postfix/{{ item }}"
|
dest: '/etc/postfix/{{ item }}'
|
||||||
owner: "root"
|
owner: root
|
||||||
group: "root"
|
group: root
|
||||||
mode: "0644"
|
mode: 0644
|
||||||
loop:
|
loop:
|
||||||
- "main.cf"
|
- main.cf
|
||||||
- "aliases"
|
- aliases
|
||||||
- "transport"
|
- transport
|
||||||
notify:
|
notify:
|
||||||
- "Reload postfix"
|
- reload postfix
|
||||||
- "Map aliases"
|
- map aliases
|
||||||
- "Map transport"
|
- map transport
|
||||||
tags: "postfix"
|
tags: postfix
|
||||||
|
|
||||||
- name: "Enable and start service"
|
- name: enable and start service
|
||||||
ansible.builtin.service:
|
ansible.builtin.service:
|
||||||
name: "postfix"
|
name: postfix
|
||||||
enabled: "true"
|
enabled: yes
|
||||||
state: "started"
|
state: started
|
||||||
tags: "postfix"
|
tags: postfix
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue