---
- hosts: 127.0.0.1
  connection: local
  gather_facts: yes
  tasks:
    - name: remove docker containers
      docker_container:
        name: "{{ item }}"
        state: absent
        force_kill: yes
      loop:
        - ansible-docker-test-docker-inventory-container-1
        - ansible-docker-test-docker-inventory-container-2

    - name: remove docker pagkages
      action: "{{ ansible_facts.pkg_mgr }}"
      args:
        name:
          - docker
          - docker-ce
          - docker-ce-cli
        state: absent
