override dictionary field

38 views
Skip to first unread message

Tomaž Štrukelj

unread,
Feb 19, 2016, 8:23:22 AM2/19/16
to Ansible Project
Using Ansible 2.0 , is there a way to override a dictionary field in vars file ?

Let's say I have a role with default dictionary values :
system:
    packages_default: [curl, wget, python-software-properties, mc, dvtm, ncdu, vim, htop, iotop, bmon, tree, ntp]
    apt_mirror: False
    apt_upgrade: False
    acl_enabled: False

And then I want to override just 1 dictionary field acl_enabled to True.  

If I try the naive way "system.acl_enabled: True" it doesn't work.

I thought I could use the new combine filter but it gets into a loop :

Both below assignments :
system: "{{ none|combine(system,{acl_enabled: True}) }}"
system: "{{ system|combine({acl_enabled: True}) }}"

results in :
ERROR! recursive loop detected in template string

Any solution ? 

Reply all
Reply to author
Forward
0 new messages