Guest User

Untitled

a guest
Apr 24th, 2018
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.93 KB | None | 0 0
  1. - name: "Setting place name of {{ country }}"
  2. set_fact:
  3. place: "get_place_name"
  4.  
  5. - name: "Setting places name of {{ country }}"
  6. set_fact:
  7. places: "get_places_name"
  8.  
  9. - name: Details of "{{ country }}"
  10. debug:
  11. msg: "{{ item }}"
  12. when:
  13. - place in "{{ item.Other_Places }}" or places in "{{ item.Other_Places }}"
  14. with_items: "{{ Places }}"
  15.  
  16. ---
  17. Places:
  18. - Country: "{{ country }}"
  19. Capital: "{{ capital}}}"
  20. Other_Places: ['place1', 'place2']
  21.  
  22. - Country: "{{ country }}"
  23. Capital: "{{ capital }}"
  24. Other_Places: ['places1', 'places2', 'places3', 'places4']
  25.  
  26. "msg": {
  27. "Country": "United States of America",
  28. "Capital": "place1",
  29. "Other_Places": "['place1', 'place2']"
  30. }
  31.  
  32. - name: Exceptional case
  33. debug:
  34. msg: "{{ capital }} not in {{ item.Capital }} "
  35. when:
  36. - place not in "{{ item.Other_Places }}" or places not in "{{ item.Other_Places }}"
  37. with_items: "{{ Places }}"
Add Comment
Please, Sign In to add comment