Managing containers using Ansible
The Ansible collection, community.docker
(https://galaxy.ansible.com/community/docker), contains more than 25 Ansible modules and ~10 plugins for connection, inventory, and more. These modules will help you manage containers, container images, images in the container registry, the Docker network, Docker volumes, Docker swarm, and other container-based operations.
If you are using Podman, then check out the containers.podman
collection (https://galaxy.ansible.com/containers/podman) in Ansible Galaxy.
In the upcoming sections, you will learn how to build, start, and manage containers using Ansible.
Installing the Ansible Docker collection
Installing a collection is straightforward, as you learned in the previous chapters:
- Update your
ansible.cfg
with the collection path:
Figure 10.7 – ansible.cfg with the collection and role paths
- Install the
community.docker
Ansible collection: