---
# file: roles/logcheck/tasks/main.yaml
# vim:ft=ansible:

- name: 'Install logcheck packages'
  apt:
    state: 'latest'
    name: "{{ item }}"
  with_items:
    - logcheck
    - logcheck-database

- name: "Configure some /etc/logcheck/logcheck.conf settings"
  lineinfile:
    dest: '/etc/logcheck/logcheck.conf'
    regexp: '^\s*#(\s+{{ item.option }}\s*)=\s*'
    backrefs: 'yes'
    line: '\1{{ item.value }}'
    state: 'present'
  with_items:
    - { option: 'FQDN',       value: 0 }
    - { option: 'SENDMAILTO', value: '{{ global_notification_email_address }}' }

- copy:
    src: '{{ item }}'
    dest: '/etc/logcheck/ignore.d.server/{{ item|basename }}'
    owner: 'root'
    group: 'logcheck'
    mode: 0640
  with_fileglob:
    - ignore.d.server/*


---
# file: roles/logcheck/tasks/main.yaml
# vim:ft=ansible:

- name: 'Install logcheck packages'
  apt:
    state: 'latest'
    name: "{{ item }}"
  with_items:
    - logcheck
    - logcheck-database

- name: "Configure some /etc/logcheck/logcheck.conf settings"
  lineinfile:
    dest: '/etc/logcheck/logcheck.conf'
    regexp: '^\s*#?\s*{{ item.option }}\s*=\s*'
    line: '{{ item.option }}="{{ item.value }}"'
    state: 'present'
  with_items:
    - { option: 'FQDN',         value: 0 }
    - { option: 'SENDMAILTO',   value: '{{ global_notification_email_address }}' }
    - { option: 'INTRO',        value: 0 }
    - { option: 'REPORTLEVEL',  value: 'server' }
    - { option: 'MAILASATTACH', value: '0' }
    - { option: 'ADDTAG',       value: 'yes' }

- copy:
    src: '{{ item }}'
    dest: '/etc/logcheck/ignore.d.server/{{ item|basename }}'
    owner: 'root'
    group: 'logcheck'
    mode: 0640
  with_fileglob:
    - ignore.d.server/*


Fix a regexp typo and add extra config options to logcheck.conf
Fix a regexp typo and add extra config options to logcheck.conf
