【发布时间】:2016-07-12 17:53:31
【问题描述】:
我需要从支柱文件中读取主机条目并相应地更新 /etc/hosts 文件
这是我用来更新 /etc/hosts 文件的简单 sls 文件。
#/srv/salt/splunk_dep/hosts.sls
dnsutil:
dnsutil.hosts-append:
- hostsfile: '/etc/hosts'
- ip_addr: '10.10.10.10'
- entries: 'hostname'
当我执行 sls 文件时 salt Minion-name state.apply splunk_dep/hosts
出现以下错误
ID: dnsutil
Function: dnsutil.hosts-append
Result: False
Comment: State 'dnsutil.hosts-append' was not found in SLS 'splunk_dep/hosts'
Reason: 'dnsutil.hosts-append' is not available.
Started:
Duration:
Changes:
如果我通过命令行执行它的工作正常
salt 'DS-110' dnsutil.hosts_append /etc/hosts 10.10.10.10 主机名
我需要通过 sls 文件更新 /etc/hosts 文件。有人可以帮我解决这个问题吗?
我使用的是盐版本:salt 2015.8.3 (Beryllium)
【问题讨论】:
-
您好 Bala,既然您确认 ahus1 答案有效,请接受它。
标签: salt