我正在寻找一种不在某些主机上执行任务的方法。我试过用不同的方法处理Jinja,但都不起作用。
这是可行的,但只适用于一台主机:
{% if grains['id'] != 'node300.example.com' %}
SALT TASKS
{% endif %}我试过了,还有一些变种,但不起作用:
{% if ( (grains['id'] != 'node300.example.com') or
(grains['id'] != 'node303.example.org') or
(grains['id'] != 'node208.example.net') ) %}
SALT TASKS
{% endif %}发布于 2020-02-02 00:02:06
我从IRC那里得到了一个提示。这是可行的:
{% if grains['id'] not in ['node300.example.com',
'node303.example.org',
'node208.example.net'] %}
SALT TASKS
{% endif %}https://stackoverflow.com/questions/60017408
复制相似问题