Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Follow linter suggestions #57

Merged
merged 207 commits into from
Oct 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
207 commits
Select commit Hold shift + click to select a range
74f7b7b
Merge tag '2.2' into develop
suhancz Sep 26, 2023
fc0b3a1
Merge branch 'main' into develop
suhancz Oct 1, 2023
50f118b
use offlineimap instead of Dovecot's built-in sync feature
suhancz Oct 1, 2023
1cb66b7
Merge branch 'release/2.3'
suhancz Oct 1, 2023
4c50a96
Merge tag '2.3' into develop
suhancz Oct 1, 2023
fc4d265
fix undeliverable exceptions
suhancz Oct 6, 2023
dd51c8a
Merge remote-tracking branch 'origin/main' into main
suhancz Oct 6, 2023
a19bf8c
Merge branch 'release/2.3.1'
suhancz Oct 6, 2023
7901d98
Merge tag '2.3.1' into develop
suhancz Oct 6, 2023
f8de14c
fix several bugs when installing from scratch
suhancz Oct 14, 2023
ac391fc
restart pdns anyway
suhancz Oct 14, 2023
28e6628
fix sql
suhancz Oct 15, 2023
60d994b
fix DB schema
suhancz Oct 15, 2023
21fd53f
fix sql
suhancz Oct 15, 2023
53c51db
fix typo
suhancz Oct 15, 2023
1ee3042
make sure DynDNS .htaccess is in place
suhancz Oct 15, 2023
c448daf
add missing rescue block
suhancz Oct 15, 2023
22ceb20
fix certificate symlinks
suhancz Oct 15, 2023
1193555
fix certificate symlink
suhancz Oct 15, 2023
759dbc7
shell instead of command
suhancz Oct 15, 2023
d4a3ee3
fix user home reference
suhancz Oct 15, 2023
1e80772
correct fingerprint variable
suhancz Oct 15, 2023
d6a05b0
fix offlineimap package
suhancz Oct 15, 2023
90333e8
fix name translation
suhancz Oct 15, 2023
c655ab3
fix stdout parsing
suhancz Oct 15, 2023
4f2125e
tag specific tasks
suhancz Oct 15, 2023
7df8d91
fix task dependencies
suhancz Oct 15, 2023
64f4d41
fix task dependencies
suhancz Oct 15, 2023
ee72d34
fix task dependencies
suhancz Oct 15, 2023
f50de5e
fix task dependencies
suhancz Oct 15, 2023
1b32807
fix template variable reference
suhancz Oct 15, 2023
b8c8848
clean up debug symbols
suhancz Oct 15, 2023
b2a137c
fix template logic
suhancz Oct 15, 2023
87890bd
imapsync instead of offlineimap
suhancz Oct 15, 2023
75cfa94
cleanup
suhancz Oct 15, 2023
e6d78d7
the loop needs to be inside the called task file for some reason
suhancz Oct 15, 2023
8b6f224
add tag inside the task file, too
suhancz Oct 15, 2023
023bdc3
fix typo
suhancz Oct 15, 2023
b179c14
move passwords to environment variables
suhancz Oct 15, 2023
8cf61c3
move passwords to environment variables
suhancz Oct 15, 2023
f62d0b5
hide passwords
suhancz Oct 15, 2023
db1c12f
hide passwords
suhancz Oct 16, 2023
1cba0d4
fix VPN config permissions
suhancz Oct 16, 2023
3016f39
Merge branch 'hotfix/wireguard_pool_to_hosts'
suhancz Oct 17, 2023
c9b0ca1
Merge tag 'wireguard_pool_to_hosts' into develop
suhancz Oct 17, 2023
2e9c1a0
Merge branch 'release/2.4'
suhancz Oct 17, 2023
872935a
Merge tag '2.4' into develop
suhancz Oct 17, 2023
4550d71
update empty horde schema to 5.2.23-1
suhancz Oct 18, 2023
2813601
add version info
suhancz Oct 18, 2023
fc3428f
don't import if not necessary
suhancz Oct 18, 2023
71b82b9
add version info
suhancz Oct 18, 2023
00ab53d
use fresh database as "schema"
suhancz Oct 18, 2023
92cc589
proper replace
suhancz Oct 18, 2023
793fa75
update schemas
suhancz Oct 18, 2023
40131d5
enable activesync
suhancz Oct 18, 2023
7cc19e7
update schema
suhancz Oct 18, 2023
14c0b45
reset only if requested
suhancz Oct 18, 2023
0b947ae
clean up
suhancz Oct 18, 2023
2856f04
Merge branch 'bugfix/horde-schema' into develop
suhancz Oct 18, 2023
b1b9c4d
Merge branch 'release/2.4.1'
suhancz Oct 18, 2023
6f4b9a4
Merge tag '2.4.1' into develop
suhancz Oct 18, 2023
45215d5
enable ActiveSync outside of schema init
suhancz Oct 19, 2023
636377d
Merge branch 'release/2.4.2'
suhancz Oct 19, 2023
5f8dece
Merge tag '2.4.2' into develop
suhancz Oct 19, 2023
1d39134
install PHP 8.1
suhancz Oct 21, 2023
093b105
sort out dependencies
suhancz Oct 21, 2023
93bb27a
add more tags for easier maintenance
suhancz Oct 21, 2023
c47d151
add perl-CGI for imapsync
suhancz Oct 22, 2023
fe7937c
only install what we explicitly need
suhancz Oct 22, 2023
b65bc1d
enable COPR only if not enabled yet
suhancz Oct 22, 2023
4b185d9
try horde from Cheese repo
suhancz Oct 24, 2023
db35ef2
enable RPM Fusion
suhancz Oct 24, 2023
c4b7649
back to Remi, use an older version of PowerAdmin
suhancz Oct 24, 2023
c0875f6
use releasever, where possible
suhancz Oct 24, 2023
a60454f
fix ElasticSearch version
suhancz Oct 24, 2023
4efe88b
use latest-and-greatest PowerDNS
suhancz Oct 24, 2023
c365335
fully disable php81
suhancz Oct 24, 2023
16ad908
fix PowerDNS repo keys
suhancz Oct 24, 2023
13981d6
use PowerDNS EL repos
suhancz Oct 24, 2023
5742ecc
fix tags to query repolist
suhancz Oct 24, 2023
503c8e7
disable not-in-use PHP versions
suhancz Oct 24, 2023
21d760b
fix user ID
suhancz Oct 25, 2023
aa599af
recursive dedup
suhancz Oct 26, 2023
3fd65db
cron mail notification
suhancz Oct 26, 2023
e76b7ea
move IMAPDedup password to .cron_secrets file
suhancz Oct 26, 2023
81f67f6
fill the perm_templ table
suhancz Oct 26, 2023
aa62e9c
fix lineinfile pattern match
suhancz Oct 26, 2023
3ef72c6
rectify all zones after each DNS record
suhancz Oct 26, 2023
2b8176f
fix tags
suhancz Oct 26, 2023
c7ab236
Merge branch 'release/2.4.3'
suhancz Oct 26, 2023
b1f12b9
Merge tag '2.4.3' into develop
suhancz Oct 26, 2023
73eefc0
Enable Python linting
suhancz Oct 26, 2023
c1df6e9
use offlineimap instead of Dovecot's built-in sync feature
suhancz Oct 1, 2023
b6d2ab2
fix several bugs when installing from scratch
suhancz Oct 14, 2023
78526a5
fix DB schema
suhancz Oct 15, 2023
055875a
fix offlineimap package
suhancz Oct 15, 2023
5d127af
tag specific tasks
suhancz Oct 15, 2023
a70353b
fix template variable reference
suhancz Oct 15, 2023
90c4ddc
imapsync instead of offlineimap
suhancz Oct 15, 2023
8707305
cleanup
suhancz Oct 15, 2023
9d5f97a
don't import if not necessary
suhancz Oct 18, 2023
8527bbc
update schemas
suhancz Oct 18, 2023
46ccc3d
only install what we explicitly need
suhancz Oct 22, 2023
49b3a51
try horde from Cheese repo
suhancz Oct 24, 2023
e756080
enable RPM Fusion
suhancz Oct 24, 2023
5f9d738
back to Remi, use an older version of PowerAdmin
suhancz Oct 24, 2023
932fbc9
use releasever, where possible
suhancz Oct 24, 2023
6e342c9
use offlineimap instead of Dovecot's built-in sync feature
suhancz Oct 1, 2023
a9a6021
fix several bugs when installing from scratch
suhancz Oct 14, 2023
a59c62f
fix DB schema
suhancz Oct 15, 2023
2b0456e
shell instead of command
suhancz Oct 15, 2023
052aa58
fix user home reference
suhancz Oct 15, 2023
ebc93db
correct fingerprint variable
suhancz Oct 15, 2023
a52bd8d
fix offlineimap package
suhancz Oct 15, 2023
abed1eb
fix name translation
suhancz Oct 15, 2023
c6d5e1d
fix stdout parsing
suhancz Oct 15, 2023
48dabd6
tag specific tasks
suhancz Oct 15, 2023
522539b
fix task dependencies
suhancz Oct 15, 2023
23ed6a4
fix task dependencies
suhancz Oct 15, 2023
5db7103
fix template variable reference
suhancz Oct 15, 2023
e8a9966
clean up debug symbols
suhancz Oct 15, 2023
e7761b8
fix template logic
suhancz Oct 15, 2023
b35933f
imapsync instead of offlineimap
suhancz Oct 15, 2023
4369d8d
cleanup
suhancz Oct 15, 2023
def9ff4
don't import if not necessary
suhancz Oct 18, 2023
5d6bc47
update schemas
suhancz Oct 18, 2023
8df8e23
enable activesync
suhancz Oct 18, 2023
f601269
enable ActiveSync outside of schema init
suhancz Oct 19, 2023
d5403f4
only install what we explicitly need
suhancz Oct 22, 2023
1f437bc
try horde from Cheese repo
suhancz Oct 24, 2023
259583c
enable RPM Fusion
suhancz Oct 24, 2023
73986cb
back to Remi, use an older version of PowerAdmin
suhancz Oct 24, 2023
07bf555
use releasever, where possible
suhancz Oct 24, 2023
dafc4a0
fix ElasticSearch version
suhancz Oct 24, 2023
4bd5622
use offlineimap instead of Dovecot's built-in sync feature
suhancz Oct 1, 2023
ef7aa82
fix several bugs when installing from scratch
suhancz Oct 14, 2023
3bea509
fix DB schema
suhancz Oct 15, 2023
5b284ac
fix offlineimap package
suhancz Oct 15, 2023
507dfc3
tag specific tasks
suhancz Oct 15, 2023
551fbe9
fix template variable reference
suhancz Oct 15, 2023
7fdae75
imapsync instead of offlineimap
suhancz Oct 15, 2023
430f2ee
cleanup
suhancz Oct 15, 2023
079f486
don't import if not necessary
suhancz Oct 18, 2023
1ce2580
update schemas
suhancz Oct 18, 2023
8755c63
only install what we explicitly need
suhancz Oct 22, 2023
06ae040
try horde from Cheese repo
suhancz Oct 24, 2023
4af5374
enable RPM Fusion
suhancz Oct 24, 2023
00e3728
back to Remi, use an older version of PowerAdmin
suhancz Oct 24, 2023
0197063
use releasever, where possible
suhancz Oct 24, 2023
c3d69d0
Merge remote-tracking branch 'origin/develop' into develop
suhancz Oct 26, 2023
b2a0a70
Lint Ansible files
suhancz Oct 26, 2023
40de055
fix ElasticSearch version
suhancz Oct 26, 2023
6f1e682
lint Python only if Python files changed
suhancz Oct 26, 2023
28b5db4
fix path match
suhancz Oct 26, 2023
3b23948
add role name
suhancz Oct 26, 2023
566742d
add namespace
suhancz Oct 26, 2023
ddfbc76
Merge remote-tracking branch 'origin/main' into develop
suhancz Oct 26, 2023
c6823ea
add shellcheck
suhancz Oct 26, 2023
88232fa
fix namespace
suhancz Oct 26, 2023
d3030bb
use Super Linter
suhancz Oct 26, 2023
c45f6ac
use underscore
suhancz Oct 26, 2023
da3c1ae
Merge remote-tracking branch 'origin/main' into develop
suhancz Oct 27, 2023
dfcf6a8
tag cron mails with cron
suhancz Oct 27, 2023
2d4717c
set ANSIBLE_DIRECTORY
suhancz Oct 27, 2023
3632fd5
symlink role to tests
suhancz Oct 27, 2023
7c26d15
fix role symlink
suhancz Oct 27, 2023
dc9dca9
fix typo
suhancz Oct 27, 2023
4d64985
switch systemd to ansible.builtin.systemd_service
suhancz Oct 27, 2023
3066adc
fix Jinja2 spacing
suhancz Oct 27, 2023
dc9b233
use ansible.posix.sysctl instead of sysctl
suhancz Oct 27, 2023
1ac98f6
define ansible.posix dependency
suhancz Oct 27, 2023
820c0da
Merge remote-tracking branch 'origin/main' into develop
suhancz Oct 27, 2023
1fccc7f
Merge remote-tracking branch 'origin/main' into release/2.4.4
suhancz Oct 27, 2023
3a2f1a0
define ansible.posix version
suhancz Oct 27, 2023
4b5a62f
remove duplicate line
suhancz Oct 27, 2023
0515b10
set up requirements
suhancz Oct 27, 2023
489480d
exclude some devskim alerts
suhancz Oct 27, 2023
0cd3b99
modprobe dependencies
suhancz Oct 27, 2023
f8bb88e
community.mysql.mysql_user
suhancz Oct 27, 2023
c47d3d0
community.crypto dependency
suhancz Oct 27, 2023
6aa45a5
use FQCNs
suhancz Oct 27, 2023
aa512f4
use FQCNs
suhancz Oct 27, 2023
fc66848
use FQCNs
suhancz Oct 27, 2023
90d3168
satisfy linter
suhancz Oct 27, 2023
d68a267
fix Jinja2 spacing
suhancz Oct 27, 2023
4ce85f0
fix noqa comments
suhancz Oct 27, 2023
86127d2
set some ansible.builtin. FQCNs
suhancz Oct 27, 2023
5787a12
satisfy linter
suhancz Oct 27, 2023
f2dee15
satisfy linter
suhancz Oct 27, 2023
c9798e5
satisfy linter
suhancz Oct 27, 2023
d431fe8
port is port
suhancz Oct 27, 2023
8b084bb
fix spacing
suhancz Oct 27, 2023
18df188
remove accidental duplicate colons
suhancz Oct 27, 2023
786f7bb
sort out FQCNs
suhancz Oct 27, 2023
fe38460
sort out other linter complaints
suhancz Oct 27, 2023
8926492
satisfy linter
suhancz Oct 27, 2023
57f5ffe
sort out FQCNs
suhancz Oct 27, 2023
5aa9ca5
fix broken YAML
suhancz Oct 27, 2023
50b435d
handle most linter errors
suhancz Oct 27, 2023
cc78983
handle leftover linter errors
suhancz Oct 27, 2023
062f122
handle last linter errors
suhancz Oct 27, 2023
a30a56d
handle last linter error
suhancz Oct 27, 2023
a1e288c
improve spacing
suhancz Oct 27, 2023
f097a86
add linter ignore file
suhancz Oct 27, 2023
b3630b3
Merge remote-tracking branch 'origin/main' into main
suhancz Oct 27, 2023
cf3a324
Merge branch 'release/2.4.4'
suhancz Oct 27, 2023
9f5f00a
Merge tag '2.4.4' into develop
suhancz Oct 27, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .ansible-lint-ignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
tasks/ssl.yml schema[tasks] # no idea why the linter complains on this one, the whole thing works
2 changes: 2 additions & 0 deletions .github/workflows/devskim.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ jobs:

- name: Run DevSkim scanner
uses: microsoft/DevSkim-Action@v1
with:
exclude-rules: DS126858,DS137138,DS162092,DS169125,DS169126

- name: Upload DevSkim scan results to GitHub Security tab
uses: github/codeql-action/upload-sarif@v2
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/linter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,4 @@ jobs:
# Change to 'master' if your main branch differs
DEFAULT_BRANCH: main
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ANSIBLE_DIRECTORY: .
10 changes: 10 additions & 0 deletions collections/requirements.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
collections:
- name: ansible.posix
version: 1.5.4
- name: community.general
version: 7.5.0
- name: community.mysql
version: 3.7.2
- name: community.crypto
version: 2.15.1
23 changes: 13 additions & 10 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,19 +39,20 @@
- { type: "score", key: "CUSTOM_DMARC_FAIL", value: "3.0"}
- type: "body"
key: "BE_POLITE"
# noqa jinja[spacing] some pipes here are for regex purposes and not for Jinja2
value: >

Check warning on line 43 in defaults/main.yml

View workflow job for this annotation

GitHub Actions / Lint Code Base

jinja[spacing]

Jinja2 spacing could be improved: /(hi|hello|dear) ( {%- set mail_users = ['root','postmaster','abuse','hostmaster','webmaster','dmarc-reports'] %} {%- for user in users | default( [] ) %} {%- set mail_users = mail_users.append( user['name'] ) %} {%- endfor %} {{- mail_users | join('|') -}} )@( {%- set domains = \[mailserver_domain] %} {%- for domain in custom_domains | default( [] ) %} {%- set domains = domains.append( domain ) %} {%- endfor %} {{- domains | join('|') -}} )/i

Check warning on line 43 in defaults/main.yml

View workflow job for this annotation

GitHub Actions / Lint Code Base

jinja[spacing]

Jinja2 spacing could be improved: /(hi|hello|dear) ( {%- set mail_users = ['root','postmaster','abuse','hostmaster','webmaster','dmarc-reports'] %} {%- for user in users | default( [] ) %} {%- set mail_users = mail_users.append( user['name'] ) %} {%- endfor %} {{- mail_users | join('|') -}} )@( {%- set domains = \[mailserver_domain] %} {%- for domain in custom_domains | default( [] ) %} {%- set domains = domains.append( domain ) %} {%- endfor %} {{- domains | join('|') -}} )/i

Check warning on line 43 in defaults/main.yml

View workflow job for this annotation

GitHub Actions / Lint Code Base

jinja[spacing]

Jinja2 spacing could be improved: /(hi|hello|dear) ( {%- set mail_users = ['root','postmaster','abuse','hostmaster','webmaster','dmarc-reports'] %} {%- for user in users | default( [] ) %} {%- set mail_users = mail_users.append( user['name'] ) %} {%- endfor %} {{- mail_users | join('|') -}} )@( {%- set domains = \[mailserver_domain] %} {%- for domain in custom_domains | default( [] ) %} {%- set domains = domains.append( domain ) %} {%- endfor %} {{- domains | join('|') -}} )/i
/(hi|hello|dear) (
{%- set mail_users = ['root','postmaster','abuse','hostmaster','webmaster','dmarc-reports'] %}
{%- for user in users|default([]) %}
{%- for user in users | default( [] ) %}
{%- set mail_users = mail_users.append( user['name'] ) %}
{%- endfor %}
{{- mail_users|join('|') -}}
{{- mail_users | join('|') -}}
)@(
{%- set domains = [mailserver_domain] %}
{%- for domain in custom_domains|default([]) %}
{%- for domain in custom_domains | default( [] ) %}
{%- set domains = domains.append( domain ) %}
{%- endfor %}
{{- domains|join('|') -}}
{{- domains | join('|') -}}
)/i
- { type: "describe", key: "BE_POLITE", value: "This email doesn't use a proper name for the recipient" }
- { type: "score", key: "BE_POLITE", value: "5.0" }
Expand All @@ -76,31 +77,33 @@
- { type: "allow_user_rules", key: "1", value: "# Allow user rules"}
- type: "header"
key: "SUBJECT_SPAM"
# noqa jinja[spacing] some pipes here are as plain text and not for Jinja2
value: >

Check warning on line 81 in defaults/main.yml

View workflow job for this annotation

GitHub Actions / Lint Code Base

jinja[spacing]

Jinja2 spacing could be improved: Subject =~ /( {%- set mail_users = ['root','postmaster','abuse','hostmaster','webmaster','dmarc-reports'] %} {%- for user in users | default( [] ) %} {%- set mail_users = mail_users.append( user['name'] ) %} {%- endfor %} {{- mail_users | join('|') -}} )@( {%- set domains = \[mailserver_domain] %} {%- for domain in custom_domains | default( [] ) %} {%- set domains = domains.append( domain ) %} {%- endfor %} {{- domains | join('|') -}} )/i

Check warning on line 81 in defaults/main.yml

View workflow job for this annotation

GitHub Actions / Lint Code Base

jinja[spacing]

Jinja2 spacing could be improved: Subject =~ /( {%- set mail_users = ['root','postmaster','abuse','hostmaster','webmaster','dmarc-reports'] %} {%- for user in users | default( [] ) %} {%- set mail_users = mail_users.append( user['name'] ) %} {%- endfor %} {{- mail_users | join('|') -}} )@( {%- set domains = \[mailserver_domain] %} {%- for domain in custom_domains | default( [] ) %} {%- set domains = domains.append( domain ) %} {%- endfor %} {{- domains | join('|') -}} )/i

Check warning on line 81 in defaults/main.yml

View workflow job for this annotation

GitHub Actions / Lint Code Base

jinja[spacing]

Jinja2 spacing could be improved: Subject =~ /( {%- set mail_users = ['root','postmaster','abuse','hostmaster','webmaster','dmarc-reports'] %} {%- for user in users | default( [] ) %} {%- set mail_users = mail_users.append( user['name'] ) %} {%- endfor %} {{- mail_users | join('|') -}} )@( {%- set domains = \[mailserver_domain] %} {%- for domain in custom_domains | default( [] ) %} {%- set domains = domains.append( domain ) %} {%- endfor %} {{- domains | join('|') -}} )/i
Subject =~ /(
{%- set mail_users = ['root','postmaster','abuse','hostmaster','webmaster','dmarc-reports'] %}
{%- for user in users|default([]) %}
{%- for user in users | default( [] ) %}
{%- set mail_users = mail_users.append( user['name'] ) %}
{%- endfor %}
{{- mail_users|join('|') -}}
{{- mail_users | join('|') -}}
)@(
{%- set domains = [mailserver_domain] %}
{%- for domain in custom_domains|default([]) %}
{%- for domain in custom_domains | default( [] ) %}
{%- set domains = domains.append( domain ) %}
{%- endfor %}
{{- domains|join('|') -}}
{{- domains | join('|') -}}
)/i
- { type: "describe", key: "SUBJECT_SPAM", value: "Subject contains my email address."}
- { type: "score", key: "SUBJECT_SPAM", value: "4.0" }
- type: "header"
key: "__DOMAIN_IN_TO"
# noqa jinja[spacing] some pipes here are as plain text and not for Jinja2
value: >

Check warning on line 100 in defaults/main.yml

View workflow job for this annotation

GitHub Actions / Lint Code Base

jinja[spacing]

Jinja2 spacing could be improved: To =~ /( {%- set domains = \[mailserver_domain] %} {%- for domain in custom_domains | default( [] ) %} {%- set domains = domains.append( domain ) %} {%- endfor %} {{- domains | join('|') -}} )/

Check warning on line 100 in defaults/main.yml

View workflow job for this annotation

GitHub Actions / Lint Code Base

jinja[spacing]

Jinja2 spacing could be improved: To =~ /( {%- set domains = \[mailserver_domain] %} {%- for domain in custom_domains | default( [] ) %} {%- set domains = domains.append( domain ) %} {%- endfor %} {{- domains | join('|') -}} )/

Check warning on line 100 in defaults/main.yml

View workflow job for this annotation

GitHub Actions / Lint Code Base

jinja[spacing]

Jinja2 spacing could be improved: To =~ /( {%- set domains = \[mailserver_domain] %} {%- for domain in custom_domains | default( [] ) %} {%- set domains = domains.append( domain ) %} {%- endfor %} {{- domains | join('|') -}} )/
To =~ /(
{%- set domains = [mailserver_domain] %}
{%- for domain in custom_domains|default([]) %}
{%- for domain in custom_domains | default( [] ) %}
{%- set domains = domains.append( domain ) %}
{%- endfor %}
{{- domains|join('|') -}}
{{- domains | join('|') -}}
)/
- { type: "meta", key: "NO_DOMAIN_IN_TO", value: "!__DOMAIN_IN_TO" }
- { type: "score", key: "NO_DOMAIN_IN_TO", value: "3.0" }
Expand Down
50 changes: 25 additions & 25 deletions handlers/main.yml
Original file line number Diff line number Diff line change
@@ -1,90 +1,90 @@
---
- name: Restart amavisd
systemd:
ansible.builtin.systemd_service:
name: amavisd
daemon_reload: yes
enabled: yes
state: restarted
- name: Restart clamav-freshclam
systemd:
ansible.builtin.systemd_service:
name: clamav-freshclam
daemon_reload: yes
enabled: yes
state: restarted
- name: "Restart dirsrv@{{ mailserver_hostname }}"
systemd:
ansible.builtin.systemd_service:
name: "dirsrv@{{ mailserver_hostname }}"
daemon_reload: yes
enabled: yes
state: restarted
- name: Restart dnsdist
systemd:
ansible.builtin.systemd_service:
name: dnsdist
daemon_reload: yes
enabled: yes
state: restarted
- name: Restart dovecot
systemd:
ansible.builtin.systemd_service:
name: dovecot
daemon_reload: yes
enabled: yes
state: restarted
- name: Restart fail2ban
systemd:
ansible.builtin.systemd_service:
name: fail2ban
daemon_reload: yes
enabled: yes
state: restarted
- name: Restart firewalld
systemd:
ansible.builtin.systemd_service:
name: firewalld
daemon_reload: yes
enabled: yes
state: restarted
- name: Restart httpd
systemd:
ansible.builtin.systemd_service:
name: httpd
daemon_reload: yes
enabled: yes
state: restarted
- name: Restart mongod
systemd:
ansible.builtin.systemd_service:
name: mongod
daemon_reload: yes
enabled: yes
state: restarted
- name: Restart NetworkManager
systemd:
ansible.builtin.systemd_service:
name: NetworkManager
daemon_reload: yes
enabled: yes
state: restarted
- name: Restart opendkim
systemd:
ansible.builtin.systemd_service:
name: opendkim
daemon_reload: yes
enabled: yes
state: restarted
- name: Restart opendmarc
systemd:
ansible.builtin.systemd_service:
name: opendmarc
daemon_reload: yes
enabled: yes
state: restarted
- name: Restart pdns
systemd:
ansible.builtin.systemd_service:
name: pdns
daemon_reload: yes
enabled: yes
state: restarted
- name: Restart pdns-recursor
systemd:
ansible.builtin.systemd_service:
name: pdns-recursor
daemon_reload: yes
enabled: yes
state: restarted
- name: Restart php-fpm
systemd:
ansible.builtin.systemd_service:
name: "{{ php_fpm_service }}"
daemon_reload: yes
enabled: yes
Expand All @@ -95,55 +95,55 @@
loop_control:
loop_var: php_fpm_service
- name: Restart postfix
systemd:
ansible.builtin.systemd_service:
name: postfix
daemon_reload: yes
enabled: yes
state: restarted
- name: Restart postgrey
systemd:
ansible.builtin.systemd_service:
name: postgrey
daemon_reload: yes
enabled: yes
state: restarted
- name: Restart spamassassin
systemd:
ansible.builtin.systemd_service:
name: spamassassin
daemon_reload: yes
enabled: yes
state: restarted
- name: Restart spamass-milter
systemd:
ansible.builtin.systemd_service:
name: spamass-milter
daemon_reload: yes
enabled: yes
state: restarted
- name: Default to localhost in resolv.conf
copy:
ansible.builtin.copy:
dest: /etc/resolv.conf
content: |
nameserver 127.0.0.1
nameserver ::1
search {{ ([mailserver_domain] + custom_domains)|join(' ') }}
search {{ ([mailserver_domain] + custom_domains) | join(' ') }}
backup: true
force: true
owner: root
group: root
mode: 0644
- name: Restart systemd-resolved
systemd:
ansible.builtin.systemd_service:
name: systemd-resolved
daemon_reload: yes
enabled: yes
state: restarted
- name: Restart vsftpd
systemd:
ansible.builtin.systemd_service:
name: vsftpd
daemon_reload: yes
enabled: yes
state: restarted
- name: Restart WireGuard
systemd:
ansible.builtin.systemd_service:
name: "wg_vpn.{{ systemd_unit_type }}"
daemon_reload: yes
state: started
Expand All @@ -153,5 +153,5 @@
loop_control:
loop_var: systemd_unit_type
- name: Warn on passwords
debug:
ansible.builtin.debug:
msg: "!!!WARNING!!! All web UI admin passwords are set to the same as your admin user's password. For your own safety, change them before going live"
5 changes: 3 additions & 2 deletions meta/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ galaxy_info:
# - CC-BY-4.0
license: GPL-3.0-only

min_ansible_version: 2.9
min_ansible_version: "2.9"

# If this a Container Enabled role, provide the minimum Ansible Container version.
# min_ansible_container_version:
Expand Down Expand Up @@ -54,7 +54,8 @@ dependencies: []
# List your role dependencies here, one per line. Be sure to remove the '[]' above,
# if you add dependencies to this list.
collections:
- community.crypto
- ansible.posix
- community.general
- community.crypto
- community.dns
- community.mysql
34 changes: 22 additions & 12 deletions tasks/add_dns_record.yml
Original file line number Diff line number Diff line change
@@ -1,22 +1,32 @@
---
- name: 'Quote and escape record content "{{ record.content }}"'
set_fact:
- name: 'Quote and escape record content "{{ record.content }}"' # noqa name[template] we need to be informative, even if we deviate from the standards
ansible.builtin.set_fact:
record_content: '"{{ record.content }}"'
- name: Add DNS record
when: "{{ (record.append is defined and record.append) and (record.content not in lookup('community.general.dig', record.name ~ '.' ~ record.zone ~ './' ~ record.type)|split(',')) }}"
when: (record.append is defined and record.append) and (record.content not in lookup('community.general.dig', record.name ~ '.' ~ record.zone ~ './' ~ record.type) | split(','))
block:
- name: 'Add DNS record {{ record.name }}.{{ record.zone }} {{ record.ttl|default("3600") }} IN {{ record.type }} {{ record.content }}'
command: "pdnsutil add-record {{ record.zone }} {{ record.name }} {{ record.type }} {{ record.ttl|default('3600') }} '{{ record.content }}'"
- name: 'Add DNS record {{ record.name }}.{{ record.zone }} {{ record.ttl | default("3600") }} IN {{ record.type }} {{ record.content }}' # noqa name[template] we need to be informative, even if we deviate from the standards
ansible.builtin.command: "pdnsutil add-record {{ record.zone }} {{ record.name }} {{ record.type }} {{ record.ttl | default('3600') }} '{{ record.content }}'"
register: add_record
changed_when: add_record.rc == 0
rescue:
- name: 'Add DNS record {{ record.name }}.{{ record.zone }} {{ record.ttl|default("3600") }} IN {{ record.type }} {{ record.content }}'
command: "pdnsutil add-record {{ record.zone }} {{ record.name }} {{ record.type }} {{ record.ttl|default('3600') }} '{{ record_content }}'"
- name: 'Add DNS record {{ record.name }}.{{ record.zone }} {{ record.ttl | default("3600") }} IN {{ record.type }} {{ record.content }}' # noqa name[template] we need to be informative, even if we deviate from the standards
ansible.builtin.command: "pdnsutil add-record {{ record.zone }} {{ record.name }} {{ record.type }} {{ record.ttl | default('3600') }} '{{ record_content }}'"
register: add_record
changed_when: add_record.rc == 0
- name: Update or add DNS record
when: record.append is not defined or not record.append
block:
- name: 'Update DNS record {{ record.name }}.{{ record.zone }} {{ record.ttl|default("3600") }} IN {{ record.type }} {{ record.content }}'
command: "pdnsutil replace-rrset {{ record.zone }} {{ record.name }} {{ record.type }} {{ record.ttl|default('3600') }} '{{ record.content }}'"
- name: 'Update DNS record {{ record.name }}.{{ record.zone }} {{ record.ttl | default("3600") }} IN {{ record.type }} {{ record.content }}' # noqa name[template] we need to be informative, even if we deviate from the standards
ansible.builtin.command: "pdnsutil replace-rrset {{ record.zone }} {{ record.name }} {{ record.type }} {{ record.ttl | default('3600') }} '{{ record.content }}'"
register: update_record
changed_when: update_record.rc == 0
rescue:
- name: 'Update DNS record {{ record.name }}.{{ record.zone }} {{ record.ttl|default("3600") }} IN {{ record.type }} {{ record.content }}'
command: "pdnsutil replace-rrset {{ record.zone }} {{ record.name }} {{ record.type }} {{ record.ttl|default('3600') }} '{{ record_content }}'"
- name: 'Update DNS record {{ record.name }}.{{ record.zone }} {{ record.ttl | default("3600") }} IN {{ record.type }} {{ record.content }}' # noqa name[template] we need to be informative, even if we deviate from the standards
ansible.builtin.command: "pdnsutil replace-rrset {{ record.zone }} {{ record.name }} {{ record.type }} {{ record.ttl | default('3600') }} '{{ record_content }}'"
register: update_record
changed_when: update_record.rc == 0
- name: Rectify all zones
command: pdnsutil rectify-all-zones
ansible.builtin.command: pdnsutil rectify-all-zones
register: rectify_zones
changed_when: rectify_zones.rc == 0
14 changes: 8 additions & 6 deletions tasks/antivirus.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
---
- name: Set SELinux booleans
when: "{{ getenforce.stdout != 'Disabled' }}"
seboolean:
when: getenforce.stdout != 'Disabled'
ansible.posix.seboolean:
name: antivirus_can_scan_system
state: yes
persistent: yes
- name: Render AMAVISD config
template:
ansible.builtin.template:
src: amavisd/amavisd.conf.j2
dest: /etc/amavisd/amavisd.conf
mode: u=rw,og=r
Expand All @@ -15,15 +15,17 @@
backup: yes
notify: Restart amavisd
- name: Refresh ClamAV database
command: freshclam
ansible.builtin.command: freshclam
register: start_freshclam
changed_when: start_freshclam.rc == 0
notify: Restart clamav-freshclam
- name: Update SPAMAssassin's signatures
command: sa-update -D
ansible.builtin.command: sa-update -D
register: sa_update
failed_when: "{{ sa_update.rc >= 4 }}"
notify: Restart spamassassin
- name: Enable systemd services
systemd:
ansible.builtin.systemd_service:
name: "{{ item }}"
daemon_reload: yes
enabled: yes
Expand Down
8 changes: 4 additions & 4 deletions tasks/autorestart.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
---
- name: "Create restart directories for {{ service }}"
file:
- name: "Create restart directories for {{ service }}" # noqa name[template] we need to be informative, even if we deviate from the standards
ansible.builtin.file:
state: directory
path: "/etc/systemd/system/{{ service }}.service.d"
mode: u=rwX,og=rX
owner: root
group: root
- name: "Deploy restart files for {{ service }}"
copy:
- name: "Deploy restart files for {{ service }}" # noqa name[template] we need to be informative, even if we deviate from the standards
ansible.builtin.copy:
src: systemd/restart.conf
dest: "/etc/systemd/system/{{ service }}.service.d/restart.conf"
mode: u=rw,og=r
Expand Down
Loading