---
- name: "Create facts and tags directories"
  local_action:
    module: file
    path: "{{ item }}"
    state: directory
  with_items:
    - "{{ fact_dir }}"
    - "{{ tag_dir }}"
  become: False

# Common facts we want to apply to all images
- include: facts.yml

# We lookup any facts starting with nectar_image_property_ and read those
# into files, stripping off the prefix.
- name: Save facts
  local_action:
    module: copy
    content: "{{ vars[item] }}"
    dest: "{{ fact_dir }}/{{ item | regex_replace('^nectar_image_property_', '') }}"
  become: False
  with_items: "{{ vars | select('match', '^nectar_image_property_.*') | list }}"

# We lookup any tags starting with nectar_image_tag_ and read those
# into files, stripping off the prefix.
- name: Save tags
  local_action:
    module: copy
    content: ''  # empty
    dest: "{{ tag_dir }}/{{ item | regex_replace('^nectar_image_tag_', '') }}"
  become: False
  with_items: "{{ vars | select('match', '^nectar_image_tag_.*') | list }}"

---
- name: "Create facts and tags directories"
  local_action:
    module: file
    path: "{{ item }}"
    state: directory
  with_items:
    - "{{ fact_dir }}"
    - "{{ tag_dir }}"
  become: False

# Common facts we want to apply to all images
- include: facts.yml

# We lookup any facts starting with nectar_image_property_ and read those
# into files, stripping off the prefix.
- name: Save facts
  local_action:
    module: copy
    content: "{{ vars[item] }}"
    dest: "{{ fact_dir }}/{{ item | regex_replace('^nectar_image_property_', '') }}"
  become: False
  with_items: "{{ vars | select('match', '^nectar_image_property_.*') | list }}"

# We lookup any tags starting with nectar_image_tag_ and read those
# into files, stripping off the prefix.
- name: Save tags
  local_action:
    module: copy
    content: ''  # empty
    dest: "{{ tag_dir }}/{{ item | regex_replace('^nectar_image_tag_', '') }}"
  become: False
  with_items: "{{ vars | select('match', '^nectar_image_tag_.*') | list }}"

- name: Print image properties
  debug:
    msg: "{{ item | regex_replace('^nectar_image_property_', '') }} = {{ vars[item] }}"
  with_items: "{{ vars | select('match', '^nectar_image_property_.*') | list }}"

Add debugging to show image property facts
Add debugging to show image property facts

Change-Id: I52c79423f586c38f4ce5f7f7bad9478a9b1b2a0f
