add openbsd support to opensmtpd role

This commit is contained in:
Timo Makinen 2019-05-22 22:58:25 +03:00
parent 745b4a5a77
commit e022e3f991
5 changed files with 45 additions and 16 deletions

View file

@ -1,34 +1,41 @@
---
- name: include OS-specific variables
include_vars: "{{ item }}"
with_first_found:
- "{{ ansible_os_family }}.yml"
- default.yml
- name: install opensmtpd
package:
name: opensmtpd
state: installed
- name: set default mta to opensmtpd
alternatives:
name: mta
path: /usr/sbin/sendmail.opensmtpd
- 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
template:
src: smtpd.conf.j2
dest: /etc/opensmtpd/smtpd.conf
dest: "{{ opensmtpd_config }}"
mode: 0644
owner: root
group: root
group: "{{ ansible_wheel }}"
notify: restart opensmtpd
- name: force server name to domain name
copy:
content: "{{ mail_domain }}\n"
dest: /etc/opensmtpd/mailname
dest: "{{ opensmtpd_confdir }}/mailname"
mode: 0644
owner: root
group: root
group: "{{ ansible_wheel }}"
notify: restart opensmtpd
- name: enable opensmtpd
service:
name: opensmtpd
name: "{{ opensmtpd_service }}"
state: started
enabled: true