samedi 18 avril 2015

Unable to use file.replace in SaltStack state

I'm writing a state to change the default SSH port to another value. This is the the .sls file I'm having trouble with:



move port ssh:
file.replace:
- path: /etc/ssh/sshd_config
- pattern: Port 22
- repl: Port 22222


From the docs it seems the path argument should be supported, but it fails.



# salt-call state.sls common.ssh test=True
local:
----------
ID: move port ssh
Function: file.replace
Result: False
Comment: Specified file move port ssh is not an absolute path
Started: 11:02:40.632334
Duration: 2.588 ms
Changes:

Summary
------------
Succeeded: 0
Failed: 1
------------
Total states run: 1


Versions:



# salt --version
salt 2015.2.0

# salt --versions
Salt: 2015.2.0
Python: 2.7.6 (default, Mar 22 2014, 22:59:56)
Jinja2: 2.7.2
M2Crypto: 0.21.1
msgpack-python: 0.3.0
msgpack-pure: Not Installed
pycrypto: 2.6.1
libnacl: Not Installed
PyYAML: 3.10
ioflo: Not Installed
PyZMQ: 14.0.1
RAET: Not Installed
ZMQ: 4.0.4
Mako: Not Installed


The following state works, but the way it's written prevents me to do other things.



/etc/ssh/sshd_config:
file.replace:
- pattern: Port 22
- repl: Port 22222

Aucun commentaire:

Enregistrer un commentaire