---
- name: Create
  hosts: localhost
  connection: local

  gather_facts: false

  pre_tasks:
    - name: Create network
      community.docker.docker_network:
        name: zabbix

  tasks:
    - name: "Create OS container"
      community.docker.docker_container:
        state: started
        recreate: true
        name: "{{ item.name }}"
        image: "{{ item.image }}"
        privileged: "{{ item.privileged | default(omit) }}"
        command: "{{ item.command | default(omit) }}"
        networks: "{{ item.networks | default(omit) }}"
        volumes: "{{ item.volumes | default(omit) }}"
        cgroupns_mode: "{{ item.cgroupns_mode | default(omit) }}"
      loop: "{{ molecule_yml.platforms }}"

    - name: "Wait for 15 seconds"
      ansible.builtin.wait_for:
        timeout: 15
