confused about | mandatory

48 views
Skip to first unread message

Barry Kaplan

unread,
Jun 25, 2015, 3:56:10 AM6/25/15
to ansible...@googlegroups.com
What is the scope to which |mandatory applies? It seems that debug is not one of them:

  vars:
    vi_tenant
: "{{ tenant | mandatory }}"
    vi_plants
: "{{ plants | mandatory }}"


    status
: |
     
Provisioning tenant security:
      env          
{{env}}
      tenant      
{{vi_tenant}}
      plants      
{{vi_plants}}


  tasks
:
   
- debug: var=status.split('\n')



TASK: [debug var=status.split('\n')] ******************************************
ok
: [localhost] => {
   
"var": {
       
"status.split('\\n')": [
           
"Provisioning tenant security:",
           
"env          staging",
           
"tenant       tenantA",
           
"plants       {{ plants | mandatory }}"
       
]
   
}
}

Why doesn't the |mandatory fail in this case?. On top of that I am using 'error_on_undefined_vars = True'
But that also seems to have no effect here as well.

Brian Coca

unread,
Jun 26, 2015, 12:10:33 AM6/26/15
to ansible...@googlegroups.com
mandatory is only needed if error_on_undefined_vars=False (which was
the default long ago)

what version of ansible? os? python?


--
Brian Coca

Barry Kaplan

unread,
Jun 28, 2015, 8:49:41 AM6/28/15
to ansible...@googlegroups.com
os: ubuntu 14.04
ansible 1.9.2-rc2 (but maybe 1.9.2-rc1)
python: 2.7.63

Brian Coca

unread,
Jul 2, 2015, 6:14:55 PM7/2/15
to ansible...@googlegroups.com
So I had not used the feature in a while, it seems that it is currently broken:

https://github.com/ansible/ansible/issues/10136



--
Brian Coca
Reply all
Reply to author
Forward
0 new messages