---

- name: Is log2mail present ?
  ansible.builtin.stat:
    path: /etc/log2mail/config
  check_mode: no
  register: log2mail_config_dir
  tags:
    - mysql
    - log2mail

- name: Copy log2mail config
  ansible.builtin.template:
    src: log2mail.j2
    dest: /etc/log2mail/config/mysql.conf
    owner: log2mail
    group: adm
    mode: "0640"
  when: log2mail_config_dir.stat.exists
  tags:
    - mysql
    - log2mail
