Browse Source

removing some default host entries

tags/v0.1
Arnold Bechtoldt 10 years ago
parent
commit
1a07f8879e
2 changed files with 5 additions and 15 deletions
  1. +0
    -10
      network/defaults.yaml
  2. +5
    -5
      network/hosts.sls

+ 0
- 10
network/defaults.yaml View File

hosts: hosts:
values: values:
path: /etc/hosts path: /etc/hosts
ensure: present
def_entries: def_entries:
- name: localhost - name: localhost
ip: 127.0.0.1 ip: 127.0.0.1
ip: ff02::2 ip: ff02::2
- name: ip6-allhosts - name: ip6-allhosts
ip: ff02::3 ip: ff02::3
- name: {{ salt['grains.get']('fqdn') }}
ip: 127.0.1.1
- name: {{ salt['grains.get']('host') }}
ip: 127.0.1.1
RedHat: RedHat:
interfaces: interfaces:
pkgs: [] pkgs: []
hosts: hosts:
values: values:
path: /etc/hosts path: /etc/hosts
ensure: present
def_entries: def_entries:
- name: localhost - name: localhost
ip: 127.0.0.1 ip: 127.0.0.1
ip: ff02::2 ip: ff02::2
- name: ip6-allhosts - name: ip6-allhosts
ip: ff02::3 ip: ff02::3
- name: {{ salt['grains.get']('fqdn') }}
ip: 127.0.1.1
- name: {{ salt['grains.get']('host') }}
ip: 127.0.1.1
{% endload %} {% endload %}

+ 5
- 5
network/hosts.sls View File

{% from "network/defaults.yaml" import rawmap with context %} {% from "network/defaults.yaml" import rawmap with context %}
{% set datamap = salt['grains.filter_by'](rawmap, merge=salt['pillar.get']('network:lookup')) %} {% set datamap = salt['grains.filter_by'](rawmap, merge=salt['pillar.get']('network:lookup')) %}


{% set hosts = datamap['hosts']['def_entries'] %}
{% set hosts = datamap.hosts.def_entries %}


{% if salt['pillar.get']('network:hosts', False) %} {% if salt['pillar.get']('network:hosts', False) %}
{% set hosts = hosts + salt['pillar.get']('network:hosts') %} {% set hosts = hosts + salt['pillar.get']('network:hosts') %}
{% endif %} {% endif %}


{% for h in hosts %} {% for h in hosts %}
host-{{ h['name'] }}_{{ h['ip'] }}:
host_{{ h.name }}_{{ h.ip }}:
host: host:
- {{ h['ensure']|default(datamap['hosts']['values']['ensure']) }}
- ip: {{ h['ip'] }}
- name: {{ h['name'] }}
- {{ h.ensure|default('present') }}
- ip: {{ h.ip }}
- name: {{ h.name }}
{% endfor %} {% endfor %}

Loading…
Cancel
Save