EvoBSD/roles/base/tasks/mail.yml
Jérémy Dubois f97317b767
Some checks failed
continuous-integration/drone/push Build is failing
Better rc.local configuration
Add line before the "echo '.'" line instead of the end
Delete old entry not precising the hostname if still there
2020-10-08 15:19:52 +02:00

31 lines
612 B
YAML

---
- name: Configure rc.local
lineinfile:
path: /etc/rc.local
line:
'date | mail -s "boot/reboot of $(hostname -s)" {{ general_alert_email }}'
insertbefore: 'echo'
create: true
tags:
- misc
- name: Delete rc.local entry of boot/reboot not precising hostname
lineinfile:
path: /etc/rc.local
regexp:
"^.* mail -s (?!.*of.*).+$"
state: absent
tags:
- misc
- name: Set root mail alias
replace:
dest: /etc/mail/aliases
regexp: "# root:"
replace: "root: {{ general_alert_email }}"
backup: false
notify:
- newaliases
tags:
- mail