Add exim role to base playbook

We want email to work.

Add a default value so that integration tests work - and update the
template so that if the value in the alias mapping is empty we don't
write out a half-formed alias.

Enable the epel repo on CentOS nodes in base-repos. This is done in
install_puppet.sh, but install_puppet.sh doesn't get run on ansible-only
nodes.

Change-Id: I68ad9f66c3b8672d9642c7764e50adac9cafdaf9
This commit is contained in:
Monty Taylor 2018-08-08 11:24:08 -05:00
parent 67b77279f5
commit a4a134815c
No known key found for this signature in database
GPG Key ID: 7BAE94BC7141A594
6 changed files with 35 additions and 5 deletions

View File

@ -8,3 +8,6 @@
- hosts: "!disabled"
roles:
- base-server
- role: exim
aliases:
root: "{{ ','.join(sysadmins|default([])) }}"

View File

@ -0,0 +1,21 @@
- name: Install epel-release
yum:
name: epel-release
# there is a bug (rhbz#1261747) where systemd can fail to enable
# services due to selinux errors after upgrade. A work-around is
# to install the latest version of selinux and systemd here and
# restart the daemon for good measure after it is upgraded.
- name: Install latest selinux-policy and systemd
yum:
name: "{{ item }}"
state: latest
loop:
- selinux-policy
- systemd
register: systemd_updated
- name: Restart systemd
systemd:
daemon_reload: yes
when: systemd_updated|changed

View File

@ -3,3 +3,8 @@
name: postfix
enabled: false
state: stopped
- name: Install exim
yum:
name: "{{ package }}"
enablerepo: epel

View File

@ -0,0 +1,4 @@
- name: Install Exim
package:
state: present
name: '{{ package }}'

View File

@ -14,11 +14,6 @@
skip: true
loop: "{{ query('first_found', params) }}"
- name: Install Exim
package:
state: present
name: '{{ package }}'
- name: Write Exim defaults file
template:
src: "{{ sysdefault_template }}"

View File

@ -13,5 +13,7 @@ noc: root
security: root
{% for k, v in aliases|dictsort %}
{% if v %}
{{ k }}: {{ v }}
{% endif %}
{% endfor %}