I am trying to execute a salt state depending on the IP first digit.
{% if grains['fqdn_ip4'].startswith('10') %}
task
{% endif %}
I get :
failed: Jinja variable 'list object' has no attribute 'startswith'
My syntax seems to be good, if I replace the grain item fqdn_ip4 with id, it works :
{% if grains['id'].startswith('10') %}
task
{% endif %}
The format seems different though :
salt-call grains.get id
returns
local:
admin.local
And
salt-call grains.get fqdn_ip4
returns
local:
- 10.25.64.33
So I have a "-" in front of fqdn_ip4 value.
Thanks in advance,
B.