From 2ab0ac63127e2e4be8e3e540d59d467457959027 Mon Sep 17 00:00:00 2001 From: Lorin Hochstein Date: Sun, 5 Feb 2017 14:03:01 -0800 Subject: [PATCH] image facts --- ch13/image-facts.yml | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/ch13/image-facts.yml b/ch13/image-facts.yml index d346211..0037f2f 100644 --- a/ch13/image-facts.yml +++ b/ch13/image-facts.yml @@ -8,6 +8,21 @@ - name: get image info docker_image_facts: name=ghost register: ghost - - debug: - msg: "Ports: {{ ghost.images[0].Config.ExposedPorts}}" + - name: extract ports + set_fact: + ports: "{{ ghost.images[0].Config.ExposedPorts.keys() }}" + - name: we expect only one port to be exposed + assert: + that: "ports|length == 1" + - name: output exposed port + debug: + msg: "Exposed port: {{ ports[0] }}" + - name: extract volumes + set_fact: + volumes: "{{ ghost.images[0].Config.Volumes.keys() }}" + - name: output volumes + debug: + msg: "Volume: {{ item }}" + with_items: "{{ volumes }}" + -- 2.44.0