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
|
||||
service:
|
||||
name: "{{ opensmtpd_service }}"
|
||||
name: smtpd
|
||||
state: restarted
|
||||
|
|
|
@ -1,25 +1,13 @@
|
|||
---
|
||||
- name: include OS-specific variables
|
||||
include_vars: "{{ item }}"
|
||||
with_first_found:
|
||||
- "{{ ansible_os_family }}.yml"
|
||||
- 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: check support
|
||||
fail:
|
||||
msg: Role not supported in your system
|
||||
when: ansible_os_family != "OpenBSD"
|
||||
|
||||
- name: create smtpd.conf from template
|
||||
template:
|
||||
src: smtpd.conf.j2
|
||||
dest: "{{ opensmtpd_config }}"
|
||||
dest: /etc/mail/smtpd.conf
|
||||
mode: 0644
|
||||
owner: root
|
||||
group: "{{ ansible_wheel }}"
|
||||
|
@ -28,7 +16,7 @@
|
|||
- name: force server name to domain name
|
||||
copy:
|
||||
content: "{{ mail_domain }}\n"
|
||||
dest: "{{ opensmtpd_confdir }}/mailname"
|
||||
dest: /etc/mail//mailname
|
||||
mode: 0644
|
||||
owner: root
|
||||
group: "{{ ansible_wheel }}"
|
||||
|
@ -36,6 +24,6 @@
|
|||
|
||||
- name: enable opensmtpd
|
||||
service:
|
||||
name: "{{ opensmtpd_service }}"
|
||||
name: smtpd
|
||||
state: started
|
||||
enabled: true
|
||||
|
|
|
@ -1,17 +1,9 @@
|
|||
{% if ansible_lo0 is defined %}
|
||||
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
|
||||
{% if ansible_os_family in ["OpenBSD"] %}
|
||||
action "local" mbox alias <aliases>
|
||||
action "relay" relay host smtps://{{ mail_server }} mail-from "@{{ mail_domain }}"
|
||||
match for local action "local"
|
||||
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
Reference in a new issue