opensmtpd: add support for Debian
This commit is contained in:
parent
7916ae309e
commit
b64a5880b9
2 changed files with 21 additions and 4 deletions
|
@ -1,5 +1,5 @@
|
|||
- name: restart smtpd
|
||||
service:
|
||||
name: smtpd
|
||||
name: "{% if ansible_os_family == 'Alpine' %}smtpd{% else %}opensmtpd{% endif %}"
|
||||
state: restarted
|
||||
when: "'handler' not in ansible_skip_tags"
|
||||
|
|
|
@ -1,17 +1,34 @@
|
|||
# this role is currently for alpine linux only
|
||||
|
||||
- name: Install mail server
|
||||
package:
|
||||
name: opensmtpd
|
||||
|
||||
# Alpine puts its configuration in /etc/smtpd, Debian in /etc
|
||||
- when: ansible_os_family == 'Debian'
|
||||
block:
|
||||
- name: Create configuration directory
|
||||
file:
|
||||
path: /etc/smtpd
|
||||
state: directory
|
||||
|
||||
- name: Link configuration
|
||||
file:
|
||||
path: "/etc/smtpd/{{ item }}"
|
||||
src: "/etc/{{ item }}"
|
||||
state: link
|
||||
loop:
|
||||
- smtpd.conf
|
||||
- aliases
|
||||
notify: restart smtpd
|
||||
|
||||
- name: Configure mail server
|
||||
template:
|
||||
dest: /etc/smtpd/smtpd.conf
|
||||
src: smtpd.conf.j2
|
||||
follow: true
|
||||
notify: restart smtpd
|
||||
|
||||
- name: Enable mail server
|
||||
service:
|
||||
name: smtpd
|
||||
name: "{% if ansible_os_family == 'Alpine' %}smtpd{% else %}opensmtpd{% endif %}"
|
||||
enabled: yes
|
||||
state: started
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue