I asked a question recently regarding the most efficient and scalable way to check which files/services exist in multiple environments. Thanks to an answer I have successfully set up roles for all of my salt minions.
I am now in the process of writing my first salt state which will check that all expected files/services are present for all minions with the
I am using the
file.exists feature, however as you can expect there are 100's of files/services I wish to check, I'm sure there must be a way of listing these files/services in a list or string? I can't find anything in the documentation under file.exists but it is possible in other file.'s
Here is the current state of my
# This state will check all minions identified as 'apiserver' for files and/or services which should exist # This section checks the 'checkservices.sh' is present in /opt (used for Jenkins check jobs) checkservices.sh: file.exists: - name: /opt/checkservices.sh # This section checks for expected files/scripts within /opt/apiv2/ apiv2.properties: file.exists: - name: /opt/apiv2/apiv2.properties jvm.options: file.exists: - name: /opt/apiv2/jvm.options restart.sh: file.exists: - name: /opt/apiv2/restart.sh status.sh: file.exists: - name: /opt/apiv2/status.sh shutdown.sh: file.exists: - name: /opt/apiv2/shutdown.sh start.sh: file.exists: - name: /opt/apiv2/start.sh # This section checks for 'bootstrap.jar' in /opt/apiv2/repo/ bootstrap.jar: file.exists: - name: /opt/apiv2/repo/bootstrap.jar
My second question is; is my current method (above) considered bad practice or is it just an ugly/inefficient way of doing it?