Salt
Материал из noname.com.ua
Salt
Это просто напоминалка про команды Salt которые часть вылетают из головы
Pillar
salt 'minion' pillar.data
salt 'minion' pillar.get 'remote-log-filebeat-server'
salt 'minion' pillar.raw
salt 'minion' saltutil.refresh_pillar
Grains
salt 'minion' grains.get 'role'
Salt Apply
- filebeat - имя формулы
- saltenv=kilda-server42 pillrend=kilda-server42 - имя saltenv/pillarenv
salt 'minion' state.sls filebeat saltenv=kilda-server42 pillarenv=kilda-server42 test=True
Jinja
некоторые куски кода которые я забываю между подходами к написанию солт формул Check Variable in Jinja2
Check if variable is defined (exists):
{% if variable is defined %} variable is defined {% else %} variable is not defined {% endif %}
Check if variable is empty:
{% if variable|length %} variable is not empty {% else %} variable is empty {% endif %}
Check if variable is true:
{% if variable is sameas true %} variable is true {% else %} variable is not true {% endif %}
Check if variable is defined and not empty:
{% if variable is defined and variable|length %} variable is defined and not empty {% else %} variable is not defined or empty {% endif %}
Check if variable is defined and true:
{% if variable is defined and variable is sameas true %} variable is defined and true {% else %} variable is not defined or not set to true {% endif %}