Giter Club home page Giter Club logo

ansible-role-exim's Introduction

Ansible Role: Exim

CI

Installs Exim (a Mail Transfer Agent) on RedHat/CentOS or Debian/Ubuntu.

Requirements

None.

Role Variables

Available variables are listed below, along with default values (see defaults/main.yml):

exim_dc_eximconfig_configtype: internet

(Debian/Ubuntu only) Main configuration type. Should be 'internet' for public mail sending, or 'local' if mail should only be delivered locally. See Exim documentation for other options.

exim_dc_localdelivery: mail_spool

(Debian/Ubuntu only) Default transport for local mail delivery. Defaults to mail_spool if unset.

exim_primary_hostname: ""

Force a primary server hostname for Exim. Usually you don't need to set this, but if Exim can't reliably determine the FQDN of your server, you can set this and it will ensure Exim uses the correct hostname.

Dependencies

None.

Example Playbook

- hosts: servers
  roles:
    - geerlingguy.exim

License

MIT / BSD

Author Information

This role was created in 2015 by Jeff Geerling, author of Ansible for DevOps.

ansible-role-exim's People

Contributors

geerlingguy avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

ansible-role-exim's Issues

Error on Debian on first check_mode run

Hello,

This role fails on Debian when playing the following tasks in check_mode on a fresh server :

- name: Configure exim (Debian only).
  lineinfile:
    dest: "{{ exim_configuration_file }}"
    regexp: "{{ item.regexp }}"
    line: "{{ item.line }}"
    state: present
  with_items:
    - regexp: '^dc_eximconfig_configtype'
      line: "dc_eximconfig_configtype='{{ exim_dc_eximconfig_configtype }}'"
    - regexp: '^dc_localdelivery'
      line: "dc_localdelivery='{{ exim_dc_localdelivery }}'"
  notify: restart exim
  when: ansible_os_family == 'Debian'

- name: Configure primary_hostname (if set).
  lineinfile:
    dest: "{{ exim_configuration_file }}"
    regexp: '^#?\s?primary_hostname'
    line: "primary_hostname={{ exim_primary_hostname }}"
    state: present
  notify: restart exim
  when: exim_primary_hostname is defined and exim_primary_hostname

- name: Ensure exim is running.
  service: "name={{ exim_daemon }} state=started enabled=yes"

with the following error message :

failed: [xxx] (item={'regexp': '^dc_eximconfig_configtype', 'line': "dc_eximconfig_configtype='internet'"}) => {"ansible_loop_var": "item", "changed": false, "item": {"line": "dc_eximconfig_configtype='internet'", "regexp": "^dc_eximconfig_configtype"}, "msg": "Destination /etc/exim4/update-exim4.conf.conf does not exist !", "rc": 257}
failed: [xxx] (item={'regexp': '^dc_localdelivery', 'line': "dc_localdelivery='mail_spool'"}) => {"ansible_loop_var": "item", "changed": false, "item": {"line": "dc_localdelivery='mail_spool'", "regexp": "^dc_localdelivery"}, "msg": "Destination /etc/exim4/update-exim4.conf.conf does not exist !", "rc": 257}

and :

fatal: [xxx]: FAILED! => {"changed": false, "msg": "Could not find the requested service exim4: host"}

because exim is not installed and therefore the destination file does not exist, just like the systemd service.

I suggest adding the following line to these tasks to ignore check_mode errors :

  ignore_errors: "{{ ansible_check_mode }}"

Add option of configuring primary_hostname

The primary_hostname in the Exim config file sometimes needs to be manually configured, because Exim has trouble picking up the actual hostname of the server (even if hostname -f outputs the correct hostname).

See http://www.jeffgeerling.com/blog/2016/how-get-your-servers-emails-through-gmails-spam-filter-exim for a little more background.

It would be nice to allow this to be configured... if for no other reason than it's one less task I have to maintain in my downstream playbooks for a few LEB servers where Exim is picking up the domain without the TLD (e.g. emails delivered from apache@example instead of [email protected].

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.