spurin/masteringansible

Udemy Section-4 Video#16 : Example script 05 @ minute 3:55

Opened this issue · 0 comments

Hi James. There is nothing really wrong in the content of the video referenced here. I am just pointing out to you to reconsider to avoid using Jinja keywords for use in either Variable or Value. Please take a loot at Section-4 Video#16 : Example script 05 @ minute 3:55.

Please review my previous post as shown below.

ansible@ubuntu-c[05]-> $ cat Jinja2_playbook.yaml

---
-
hosts: all
tasks:
- name: Ansible Jinja2 if variable is defined ( where variable is defined )
debug:
msg: >
--== Ansible Jinja2 if variable is defined ( where variable is defined ) ==--
{% set example_variable = 'monkey' -%} # I replaced 'defined' to 'monkey'
{% if example_variable is defined -%} # !!! 'defined' is a keyword
example_variable is defined
{% else -%}
example_variable is not defined
{% endif %}
...