saltstack file managed name
配置:
sourceConfig:
file.managed:
- template: jinja
{% if grains["ip4_interfaces"]["eth0"] == '192.168.1.22' %}
- name: /etc/apt/sources.list
- source: salt://file/sources.list
{% elif grains['server_id']=='1398511438' %}
- name: /etc/apt/sources.list
- source: salt://file/sources.list1
{% endif %}
- user: root
报错:
server1:
----------
ID: sourceConfig
Function: file.managed
Result: False
Comment: Specified file sourceConfig is not an absolute path
Started: 10:08:59.797900
Duration: 3.874 ms
Changes:
Summary for server1
------------
Succeeded: 0
Failed: 1
------------
Total states run: 1
-name不行写在if中,不然就报错。这样写都没问题:
{% if grains["ip4_interfaces"]["eth0"] == '192.168.1.22' %}
ourceConfig:
file.managed:
- template: jinja
- name: /etc/apt/sources.list
- source: salt://file/sources.list
- user: root
{% endif %}
这是为什么
版本:
sudo salt-master --versions-report
Salt Version:
Salt: 2016.3.1
Dependency Versions:
cffi: Not Installed
cherrypy: Not Installed
dateutil: 1.5
gitdb: 0.5.4
gitpython: 0.3.2 RC1
ioflo: Not Installed
Jinja2: 2.7.2
libgit2: Not Installed
libnacl: Not Installed
M2Crypto: Not Installed
Mako: 0.9.1
msgpack-pure: Not Installed
msgpack-python: 0.3.0
mysql-python: 1.2.3
pycparser: Not Installed
pycrypto: 2.6.1
pygit2: Not Installed
Python: 2.7.6 (default, Jun 22 2015, 17:58:13)
python-gnupg: Not Installed
PyYAML: 3.10
PyZMQ: 14.0.1
RAET: Not Installed
smmap: 0.8.2
timelib: Not Installed
Tornado: 4.3
ZMQ: 4.0.4
System Versions:
dist: Ubuntu 14.04 trusty
machine: x86_64
release: 3.16.0-30-generic
system: Linux
version: Ubuntu 14.04 trusty
页:
[1]