main.yml 759 Bytes
Newer Older
1
2
3
4
5
---
- name: install ssmtp and mailx
  become: yes
  package:
    name: "{{ item }}"
julian.gethmann's avatar
julian.gethmann committed
6
    state: present
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
  with_items:
    - ssmtp
    - mailx

- name: configure ssmtp user
  become: yes
  lineinfile:
    line: "{{ item }}={{ admin_mail }}"
    regexp: "^{{ item }}=.*$"
    backup: yes
    path: /etc/ssmtp/ssmtp.conf
    state: present
  with_items:
    - root

- name: configure ssmtp mailhub
  become: yes
  lineinfile:
    line: mailhub=smarthost.kit.edu
    regexp: ^mailhub=.*$
    backup: yes
    path: /etc/ssmtp/ssmtp.conf
    state: present

- name: configure ssmtp alias for root
  become: yes
  lineinfile:
    line: "root:{{ admin_mail }}:smarthost.kit.edu"
    regexp: ^root:.*$
    backup: yes
    path: /etc/ssmtp/revaliases
    state: present