Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for sSMTP revaliases configuration #956

Merged
merged 3 commits into from
Mar 30, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 %}