【问题】报错[CRITICAL] Rendering SLS 'base:minions.install' failed: Jinja variable 'list' object has no element 0

时间:2021-03-16 17:01:48

1.报错[CRITICAL] Rendering SLS 'base:minions.install' failed: Jinja variable 'list' object has no element 0

执行:

salt-ssh -i '*' state.sls minions.install

之后,报错:

[CRITICAL] Rendering SLS 'base:minions.nosls' failed: Jinja variable 'list' object has no element 0
10.10.10.30:
- Rendering SLS 'base:minions.nosls' failed: Jinja variable 'list' object has no element 0

是因为“minion_id: {{ grains['fqdn_ip4'][0] }}”没有匹配到IP的原因

问题处理:

登陆10.10.10.30服务器,修改/etc/hosts文件,绑定主机名和网卡IP

10.10.10.30 salt.test01.com

注:禁止在/etc/hosts文件中绑定主机名salt.test01.com在127.0.0.1上,否则“minion_id: {{ grains['fqdn_ip4'][0] }}”匹配的IP将是127.0.0.1