Skip to content

Commit ffd6301

Browse files
authored
Merge pull request #108 from Oefenweb/make-use-of-github-actions
Make use of github actions
2 parents fea3a8d + 783bee2 commit ffd6301

File tree

16 files changed

+169
-138
lines changed

16 files changed

+169
-138
lines changed

.github/workflows/ci.yml

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
---
2+
name: CI
3+
'on':
4+
pull_request:
5+
push:
6+
branches:
7+
- master
8+
schedule:
9+
- cron: '30 1 * * 3'
10+
11+
jobs:
12+
13+
lint:
14+
name: Lint
15+
runs-on: ubuntu-latest
16+
steps:
17+
- name: Check out the codebase
18+
uses: actions/checkout@v2
19+
20+
- name: Set up Python 3
21+
uses: actions/setup-python@v2
22+
with:
23+
python-version: '3.x'
24+
25+
- name: Install test dependencies
26+
run: pip install yamllint ansible-lint[core]
27+
28+
- name: Lint code
29+
run: |
30+
yamllint .
31+
ansible-lint
32+
33+
molecule:
34+
name: Molecule
35+
runs-on: ubuntu-latest
36+
defaults:
37+
run:
38+
working-directory: "${{ github.repository }}"
39+
needs:
40+
- lint
41+
strategy:
42+
fail-fast: false
43+
matrix:
44+
include:
45+
- distro: debian8
46+
- distro: debian9
47+
- distro: debian10
48+
- distro: ubuntu1604
49+
ansible-version: '>=2.8, <2.9'
50+
- distro: ubuntu1604
51+
ansible-version: '>=2.9, <2.10'
52+
- distro: ubuntu1604
53+
ansible-version: '>=2.10, <2.11'
54+
- distro: ubuntu1604
55+
- distro: ubuntu1804
56+
- distro: ubuntu2004
57+
58+
steps:
59+
- name: Check out the codebase
60+
uses: actions/checkout@v2
61+
with:
62+
path: "${{ github.repository }}"
63+
64+
- name: Set up Python 3
65+
uses: actions/setup-python@v2
66+
with:
67+
python-version: '3.x'
68+
69+
- name: Install test dependencies
70+
run: pip install 'ansible${{ matrix.ansible-version }}' molecule[docker] docker
71+
72+
- name: Run Molecule tests
73+
run: |
74+
molecule test
75+
env:
76+
ANSIBLE_FORCE_COLOR: '1'
77+
ANSIBLE_VERBOSITY: '2'
78+
MOLECULE_DEBUG: '1'
79+
MOLECULE_DISTRO: "${{ matrix.distro }}"
80+
PY_COLORS: '1'

.github/workflows/release.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
name: Release
3+
'on':
4+
push:
5+
tags:
6+
- '*'
7+
8+
jobs:
9+
10+
release:
11+
name: Release
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Check out the codebase
15+
uses: actions/checkout@v2
16+
17+
- name: Publish to Galaxy
18+
uses: robertdebock/galaxy-action@1.1.0
19+
with:
20+
galaxy_api_key: ${{ secrets.GALAXY_API_KEY }}

.travis.yml

Lines changed: 0 additions & 105 deletions
This file was deleted.

.yamllint

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
extends: default
3+
4+
rules:
5+
braces:
6+
max-spaces-inside: 1
7+
level: error
8+
brackets:
9+
max-spaces-inside: 1
10+
level: error
11+
line-length: disable
12+
truthy: disable
13+
14+
ignore: |
15+
.tox/

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
## postfix
22

3-
[![Build Status](https://travis-ci.org/Oefenweb/ansible-postfix.svg?branch=master)](https://travis-ci.org/Oefenweb/ansible-postfix)
3+
[![CI](https://github.com/Oefenweb/ansible-postfix/workflows/CI/badge.svg)](https://github.com/Oefenweb/ansible-postfix/actions?query=workflow%3ACI)
44
[![Ansible Galaxy](http://img.shields.io/badge/ansible--galaxy-postfix-blue.svg)](https://galaxy.ansible.com/oefenweb/postfix)
55

66
Set up a postfix server in Debian-like systems.
@@ -29,7 +29,8 @@ None
2929
* `postfix_sender_dependent_relayhost_maps` [default: `[]`]: Transport mapping based on sender address `/etc/postfix/sender_dependent_relayhost_maps` ([see](http://www.postfix.org/postconf.5.html#recipient_canonical_maps))
3030
* `postfix_header_checks` [default: `[]`]: Lookup tables for content inspection of primary non-MIME message headers `/etc/postfix/header_checks` ([see](http://www.postfix.org/postconf.5.html#header_checks))
3131
* `postfix_header_checks_database_type` [default: `regexp`]: The database type for use in `header_checks`
32-
* `postfix_generic` [default: `[]`]: Generic table address mapping in `/etc/postfix/generic` ([see](http://www.postfix.org/generic.5.html))
32+
* `postfix_generic` [default: `postfix_smtp_generic_maps`]: **Deprecated**, use `postfix_smtp_generic_maps`
33+
* `postfix_smtp_generic_maps` [default: `[]`]: Generic table address mapping in `/etc/postfix/generic` ([see](http://www.postfix.org/generic.5.html))
3334
* `postfix_smtp_generic_maps_database_type` [default: `"{{ postfix_default_database_type }}"`]: The database type for use in `smtp_generic_maps`
3435

3536
* `postfix_mydestination` [default: `["{{ postfix_hostname }}", 'localdomain', 'localhost', 'localhost.localdomain']`]: Specifies what domains this machine will deliver locally, instead of forwarding to another machine

Vagrantfile

Lines changed: 6 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4,40 +4,26 @@
44
role = File.basename(File.expand_path(File.dirname(__FILE__)))
55

66
boxes = [
7-
{
8-
:name => "ubuntu-1204",
9-
:box => "bento/ubuntu-12.04",
10-
:ip => '10.0.0.11',
11-
:cpu => "50",
12-
:ram => "256"
13-
},
14-
{
15-
:name => "ubuntu-1404",
16-
:box => "bento/ubuntu-14.04",
17-
:ip => '10.0.0.12',
18-
:cpu => "50",
19-
:ram => "256"
20-
},
217
{
228
:name => "ubuntu-1604",
239
:box => "bento/ubuntu-16.04",
24-
:ip => '10.0.0.13',
10+
:ip => '10.0.0.12',
2511
:cpu => "50",
2612
:ram => "256"
2713
},
2814
{
2915
:name => "ubuntu-1804",
3016
:box => "bento/ubuntu-18.04",
31-
:ip => '10.0.0.14',
17+
:ip => '10.0.0.13',
3218
:cpu => "50",
3319
:ram => "384"
3420
},
3521
{
36-
:name => "debian-7",
37-
:box => "bento/debian-7",
38-
:ip => '10.0.0.15',
22+
:name => "ubuntu-2004",
23+
:box => "bento/ubuntu-20.04",
24+
:ip => '10.0.0.14',
3925
:cpu => "50",
40-
:ram => "256"
26+
:ram => "384"
4127
},
4228
{
4329
:name => "debian-8",

defaults/main.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ postfix_transport_maps_database_type: "{{ postfix_default_database_type }}"
2222
postfix_sender_dependent_relayhost_maps: []
2323
postfix_header_checks: []
2424
postfix_header_checks_database_type: regexp
25-
postfix_generic: []
25+
postfix_generic: "{{ postfix_smtp_generic_maps }}"
26+
postfix_smtp_generic_maps: []
2627
postfix_smtp_generic_maps_database_type: "{{ postfix_default_database_type }}"
2728

2829
postfix_relayhost: ''

handlers/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
when: postfix_default_database_type != 'regexp'
3030

3131
- name: postmap generic
32-
command: postmap {{ postfix_smtp_generic_maps_database_type }}:{{ postfix_generic_file }}
32+
command: postmap {{ postfix_smtp_generic_maps_database_type }}:{{ postfix_smtp_generic_maps_file }}
3333
when: postfix_smtp_generic_maps_database_type != 'regexp'
3434

3535
- name: remove pid

meta/main.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,11 @@ galaxy_info:
1010
platforms:
1111
- name: Ubuntu
1212
versions:
13-
- precise
14-
- trusty
1513
- xenial
1614
- bionic
15+
- focal
1716
- name: Debian
1817
versions:
19-
- wheezy
2018
- jessie
2119
- stretch
2220
- buster

molecule/default/converge.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
- name: Converge
3+
hosts: all
4+
become: true
5+
roles:
6+
- ../../../

molecule/default/molecule.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
---
2+
dependency:
3+
name: galaxy
4+
driver:
5+
name: docker
6+
platforms:
7+
- name: instance
8+
image: "geerlingguy/docker-${MOLECULE_DISTRO:-ubuntu1604}-ansible:latest"
9+
command: ${MOLECULE_DOCKER_COMMAND:-""}
10+
volumes:
11+
- /sys/fs/cgroup:/sys/fs/cgroup:ro
12+
privileged: true
13+
pre_build_image: true
14+
provisioner:
15+
name: ansible
16+
playbooks:
17+
prepare: prepare.yml
18+
converge: converge.yml
19+
verify: verify.yml

molecule/default/prepare.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
- name: Prepare
3+
hosts: all
4+
become: true
5+
tasks: []

molecule/default/verify.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
- name: Verify
3+
hosts: all
4+
become: true
5+
tasks: []

tasks/main.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
---
33
- name: facts | set
44
set_fact:
5-
is_docker_guest: "{{ ansible_virtualization_role | default('host') == 'guest' and ansible_virtualization_type | default('none') == 'docker' }}"
5+
is_docker_guest: "{{ ansible_virtualization_role | default('host') == 'guest' and ansible_virtualization_type | default('none') == 'docker' }}"
66
tags:
77
- configuration
88
- postfix
@@ -202,15 +202,15 @@
202202

203203
- name: configure generic table
204204
lineinfile:
205-
dest: "{{ postfix_generic_file }}"
205+
dest: "{{ postfix_smtp_generic_maps_file }}"
206206
regexp: '^{{ item.pattern | regex_escape }}\s.*'
207207
line: '{{ item.pattern }} {{ item.result }}'
208208
owner: root
209209
group: root
210210
mode: 0644
211211
create: true
212212
state: present
213-
with_items: "{{ postfix_generic }}"
213+
with_items: "{{ postfix_smtp_generic_maps }}"
214214
notify:
215215
- postmap generic
216216
- restart postfix

templates/etc/postfix/main.cf.j2

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ transport_maps = {{ postfix_transport_maps_database_type }}:{{ postfix_transport
5151
{% if postfix_sender_dependent_relayhost_maps %}
5252
sender_dependent_relayhost_maps = {{ postfix_default_database_type }}:{{ postfix_sender_dependent_relayhost_maps_file }}
5353
{% endif %}
54-
{% if postfix_generic %}
55-
smtp_generic_maps = {{ postfix_smtp_generic_maps_database_type }}:{{ postfix_generic_file }}
54+
{% if postfix_smtp_generic_maps %}
55+
smtp_generic_maps = {{ postfix_smtp_generic_maps_database_type }}:{{ postfix_smtp_generic_maps_file }}
5656
{% endif %}
5757
{% if postfix_header_checks %}
5858
smtp_header_checks = {{ postfix_header_checks_database_type }}:{{ postfix_header_checks_file }}

0 commit comments

Comments
 (0)