Facts are the bread and butter of how Ansible works and manages information about its controlled/automated systems. Facts represent data about the device and the current state. Ansible provides a set of playbook tasks that can be readily leveraged to gather facts about Docker images. Let's take a look at a couple of examples of how to accomplish this.
This is example 1:
- name: Inspect a single Docker image
docker_image_facts:
name: foo/centos-7
This is example 2:
- name: Inspect multiple Docker images
docker_image_facts:
name:
- foo/centos-7
- sinatra
The preceding playbook tasks inspect a single or multiple Docker image setup and report the facts. The fact data itself is stored in the return value. An example of the output is provided as follows:
[{'Container': 'e83a452b8fb8ff43oj094j4050131ca5c863629a47639530d9ad2008d610...