---
- name: docker-mailserver
  hosts: ulna

  tasks:
  - name: Create docker-mailserver directory
    ansible.builtin.file:
      path: docker-mailserver
      state: directory

  - name: Copy docker-compose.yml
    ansible.builtin.template:
      src: templates/docker-mailserver/docker-compose.yml.j2
      dest: docker-mailserver/docker-compose.yml

  - name: Copy mailserver.env
    ansible.builtin.template:
      src: templates/docker-mailserver/mailserver.env.j2
      dest: docker-mailserver/mailserver.env

  - name: Start container
    community.docker.docker_compose:
      project_src: docker-mailserver
      pull: true
    become: true
