-
-
Save kylegato/0ee67e92451363396c05 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[root@salt /usr/local/etc/salt/states]# salt 'cron.*' grains.get fqdn_ip4 | |
cron.la.domain.com: | |
- 172.16.20.10 | |
[root@salt /usr/local/etc/salt/states]# cat hosts/test.sls | |
{% if '172.16.20' in grains['fqdn_ip4'] %} | |
echo Part of the 20 Internal Network: | |
cmd.run | |
{% elif '172.16.255' in grains['fqdn_ip4'] %} | |
echo Part of the 255 Internal Network: | |
cmd.run | |
{% else %} | |
echo ERROR - Unknown Network: | |
cmd.run | |
{% endif %} | |
[root@salt /usr/local/etc/salt/states]# salt 'cron.*' state.sls hosts.test | |
cron.la.domain.com: | |
---------- | |
ID: echo ERROR - Unknown Network | |
Function: cmd.run | |
Result: True | |
Comment: Command "echo ERROR - Unknown Network" run | |
Changes: | |
---------- | |
pid: | |
5119 | |
retcode: | |
0 | |
stderr: | |
stdout: | |
ERROR - Unknown Network | |
Summary | |
------------ | |
Succeeded: 1 | |
Failed: 0 | |
------------ | |
Total: 1 | |
[root@salt /usr/local/etc/salt/states]# |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment