Lukc
Lukc

Reputation: 13

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

Upvotes: 0

Views: 669

Answers (2)

Lukc
Lukc

Reputation: 13

thanks you @blhsing,

so my problem was just an indentation problem...

Indentation with 2 spaces before 'delete' is in error and succeeded with 4 spaces

Upvotes: 0

blhsing
blhsing

Reputation: 107115

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"

Upvotes: 1

Related Questions