hadret.containers
Ansible Role: Containers
This Ansible role helps you create multiple Docker containers on a Linux system. It can also manage different Docker registries and networks.
Requirements
You need to have Docker installed for this role to work. Additionally, you will need the Python module docker (which is the Docker SDK for Python).
Role Variables
You can use three types of variables, which are lists: containers
, networks
, and registries
. They are empty by default, but you can see examples of each in defaults/main.yml.
Dependencies
The following roles are not mandatory, but they help ensure that the Docker service and the Docker Python SDK are available (both of which are essential).
Example Playbook
Here’s a simple playbook example:
- hosts: all
vars:
pip_package: python-pip
pip_install_packages:
- name: docker
networks:
- name: network-1
containers:
- name: hello-1
image: "hello-world"
state: started
restart_policy: always
networks:
- name: network-1
- name: hello-2
image: "hello-world"
state: started
restart_policy: always
networks:
- name: network-1
roles:
- geerlingguy.pip
- geerlingguy.docker
- hadret.containers
Credits
The molecule
tests and CI setup are inspired by the work of geerlingguy.
License
MIT
Author Information
This role was created by Filip Chabik in 2019.
Wrapper role on top of docker_container, docker_network and docker_login.
ansible-galaxy install hadret.containers