Skip to content

Instantly share code, notes, and snippets.

@toddc-unity3d
Last active August 17, 2016 16:43
Show Gist options
  • Save toddc-unity3d/c12385c71d837b3aa36d33a8cdf2ca6c to your computer and use it in GitHub Desktop.
Save toddc-unity3d/c12385c71d837b3aa36d33a8cdf2ca6c to your computer and use it in GitHub Desktop.
Salt Hosts files
# <states>/top.sls
```
base:
'*':
- hosts
```
# <states>/hosts/init.sls
```
include:
- hosts.hosts
```
# <states>/hosts/hosts.sls
```
{%- set pillar_hosts = salt['pillar.get']('hosts:hosts', {}) %}
{%- for ip, hostnames in pillar_hosts.items() %}
{{ ip }}-host-entry:
host.present:
- ip: {{ ip }}
- names: {{ hostnames }}
{% endfor %}
```
# <pillar>/top.sls
```
base:
'*':
- hosts
```
# <pillar>/hosts/init.sls
```
hosts:
'1.2.3.4': "host1 host1alias"
'1.2.3.5': "host 2"
'1.2.3.6': "host 3"
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment