I'm rewriting some modules from puppet to saltstack.
In puppet we can use node
to specific this part is for this machine,
for example:
node /william\d+.aws.dev/ {
# some codes here..
}
But in saltstack, it's not that much elegant:
{% if grains['fqdn'] == 'william.aws.dev' %}
# some codes here..
{% endif %}
and regular expression is not supported.
Is there any way to rewrite it in saltstack using less code?
Note I don't want to use top.sls
to define which node using which sls. because it would make the top.sls file too large to maintain.
I just want to define a simple two line in top.sls
:
'*':
- node.*
everytime I add some node in salt, I just need to create a new file under the node
directory.