---
dependency:
  name: galaxy
  enabled: true
  options:
    requirements-file: common/collections.yml

driver:
  name: default

platforms:
  - name: zabbix-agent-${MY_MOLECULE_CONTAINER:-centos}
    image: geerlingguy/docker-${MY_MOLECULE_IMAGE:-rockylinux8}-ansible:latest
    command: ${MOLECULE_DOCKER_COMMAND:-""}
    privileged: true
    pre_build_image: true
    networks:
      - name: zabbix
    volumes:
      - /sys/fs/cgroup:/sys/fs/cgroup:rw
    cgroupns_mode: host
    groups:
      - agent
      - ${MY_MOLECULE_VERSION:-v72}

provisioner:
  name: ansible
  playbooks:
    create: ../../common/playbooks/create.yml
    prepare: ../../common/playbooks/prepare.yml
    converge: ../../common/playbooks/converge.yml
    destroy: ../../common/playbooks/destroy.yml
  env:
    ANSIBLE_REMOTE_TMP: /tmp/
    # https://github.com/ansible/molecule/issues/4015#issuecomment-1680859724
    ANSIBLE_ROLES_PATH: ../../../../roles
  inventory:
    group_vars:
      all:
        ansible_connection: community.docker.docker
        zabbix_agent_server: 192.168.3.33
        zabbix_agent_serveractive: 192.168.3.33
        zabbix_agent_listenip: 0.0.0.0
        zabbix_agent_tlsconnect: psk
        zabbix_agent_tlsaccept: psk,cert
        zabbix_agent_tlscertfile: /etc/zabbix/cert
        zabbix_agent_tlskeyfile: /etc/zabbix/key
        zabbix_agent_tlscafile: /etc/zabbix/ca
        zabbix_repo_apt_priority: 1
        zabbix_repo_yum_gpg_check: 1
      v72:
        zabbix_agent_version: 7.2
      v70:
        zabbix_agent_version: 7.0
      v64:
        zabbix_agent_version: 6.4
      v60:
        zabbix_agent_version: 6.0

scenario:
  test_sequence:
    - dependency
    - cleanup
    - destroy
    - syntax
    - create
    - prepare
    - converge
    - idempotence
    - side_effect
    - verify
    - cleanup
    - destroy

verifier:
  name: testinfra
