1 year ago

#349522

test-img

Sammy

How to exclude one object/option while processing a state file on multiple objects

I'm downloading certain microservices in a folder at D:\SaltDownload. I'm storing all of these files on my minions and the contents of the folder would look like this:

serviceA.zip
serviceB.zip
serviceC.zip
serviceD.zip

Now I'm extracting the contents of folder using the below code:

extract_zip_file_{{servicename}}:
   archive.extracted:
      - name: {{edir}}
      - source: {{dfulln}}
      - enforce_toplevel: False
      - require:
        - cmd: download_zip_file

The name and source used above are dynamic and will point to the D:\SaltDownload. My problem is that now for certain condition I want to extract 3 services - serviceA, serviceB and serviceC but I want to exclude serviceD. Next I'm deleting few files and some more processing on these files. In all of these files I'm using the same folder path. But I want to exclude serviceD.

Is there any way in salt where I can exclude serviceD?

I saw the exclude statement document on salt website but that is for excluding SLS file and here I want to exclude one of the option/object?

devops

salt-stack

0 Answers

Your Answer

Accepted video resources