Ansible with Docker Flashcards
What features make Ansible more amenable to Docker?
1) Docker remote API: simplifies automation
How does Docker simplifies working with Docker?
1) Orchestration
2) Provisioning
Why use Ansible for with Docker?
1) Dockerfiles work fine for simple images.
2) Complex processes, Ansible is a better fit
3) Allows you to reuse your existing Ansible roles and standardize across the company
4) Supports deploying to Kubernetes and OpenShift
What module is used to manipulate docker images with Ansible?
docker_container
Provide ansible command for download an image from docker registry
> ansible -m docker_container -a “name=test-ghost image=ghost ports=8000:2368”
Provide Ansible command for removing an image from local storage
> ansible -m docker_container -a “name=test-ghost state=absent”
Sketch the task for creating an nginx image with config file config/nginx.conf
- name: cresate nginx image
docker_image:
name: config/nginx.conf
path: nginx
What happen with ansible_image module if I run the create image task twice?
The second time will do nothing if the image was created the first time
I want to ensure that if I run the task for creating an image the second time, a new image will be created. What do I have to do if anything?
add force: true to the task when running it the second time
What is the recommended way for creating images when change happen?
1) Do not override the previous image with force:true
2) Instead create a new image with a different tag
How do I log in into docker registry from Ansible?
Use docker_login module
How do I gather facts on a locally stored image?
Use docker_image_facts module
How do you create a network for connecting containers with snsible?
docker_network
What is the docker inventory plugin?
Docker inventory plugin is a plugin that allows ansible to talk to the docker daemon and build an inventory dynamically.