# Master playbook
- name: Forksand Bootstrap Postfix
  hosts: all
  become: true
  tasks:
    - name: Run server tasks
      import_role:
        name: server_tasks

    - name: Install and configuration letsencrypt
      import_role:
        name: letsencrypt_configuration
      vars:
        mail_domain: "{{ var_mail_domain }}"
        relay_domain: "{{ var_relay_domain }}"

    - name: Install and configure postfix
      import_role:
        name: postfix_configuration
      vars:
        domain: "{{ var_domain }}"
        relay_domain: "{{ var_relay_domain }}"
        mail_domain: "{{ var_mail_domain }}"

    - name: Install and configure OpenDKIM
      import_role:
        name: dkim_configuration
      vars:
        domain: "{{ var_domain }}"
        mail_domain: "{{ var_mail_domain }}"

    - name: Install and configure Dovecot
      import_role:
        name: dovecot_configuration
      vars:
        mail_domain: "{{ var_mail_domain }}"

    - name: Install and configure Spamassassin
      import_role:
        name: spamassassin_configuration

    - name: Install and configure SQLGrey
      import_role:
        name: sqlgrey_configuration

    - name: Install and configure Fail2Ban
      import_role:
        name: fail2ban_configuration

    - name: Clean apt cache
      apt:
        autoclean: yes

    - name: Print DNS outputs to screen
      import_role:
        name: outputs
      vars:
        domain: "{{ var_domain }}"
