2
我在我的狀態文件中添加了以下邏輯,它在第一次安裝名爲agent的實用程序後基本上設置了新的穀物值。Salt States and grain values
{% if salt['grains.get']('agent') != 'installed' %}
..............
agent_status:
grains.present:
- name: agent
- value: installed
{% endif %}
我第一次運行salt 'server1' state.highstate
它返回以下這正是我期望:
----------
ID: agent_status
Function: grains.present
Name: agent
Result: True
Comment: Set grain agent to installed
Started: 16:03:27.083578
Duration: 709.795 ms
Changes:
----------
agent:
installed
當我隨後運行salt 'server1' state.highstate
它返回:
server1:
----------
ID: states
Function: no.None
Result: False
Comment: No states found for this minion
Started:
Duration:
Changes:
Summary
------------
Succeeded: 0
Failed: 1
這是正確的行爲我有點困惑,因爲我預料到這不會表現爲失敗?此外,評論似乎在這裏有點誤導。
Arr - 我明白了。感謝您的迴應 – user1513388 2014-10-27 13:58:48