Compare commits
No commits in common. "7bb27acd2c900a3bccaf33ecf5e4783743186478" and "7916ae309e55714b4bc2aee075df8c3784a6e3ce" have entirely different histories.
7bb27acd2c
...
7916ae309e
3 changed files with 4 additions and 30 deletions
|
@ -1,3 +0,0 @@
|
||||||
Install opensmtpd and configure it for sending local mail through a relay.
|
|
||||||
|
|
||||||
The NetBox configuration context must define `mail_relay` with the relay hostname and `mail_root` with the email address where mail for root should be forwarded.
|
|
|
@ -1,5 +1,5 @@
|
||||||
- name: restart smtpd
|
- name: restart smtpd
|
||||||
service:
|
service:
|
||||||
name: "{% if ansible_os_family == 'Alpine' %}smtpd{% else %}opensmtpd{% endif %}"
|
name: smtpd
|
||||||
state: restarted
|
state: restarted
|
||||||
when: "'handler' not in ansible_skip_tags"
|
when: "'handler' not in ansible_skip_tags"
|
||||||
|
|
|
@ -1,40 +1,17 @@
|
||||||
|
# this role is currently for alpine linux only
|
||||||
|
|
||||||
- name: Install mail server
|
- name: Install mail server
|
||||||
package:
|
package:
|
||||||
name: opensmtpd
|
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
|
- name: Configure mail server
|
||||||
template:
|
template:
|
||||||
dest: /etc/smtpd/smtpd.conf
|
dest: /etc/smtpd/smtpd.conf
|
||||||
src: smtpd.conf.j2
|
src: smtpd.conf.j2
|
||||||
follow: true
|
|
||||||
notify: restart smtpd
|
notify: restart smtpd
|
||||||
|
|
||||||
- name: Configure root mail alias
|
|
||||||
lineinfile:
|
|
||||||
path: /etc/smtpd/aliases
|
|
||||||
regexp: "^#? *root:"
|
|
||||||
line: "root: {{ mail_root }}"
|
|
||||||
|
|
||||||
- name: Enable mail server
|
- name: Enable mail server
|
||||||
service:
|
service:
|
||||||
name: "{% if ansible_os_family == 'Alpine' %}smtpd{% else %}opensmtpd{% endif %}"
|
name: smtpd
|
||||||
enabled: yes
|
enabled: yes
|
||||||
state: started
|
state: started
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue