Deploy nullmailer

Signed-off-by: Yohann D'ANELLO <ynerant@crans.org>
This commit is contained in:
Yohann D'ANELLO 2021-06-04 15:56:40 +02:00
parent b592afcd38
commit 361125e4a5
Signed by: ynerant
GPG Key ID: 3A75C55819C8CF85
5 changed files with 53 additions and 0 deletions

View File

@ -0,0 +1,8 @@
---
glob_nullmailer:
root: root@ynerant.fr
smtp_server: smtp.adm.ynerant.fr
defaulthost: ynerant.fr
allmailfrom: root@ynerant.fr
username: noreply@ynerant.fr
password: "{{ vault.mailu_password }}"

3
hosts
View File

@ -18,6 +18,9 @@ ynerant-pc.fil.sand.auro.re
ynerant-thinkpad.wifi.sand.auro.re
localhost
[postfix]
mailu.adm.ynerant.fr
[reverseproxy]
proxy.adm.ynerant.fr

View File

@ -6,6 +6,7 @@
- import_playbook: ntp.yml
- import_playbook: ldap-client.yml
- import_playbook: home.yml
- import_playbook: nullmailer.yml
- hosts: debian
roles:

7
plays/nullmailer.yml Executable file
View File

@ -0,0 +1,7 @@
#!/usr/bin/env ansible-playbook
---
- hosts: debian,!postfix
vars:
nullmailer: "{{ glob_nullmailer | default({}) | combine(loc_nullmailer | default({})) }}"
roles:
- nullmailer

View File

@ -0,0 +1,34 @@
---
- name: Install nullmailer
apt:
update_cache: true
name:
- nullmailer
- bsd-mailx
register: apt_result
retries: 3
until: apt_result is succeeded
- name: Set nullmailer remotes
copy:
content: "{{ nullmailer.smtp_server }} smtp --auth-login --user={{ nullmailer.username }} --pass='{{ nullmailer.password }}'\n"
dest: /etc/nullmailer/remotes
mode: 0644
- name: Set nullmailer adminaddr
copy:
content: "{{ nullmailer.root }}\n"
dest: /etc/nullmailer/adminaddr
mode: 0644
- name: Set nullmailer defaulthost
copy:
content: "{{ nullmailer.defaulthost }}\n"
dest: /etc/nullmailer/defaulthost
mode: 0644
- name: Set nullmailer allmailfrom
copy:
content: "{{ nullmailer.allmailfrom }}\n"
dest: /etc/nullmailer/allmailfrom
mode: 0644