Skip to content

Instantly share code, notes, and snippets.

@fridim
Created August 2, 2018 10:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fridim/ebbbc86bb732f262f4239179acb2b8b3 to your computer and use it in GitHub Desktop.
Save fridim/ebbbc86bb732f262f4239179acb2b8b3 to your computer and use it in GitHub Desktop.
PLAY [localhost] ******************************************************************************************************************************************************************************
TASK [set_fact] *******************************************************************************************************************************************************************************
ok: [localhost]
TASK [include_role : /tmp/testrole] ***********************************************************************************************************************************************************
TASK [/tmp/testrole : set_fact] ***************************************************************************************************************************************************************
skipping: [localhost]
TASK [/tmp/testrole : debug] ******************************************************************************************************************************************************************
ok: [localhost] => {
"msg": "loop number 1. stop == False"
}
TASK [/tmp/testrole : set_fact] ***************************************************************************************************************************************************************
ok: [localhost]
TASK [/tmp/testrole : debug] ******************************************************************************************************************************************************************
ok: [localhost] => {
"msg": "loop number 2. stop == True"
}
TASK [/tmp/testrole : set_fact] ***************************************************************************************************************************************************************
skipping: [localhost]
TASK [/tmp/testrole : debug] ******************************************************************************************************************************************************************
ok: [localhost] => {
"msg": "loop number 3. stop == True"
}
TASK [/tmp/testrole : set_fact] ***************************************************************************************************************************************************************
skipping: [localhost]
TASK [/tmp/testrole : debug] ******************************************************************************************************************************************************************
ok: [localhost] => {
"msg": "loop number 4. stop == True"
}
TASK [/tmp/testrole : set_fact] ***************************************************************************************************************************************************************
skipping: [localhost]
TASK [/tmp/testrole : debug] ******************************************************************************************************************************************************************
ok: [localhost] => {
"msg": "loop number 5. stop == True"
}
PLAY RECAP ************************************************************************************************************************************************************************************
localhost : ok=7 changed=0 unreachable=0 failed=0
- hosts: localhost
connection: local
gather_facts: no
tasks:
- set_fact:
stop: false
- name: test loop
with_items:
- 1
- 2
- 3
- 4
- 5
vars:
index: "{{ item }}"
include_role:
name: "/tmp/testrole"
when: not stop
---
- set_fact:
stop: true
when: index == '2' or index == 2
- debug:
msg: "loop number {{index}}. stop == {{stop}}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment