osmith has submitted this change. ( 
https://gerrit.osmocom.org/c/osmo-ci/+/43283?usp=email )

Change subject: ansible: build-host: configure email sending
......................................................................

ansible: build-host: configure email sending

Configure the hosts to forward e-mails addressed to "root", so we get
mdmonitor reports about failing raid devices.

Related: OS#7068
Change-Id: I22ea83de3417cbbb578345d34f18095c47441610
---
A ansible/roles/configure-email-sending/handlers/main.yml
A ansible/roles/configure-email-sending/tasks/main.yml
M ansible/setup-build-host.yml
3 files changed, 37 insertions(+), 0 deletions(-)

Approvals:
  fixeria: Looks good to me, approved
  Jenkins Builder: Verified
  laforge: Looks good to me, but someone else must approve




diff --git a/ansible/roles/configure-email-sending/handlers/main.yml 
b/ansible/roles/configure-email-sending/handlers/main.yml
new file mode 100644
index 0000000..cdbfca4
--- /dev/null
+++ b/ansible/roles/configure-email-sending/handlers/main.yml
@@ -0,0 +1,9 @@
+---
+- name: run newaliases
+  ansible.builtin.command:
+    cmd: newaliases
+
+- name: restart exim4
+  ansible.builtin.service:
+    name: exim4
+    state: restarted
diff --git a/ansible/roles/configure-email-sending/tasks/main.yml 
b/ansible/roles/configure-email-sending/tasks/main.yml
new file mode 100644
index 0000000..065c883
--- /dev/null
+++ b/ansible/roles/configure-email-sending/tasks/main.yml
@@ -0,0 +1,27 @@
+---
+- name: Set /etc/mailname
+  ansible.builtin.lineinfile:
+    path: /etc/mailname
+    regexp: '.*'
+    line: "{{ inventory_hostname }}"  # e.g. build4.osmocom.org
+
+- name: Set mail alias for root
+  ansible.builtin.lineinfile:
+    path: /etc/aliases
+    regexp: '^root:'
+    line: "root: [email protected]"
+  notify: run newaliases
+
+- name: Configure exim4 dc_smarthost
+  ansible.builtin.lineinfile:
+    path: /etc/exim4/update-exim4.conf.conf
+    regexp: '^dc_smarthost='
+    line: "dc_smarthost='mail.osmocom.org'"
+  notify: restart exim4
+
+- name: Configure exim4 dc_eximconfig_configtype
+  ansible.builtin.lineinfile:
+    path: /etc/exim4/update-exim4.conf.conf
+    regexp: '^dc_eximconfig_configtype='
+    line: "dc_eximconfig_configtype='smarthost'"
+  notify: restart exim4
diff --git a/ansible/setup-build-host.yml b/ansible/setup-build-host.yml
index ed8def5..8107a01 100644
--- a/ansible/setup-build-host.yml
+++ b/ansible/setup-build-host.yml
@@ -18,3 +18,4 @@
         update_cache: yes
   roles:
     - name: apt-allow-relinfo-change
+    - name: configure-email-sending

--
To view, visit https://gerrit.osmocom.org/c/osmo-ci/+/43283?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings?usp=email

Gerrit-MessageType: merged
Gerrit-Project: osmo-ci
Gerrit-Branch: master
Gerrit-Change-Id: I22ea83de3417cbbb578345d34f18095c47441610
Gerrit-Change-Number: 43283
Gerrit-PatchSet: 2
Gerrit-Owner: osmith <[email protected]>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: daniel <[email protected]>
Gerrit-Reviewer: fixeria <[email protected]>
Gerrit-Reviewer: laforge <[email protected]>
Gerrit-Reviewer: osmith <[email protected]>
Gerrit-Reviewer: pespin <[email protected]>

Reply via email to