Support OpenSMTPd only on OpenBSD
This commit is contained in:
parent
c8f65fc7bd
commit
a1c96a5369
5 changed files with 9 additions and 40 deletions
|
@ -1,5 +1,5 @@
|
||||||
---
|
---
|
||||||
- name: restart opensmtpd
|
- name: restart opensmtpd
|
||||||
service:
|
service:
|
||||||
name: "{{ opensmtpd_service }}"
|
name: smtpd
|
||||||
state: restarted
|
state: restarted
|
||||||
|
|
|
@ -1,25 +1,13 @@
|
||||||
---
|
---
|
||||||
- name: include OS-specific variables
|
- name: check support
|
||||||
include_vars: "{{ item }}"
|
fail:
|
||||||
with_first_found:
|
msg: Role not supported in your system
|
||||||
- "{{ ansible_os_family }}.yml"
|
when: ansible_os_family != "OpenBSD"
|
||||||
- default.yml
|
|
||||||
|
|
||||||
- block:
|
|
||||||
- name: install opensmtpd
|
|
||||||
package:
|
|
||||||
name: opensmtpd
|
|
||||||
state: installed
|
|
||||||
- name: set default mta to opensmtpd
|
|
||||||
alternatives:
|
|
||||||
name: mta
|
|
||||||
path: /usr/sbin/sendmail.opensmtpd
|
|
||||||
when: opensmtpd_package is defined
|
|
||||||
|
|
||||||
- name: create smtpd.conf from template
|
- name: create smtpd.conf from template
|
||||||
template:
|
template:
|
||||||
src: smtpd.conf.j2
|
src: smtpd.conf.j2
|
||||||
dest: "{{ opensmtpd_config }}"
|
dest: /etc/mail/smtpd.conf
|
||||||
mode: 0644
|
mode: 0644
|
||||||
owner: root
|
owner: root
|
||||||
group: "{{ ansible_wheel }}"
|
group: "{{ ansible_wheel }}"
|
||||||
|
@ -28,7 +16,7 @@
|
||||||
- name: force server name to domain name
|
- name: force server name to domain name
|
||||||
copy:
|
copy:
|
||||||
content: "{{ mail_domain }}\n"
|
content: "{{ mail_domain }}\n"
|
||||||
dest: "{{ opensmtpd_confdir }}/mailname"
|
dest: /etc/mail//mailname
|
||||||
mode: 0644
|
mode: 0644
|
||||||
owner: root
|
owner: root
|
||||||
group: "{{ ansible_wheel }}"
|
group: "{{ ansible_wheel }}"
|
||||||
|
@ -36,6 +24,6 @@
|
||||||
|
|
||||||
- name: enable opensmtpd
|
- name: enable opensmtpd
|
||||||
service:
|
service:
|
||||||
name: "{{ opensmtpd_service }}"
|
name: smtpd
|
||||||
state: started
|
state: started
|
||||||
enabled: true
|
enabled: true
|
||||||
|
|
|
@ -1,17 +1,9 @@
|
||||||
{% if ansible_lo0 is defined %}
|
|
||||||
listen on lo0
|
listen on lo0
|
||||||
{% else %}
|
|
||||||
listen on lo
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
table aliases file:{{ opensmtpd_aliases }}
|
table aliases file:/etc/mail/aliases
|
||||||
|
|
||||||
# use obsolete smtps as it goes through firewalls better than 25
|
# use obsolete smtps as it goes through firewalls better than 25
|
||||||
{% if ansible_os_family in ["OpenBSD"] %}
|
|
||||||
action "local" mbox alias <aliases>
|
action "local" mbox alias <aliases>
|
||||||
action "relay" relay host smtps://{{ mail_server }} mail-from "@{{ mail_domain }}"
|
action "relay" relay host smtps://{{ mail_server }} mail-from "@{{ mail_domain }}"
|
||||||
match for local action "local"
|
match for local action "local"
|
||||||
match for any action "relay"
|
match for any action "relay"
|
||||||
{% else %}
|
|
||||||
accept from local for any relay via smtps://mail.foo.sh as "@foo.sh"
|
|
||||||
{% endif %}
|
|
||||||
|
|
|
@ -1,5 +0,0 @@
|
||||||
---
|
|
||||||
opensmtpd_confdir: /etc/mail
|
|
||||||
opensmtpd_config: "{{ opensmtpd_confdir }}/smtpd.conf"
|
|
||||||
opensmtpd_service: smtpd
|
|
||||||
opensmtpd_aliases: /etc/mail/aliases
|
|
|
@ -1,6 +0,0 @@
|
||||||
---
|
|
||||||
opensmtpd_confdir: /etc/opensmtpd
|
|
||||||
opensmtpd_config: "{{ opensmtpd_confdir }}/opensmtpd.conf"
|
|
||||||
opensmtpd_package: opensmtpd
|
|
||||||
opensmtpd_service: opensmtpd
|
|
||||||
opensmtpd_aliases: /etc/aliases
|
|
Loading…
Add table
Add a link
Reference in a new issue