- name: Use role in loop
  include_role:
    name: "{{ role_plone_role }}"
  loop:
    - 'base_install'
    - 'general/pffirewall'
    - 'general/pfpyroutinecheck'
    - 'general/pfbackup'
    - 'general/sshd_config'
  tags:
    - pyroutinecheck
    - pfbackup
    - pffirewall
  loop_control:
    loop_var: role_plone_role

# Can be used on new systems to configure monit
#- name: add role monit
#  tags: monit
#  include_role:
#    name: general/perfact-monit

- name: install postfix
  become: true
  ansible.builtin.package:
    name: postfix
    state: present

- name: configure postfix
  become: true
  ansible.builtin.template:
    src: etc/postfix/main.cf.j2
    dest: /etc/postfix/main.cf
  notify: reload postfix.service

# This is a dependecy from the pypyroutinecheck
- name: create mailname file
  become: true
  ansible.builtin.copy:
    content: "{{ postfix_smtp_mailname }}"
    dest: /etc/mailname

# commit changes made by ansible
- name: git commit
  become: true
  ansible.builtin.shell: git diff --quiet || { git add --all && git commit -m "Changes by ansible" ; }
  args:
    chdir: /etc/
