Skip to content

Commit

Permalink
Add support for sSMTP revaliases configuration (#956)
Browse files Browse the repository at this point in the history
  • Loading branch information
valentinocossar authored and swalkinshaw committed Mar 30, 2018
1 parent e43b15d commit 6a5a325
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
### HEAD
* Add support for sSMTP revaliases configuration ([#956](https://github.com/roots/trellis/pull/956))
* Add support for includes.d on all sites ([#966](https://github.com/roots/trellis/pull/966))
* Fix `--subdomains` flag in the Install WP task ([#968](https://github.com/roots/trellis/pull/968))
* Ensure Diffie-Hellman group is generated for Let's Encrypt ([#964](https://github.com/roots/trellis/pull/964))
Expand Down
10 changes: 10 additions & 0 deletions roles/ssmtp/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,13 @@ ssmtp_auth_method: LOGIN
ssmtp_from_override: 'Yes'
ssmtp_start_tls: 'Yes'
ssmtp_tls: 'Yes'
# ssmtp_revaliases:
# - user: root
# from: from@example.com
# smtp_server: "{{ mail_smtp_server }}"
# - user: "{{ admin_user }}"
# from: from@example.com
# smtp_server: "{{ mail_smtp_server }}"
# - user: "{{ web_user }}"
# from: from@example.com
# smtp_server: "{{ mail_smtp_server }}"
5 changes: 5 additions & 0 deletions roles/ssmtp/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,8 @@
template:
src: ssmtp.conf.j2
dest: /etc/ssmtp/ssmtp.conf

- name: ssmtp revaliases configuration
template:
src: revaliases.j2
dest: /etc/ssmtp/revaliases
9 changes: 9 additions & 0 deletions roles/ssmtp/templates/revaliases.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# {{ ansible_managed }}

{% if ssmtp_revaliases is defined and ssmtp_revaliases is not none %}
{% for item in ssmtp_revaliases %}
{% if item.user is defined and item.user is not none and item.from is defined and item.from is not none and item.smtp_server is defined and item.smtp_server is not none %}
{{ item.user }}:{{ item.from }}:{{ item.smtp_server }}
{% endif %}
{% endfor %}
{% endif %}

0 comments on commit 6a5a325

Please sign in to comment.