Compare commits
5 commits
Author | SHA1 | Date | |
---|---|---|---|
ce7d8e2340 | |||
9167b1e0d5 | |||
4379438163 | |||
e0ed5a9445 | |||
cc4aa85544 |
9 changed files with 81 additions and 45 deletions
18
.forgejo/workflows/molecule.yml
Normal file
18
.forgejo/workflows/molecule.yml
Normal file
|
@ -0,0 +1,18 @@
|
|||
---
|
||||
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
|
10
.gitlab-ci.yml
Normal file
10
.gitlab-ci.yml
Normal file
|
@ -0,0 +1,10 @@
|
|||
---
|
||||
image: nishiki/molecule:docker
|
||||
|
||||
before_script:
|
||||
- molecule --version
|
||||
|
||||
molecule:
|
||||
stage: test
|
||||
script:
|
||||
- molecule test
|
|
@ -5,6 +5,10 @@ Which is based on [Keep A Changelog](http://keepachangelog.com/)
|
|||
|
||||
## [Unreleased]
|
||||
|
||||
### Changed
|
||||
|
||||
- test: use personal docker registry
|
||||
|
||||
## v2.0.0 - 2021-08-20
|
||||
|
||||
### Breaked
|
||||
|
|
37
README.md
37
README.md
|
@ -1,20 +1,21 @@
|
|||
# Ansible role: Postfix MTA
|
||||
|
||||
[![Version](https://img.shields.io/badge/latest_version-2.0.0-green.svg)](https://git.yaegashi.fr/nishiki/ansible-role-postfix_mta/releases)
|
||||
[![License](https://img.shields.io/badge/license-Apache--2.0-blue.svg)](https://git.yaegashi.fr/nishiki/ansible-role-postfix_mta/src/branch/master/LICENSE)
|
||||
[![Version](https://img.shields.io/badge/latest_version-2.0.0-green.svg)](https://code.waks.be/nishiki/ansible-role-postfix_mta/releases)
|
||||
[![License](https://img.shields.io/badge/license-Apache--2.0-blue.svg)](https://code.waks.be/nishiki/ansible-role-postfix_mta/src/branch/main/LICENSE)
|
||||
[![Build](https://code.waks.be/nishiki/ansible-role-postfix_mta/actions/workflows/molecule.yml/badge.svg?branch=main)](https://code.waks.be/nishiki/ansible-role-postfix_mta/actions?workflow=molecule.yml)
|
||||
|
||||
Install and configure an simple mta with postfix
|
||||
|
||||
## Requirements
|
||||
|
||||
* Ansible >= 2.9
|
||||
* Debian
|
||||
* Buster
|
||||
* Bullseye
|
||||
- Ansible >= 2.9
|
||||
- Debian
|
||||
- Bullseye
|
||||
- Bookworm
|
||||
|
||||
## Role variables
|
||||
|
||||
* `postfix_config` - hash with config
|
||||
- `postfix_config` - hash with config
|
||||
|
||||
```
|
||||
smtpd_banner: $myhostname ESMTP $mail_name (Debian/GNU)
|
||||
|
@ -33,13 +34,13 @@ Install and configure an simple mta with postfix
|
|||
inet_protocols: all
|
||||
```
|
||||
|
||||
* `postfix_transports` - hash with the transport configuration
|
||||
- `postfix_transports` - hash with the transport configuration
|
||||
|
||||
```
|
||||
google.com: smtp:127.0.0.1
|
||||
```
|
||||
|
||||
* `postfix_aliases` - hash with the aliases
|
||||
- `postfix_aliases` - hash with the aliases
|
||||
|
||||
```
|
||||
root:
|
||||
|
@ -60,18 +61,18 @@ Install and configure an simple mta with postfix
|
|||
|
||||
### Test with molecule and docker
|
||||
|
||||
* install [docker](https://docs.docker.com/engine/installation/)
|
||||
* install `python3` and `python3-pip`
|
||||
* install molecule and dependencies `pip3 install molecule molecule-docker docker ansible-lint pytest-testinfra yamllint`
|
||||
* run `molecule test`
|
||||
- install [docker](https://docs.docker.com/engine/installation/)
|
||||
- install `python3` and `python3-pip`
|
||||
- install molecule and dependencies `pip3 install molecule molecule-docker docker ansible-lint pytest-testinfra yamllint`
|
||||
- run `molecule test`
|
||||
|
||||
### Tests with docker
|
||||
|
||||
* install [docker](https://docs.docker.com/engine/installation/)
|
||||
* install ruby
|
||||
* install bundler `gem install bundler`
|
||||
* install dependencies `bundle install`
|
||||
* run the tests `kitchen test`
|
||||
- install [docker](https://docs.docker.com/engine/installation/)
|
||||
- install ruby
|
||||
- install bundler `gem install bundler`
|
||||
- install dependencies `bundle install`
|
||||
- run the tests `kitchen test`
|
||||
|
||||
## License
|
||||
|
||||
|
|
|
@ -1,22 +1,22 @@
|
|||
---
|
||||
postfix_hostname: '{{ ansible_fqdn }}'
|
||||
postfix_origin: '$myhostname'
|
||||
postfix_hostname: "{{ ansible_fqdn }}"
|
||||
postfix_origin: "$myhostname"
|
||||
postfix_config: {}
|
||||
postfix_default_config:
|
||||
smtpd_banner: $myhostname ESMTP $mail_name (Debian/GNU)
|
||||
biff: 'no'
|
||||
append_dot_mydomain: 'no'
|
||||
readme_directory: 'no'
|
||||
biff: "no"
|
||||
append_dot_mydomain: "no"
|
||||
readme_directory: "no"
|
||||
compatibility_level: 2
|
||||
myhostname: '{{ ansible_fqdn }}'
|
||||
myhostname: "{{ ansible_fqdn }}"
|
||||
myorigin: $myhostname
|
||||
mydestination: $myhostname, localhost
|
||||
default_transport: smtp
|
||||
mynetworks: 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
|
||||
mailbox_size_limit: '0'
|
||||
recipient_delimiter: '+'
|
||||
mailbox_size_limit: "0"
|
||||
recipient_delimiter: "+"
|
||||
inet_interfaces: localhost
|
||||
inet_protocols: all
|
||||
postfix_full_config: '{{ postfix_default_config|combine(postfix_config) }}'
|
||||
postfix_full_config: "{{ postfix_default_config | combine(postfix_config) }}"
|
||||
postfix_transports: {}
|
||||
postfix_aliases: {}
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
---
|
||||
- name: reload postfix
|
||||
- name: Reload postfix
|
||||
ansible.builtin.service:
|
||||
name: postfix
|
||||
state: reloaded
|
||||
|
||||
- name: map transport
|
||||
- name: Map transport # noqa no-changed-when
|
||||
ansible.builtin.command: postmap /etc/postfix/transport
|
||||
|
||||
- name: map aliases
|
||||
- name: Map aliases # noqa no-changed-when
|
||||
ansible.builtin.command: postalias /etc/postfix/aliases
|
||||
|
|
|
@ -1,17 +1,18 @@
|
|||
---
|
||||
galaxy_info:
|
||||
role_name: postfix_mta
|
||||
namespace: nishiki
|
||||
author: Adrien Waksberg
|
||||
company: Adrien Waksberg
|
||||
description: Install and configure a simple mta with postfix
|
||||
license: Apache2
|
||||
min_ansible_version: 2.9
|
||||
min_ansible_version: "2.9"
|
||||
|
||||
platforms:
|
||||
- name: Debian
|
||||
versions:
|
||||
- buster
|
||||
- bullseye
|
||||
- bookworm
|
||||
|
||||
galaxy_tags:
|
||||
- postfix
|
||||
|
|
|
@ -2,19 +2,21 @@
|
|||
driver:
|
||||
name: docker
|
||||
platforms:
|
||||
- name: debian10
|
||||
image: nishiki/debian10:molecule
|
||||
- name: debian12
|
||||
image: code.waks.be/nishiki/molecule:debian12
|
||||
privileged: true
|
||||
volumes:
|
||||
- /sys/fs/cgroup:/sys/fs/cgroup:ro
|
||||
- /sys/fs/cgroup:/sys/fs/cgroup:rw
|
||||
cgroupns_mode: host
|
||||
command: /bin/systemd
|
||||
capabilities:
|
||||
- SYS_ADMIN
|
||||
- name: debian11
|
||||
image: nishiki/debian11:molecule
|
||||
image: code.waks.be/nishiki/molecule:debian11
|
||||
privileged: true
|
||||
volumes:
|
||||
- /sys/fs/cgroup:/sys/fs/cgroup:ro
|
||||
- /sys/fs/cgroup:/sys/fs/cgroup:rw
|
||||
cgroupns_mode: host
|
||||
command: /bin/systemd
|
||||
capabilities:
|
||||
- SYS_ADMIN
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
---
|
||||
- name: install packages
|
||||
- name: Install packages
|
||||
ansible.builtin.package:
|
||||
name:
|
||||
- postfix
|
||||
- bsd-mailx
|
||||
tags: postfix
|
||||
|
||||
- name: copy file configuration
|
||||
template:
|
||||
- name: Copy file configuration
|
||||
ansible.builtin.template:
|
||||
src: '{{ item }}.j2'
|
||||
dest: '/etc/postfix/{{ item }}'
|
||||
owner: root
|
||||
|
@ -18,14 +18,14 @@
|
|||
- aliases
|
||||
- transport
|
||||
notify:
|
||||
- reload postfix
|
||||
- map aliases
|
||||
- map transport
|
||||
- Reload postfix
|
||||
- Map aliases
|
||||
- Map transport
|
||||
tags: postfix
|
||||
|
||||
- name: enable and start service
|
||||
- name: Enable and start service
|
||||
ansible.builtin.service:
|
||||
name: postfix
|
||||
enabled: yes
|
||||
enabled: true
|
||||
state: started
|
||||
tags: postfix
|
||||
|
|
Loading…
Reference in a new issue