Search code examples
salt-project

SaltStack: Module file.find iname parameter


i try to use Saltstack to deploy part of our applications.

I would like to delete all zip files in a directory with the module file.find so i write this formulas:

  remove_ZIP:
    module.run:
      - name: file.find
      - path: {{ custom_dir }}/
      - args: 
        - delete
        - iname: \*zip

With this all files are deleted.

I try to use kwargs to declare iname constraints with the error

'kwargs' must be a dict.

Could someone help me to understund how to use this module?

thx


Solution

  • Like the error message says, you should use kwargs with a dict instead.

    remove_ZIP:
        module.run:
          - name: file.find
          - path: {{ custom_dir }}
          - kwargs: 
              delete: f
              iname: "*.zip"