A common use case for Ansible is to launch Docker containers from private images stored in Docker Hub. Once you have Docker installed, a playbook like this will get you started. This will log into your Docker Hub account, and start a container from a private image you specify:

- hosts: all
  become: true

    - name: log into docker hub registry
        email: "your-email@address"
        username: "a-dockerhub-username"
        password: "a-dockerhub-password"

    - name: ensure a container is running
        name: my_container
        state: started
        image: "my_username/my_container:master-latest"
        pull: true
          - "5000:5000"

We are specifying pull: true to make sure the image is always downloaded - Docker only does this automatically for the latest tag.