I am currently writing a salt-state for setting up a server with some custom software we need. We get an installer from the software creator which needs to be run as a shell script (it is a Java-based server software). It is a bash-script with a bunch of binary data appended. For this I was expecting to distribute the installer-file with a file.managed. So far I have only tested this with Salty Vagrant, but I have run into an irritating problem. The file that is created by salt is 0 bytes when run by "vagrant provision" (which just runs state.highstate). If I do a "salt-call state.highstate" from the virtual machine, the problem is the same, but if I do a "salt-call state.single file.managed ..." (with the same data as in the sls-file) it does the right thing, but outputs a whole boat load of binary data on the screen.
ilexserver-installer:
file.managed:
- name: /opt/iLEXServer_2_0047.sh
- src: salt://ilex/iLEXServer_2_0047.sh
The output state.highstate gives me when the file does not yet exist in /opt:
[default] [INFO ] Executing state file.managed for /opt/iLEXServer_2_0047.sh
[default] [INFO ] {'new': 'file /opt/iLEXServer_2_0047.sh created'}
----------
State: - file
Name: /opt/iLEXServer_2_0047.sh
Function: managed
Result: True
Comment: Empty file
Changes: new: file /opt/iLEXServer_2_0047.sh created
And when the file exists as a 0 byte file:
[default] [INFO ] Executing state file.managed for /opt/iLEXServer_2_0047.sh
[default] [INFO ] No changes made for /opt/iLEXServer_2_0047.sh
----------
State: - file
Name: /opt/iLEXServer_2_0047.sh
Function: managed
Result: True
Comment: File /opt/iLEXServer_2_0047.sh is in the correct state
Changes:
I know that it says in the output that it is an empty file, but it is not empty in the salt root. With Salty Vagrant there is no master server, it just mounts the salt root-dirs directly in the VM. I have check /srv/salt/ilex in the VM and the file is there, is not empty and is accessible as root (I am not running salt as an unprivileged user here).
Is this a known issue?
Is file.managed only meant to be used with text files?
If file.managed does not handle binary files, what would be the recommended way to distribute binary installers like this? NFS?
--
Anders Bruun Olsen
It-ansvarlig
Det Danske Sprog- og Litteraturselskab
(Society for Danish Language and Literature)