瀏覽代碼

Add a state which supports overwriting /etc/hosts.

Signed-off-by: Rene Jochum <rene@jochums.at>
pull/9/head
Rene Jochum 8 年之前
父節點
當前提交
a0b4cad390
共有 2 個文件被更改,包括 25 次插入0 次删除
  1. +14
    -0
      network/hostsfile.sls
  2. +11
    -0
      network/templates/etc_hosts.jinja

+ 14
- 0
network/hostsfile.sls 查看文件

@@ -0,0 +1,14 @@
#!jinja|yaml
# vi: set ft=yaml.jinja :

{% if salt['pillar.get']('network:hostsfile:fqdn', False) %}
network_hostsfile:
file:
- managed
- name: /etc/hosts
- source: salt://network/templates/etc_hosts.jinja
- template: jinja
- context:
fqdn: {{ salt['pillar.get']('network:hostsfile:fqdn') }}
hostname: {{ salt['pillar.get']('network:hostsfile:hostname') }}
{% endif %}

+ 11
- 0
network/templates/etc_hosts.jinja 查看文件

@@ -0,0 +1,11 @@
# This file is managed by salt, do not edit!
127.0.0.1 localhost.localdomain
127.0.1.1 {{ fqdn }} {{ hostname }}

# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback localhost
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts

Loading…
取消
儲存