Skip to content

Instantly share code, notes, and snippets.

@natefoo
Created December 5, 2013 20:46
Show Gist options
  • Save natefoo/7813567 to your computer and use it in GitHub Desktop.
Save natefoo/7813567 to your computer and use it in GitHub Desktop.
---
# file: test.yml
- hosts: localhost
vars:
foodata: null
roles:
- { role: foo, when: foodata }
---
# file: roles/foo/tasks/main.yml
- debug: msg="task1"
- debug: msg="task2"
with_subelements:
- foodata
- barsub
- debug: msg="task3"
% ansible-playbook -i hosts test.yml
PLAY [localhost] **************************************************************
GATHERING FACTS ***************************************************************
ok: [localhost]
TASK: [foo | debug msg="task1"] ***********************************************
skipping: [localhost]
TASK: [foo | debug msg="task2"] ***********************************************
fatal: [localhost] => subelements lookup expects a dictionary, got 'None'
FATAL: all hosts have already failed -- aborting
PLAY RECAP ********************************************************************
to retry, use: --limit @test.retry
localhost : ok=1 changed=0 unreachable=1 failed=0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment