system-config/playbooks/roles/exim/tasks/main.yaml
Monty Taylor 57ee42601a
Replace with_first_found with lookup first_found
The with_ directives are discouraged now in place of use of loop: and/or
lookup filters. In the case of with_first_found, it confuses people
because with_ directives are usually a loop, but in this case it's
the task is always executed once. Using the first_found filter makes it
clearer that this is occuring.

While we're in there, remove uses of 'static: no'. Since 2.0 includes
are dynamic by default, so these are not necessary.

Change-Id: Ie429d7614b2f3322a646f46a8117d4b6ae29f737
2018-08-03 09:05:13 -05:00

50 lines
1.3 KiB
YAML

- name: Include OS-specific variables
include_vars: "{{ lookup('first_found', file_list) }}"
vars:
file_list:
- "{{ ansible_facts.distribution }}.{{ ansible_facts.architecture }}.yaml"
- "{{ ansible_facts.distribution }}.yaml"
- "{{ ansible_facts.os_family }}.yaml"
- "default.yaml"
- name: Include OS-specific tasks
include_tasks: "{{ lookup('first_found', params) }}"
vars:
params:
files:
- "{{ ansible_facts.distribution }}.{{ ansible_facts.lsb.codename }}.{{ ansible_facts.architecture }}.yaml"
- "{{ ansible_facts.distribution }}.{{ ansible_facts.architecture }}.yaml"
- "{{ ansible_facts.distribution }}.yaml"
- "{{ ansible_facts.os_family }}.yaml"
skip: true
- name: Install Exim
package:
state: present
name: '{{ package }}'
- name: Write Exim defaults file
template:
src: "{{ sysdefault_template }}"
dest: "{{ sysdefault_file }}"
mode: 0444
- name: Write /etc/aliases
template:
src: "aliases.j2"
dest: "/etc/aliases"
mode: 0444
- name: Write Exim config file
template:
src: "exim4.conf.j2"
dest: "{{ config_file }}"
mode: 0444
notify:
- Restart exim
- name: Enable exim
service:
name: "{{ service_name }}"
enabled: true