On 31. aug. 2016 16:45, Kai Stian Olstad wrote:
On 30. aug. 2016 21:36, [email protected] wrote:
Is
there something I'm missing about how blocks are executed? Is there a
better way to rewrite this set of tasks?

- block:
    - name: Install system dependencies for project
      become: True
      apt: pkg={{ item }} state=installed
      with_items: " {{ project_config.apt|default([]) }}"
      # when: project_config is defined and 'apt' in project_config

This will work.
First project_config need to be filtered through default, and then project_config.apt.

  with_items: " {{ (project_config | default([])).apt | default([]) }}"


If project_config is not defined this will work
  with_items: "{{ project_config | default([]) }}"

but thees two will give a deprecation warning
  with_items: "{{ project_config.apt | default([]) }}"
  with_items: "{{ project_config['apt'] | default([]) }}"

To me this looks like a bug.

This is not a bug, please disregards my statement.

--
Kai Stian Olstad

--
You received this message because you are subscribed to the Google Groups "Ansible 
Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/c1174ced-f04c-c74e-d33a-07386e24ad62%40olstad.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to