salt.modules.match

The match module allows for match routines to be run and determine target specs

salt.modules.match.compound(tgt, minion_id=None)

Return True if the minion ID matches the given compound target

minion_id

Specify the minion ID to match against the target expression

2014.7.0 新版功能.

CLI 范例:

salt '*' match.compound 'L@cheese,foo and *'
salt.modules.match.data(tgt)

Return True if the minion matches the given data target

CLI 范例:

salt '*' match.data 'spam:eggs'
salt.modules.match.filter_by(lookup, expr_form='compound', minion_id=None)

Return the first match in a dictionary of target patterns

2014.7.0 新版功能.

CLI 范例:

salt '*' match.filter_by '{foo*: Foo!, bar*: Bar!}' minion_id=bar03

Pillar Example:

{% set roles = salt['match.filter_by']({
    'web*': ['app', 'caching'],
    'db*': ['db'],
}) %}
salt.modules.match.glob(tgt, minion_id=None)

Return True if the minion ID matches the given glob target

minion_id

Specify the minion ID to match against the target expression

2014.7.0 新版功能.

CLI 范例:

salt '*' match.glob '*'
salt.modules.match.grain(tgt, delimiter=':')

Return True if the minion matches the given grain target. The delimiter argument can be used to specify a different delimiter.

CLI 范例:

salt '*' match.grain 'os:Ubuntu'
salt '*' match.grain 'ipv6|2001:db8::ff00:42:8329' delimiter='|'
delimiter

Specify an alternate delimiter to use when traversing a nested dict

2014.7.0 新版功能.

delim

Specify an alternate delimiter to use when traversing a nested dict

0.16.4 新版功能.

2015.8.0 版后已移除.

salt.modules.match.grain_pcre(tgt, delimiter=':')

Return True if the minion matches the given grain_pcre target. The delimiter argument can be used to specify a different delimiter.

CLI 范例:

salt '*' match.grain_pcre 'os:Fedo.*'
salt '*' match.grain_pcre 'ipv6|2001:.*' delimiter='|'
delimiter

Specify an alternate delimiter to use when traversing a nested dict

2014.7.0 新版功能.

delim

Specify an alternate delimiter to use when traversing a nested dict

0.16.4 新版功能.

2015.8.0 版后已移除.

salt.modules.match.ipcidr(tgt)

Return True if the minion matches the given ipcidr target

CLI 范例:

salt '*' match.ipcidr '192.168.44.0/24'

delimiter Pillar Example:

'172.16.0.0/12':
  - match: ipcidr
  - nodeclass: internal
salt.modules.match.list(tgt, minion_id=None)

Return True if the minion ID matches the given list target

minion_id

Specify the minion ID to match against the target expression

2014.7.0 新版功能.

CLI 范例:

salt '*' match.list 'server1,server2'
salt.modules.match.pcre(tgt, minion_id=None)

Return True if the minion ID matches the given pcre target

minion_id

Specify the minion ID to match against the target expression

2014.7.0 新版功能.

CLI 范例:

salt '*' match.pcre '.*'
salt.modules.match.pillar(tgt, delimiter=':')

Return True if the minion matches the given pillar target. The delimiter argument can be used to specify a different delimiter.

CLI 范例:

salt '*' match.pillar 'cheese:foo'
salt '*' match.pillar 'clone_url|https://github.com/saltstack/salt.git' delimiter='|'
delimiter

Specify an alternate delimiter to use when traversing a nested dict

2014.7.0 新版功能.

delim

Specify an alternate delimiter to use when traversing a nested dict

0.16.4 新版功能.

2015.8.0 版后已移除.

salt.modules.match.pillar_pcre(tgt, delimiter=':')

Return True if the minion matches the given pillar_pcre target. The delimiter argument can be used to specify a different delimiter.

CLI 范例:

salt '*' match.pillar_pcre 'cheese:(swiss|american)'
salt '*' match.pillar_pcre 'clone_url|https://github\.com/.*\.git' delimiter='|'
delimiter

Specify an alternate delimiter to use when traversing a nested dict

2014.7.0 新版功能.

delim

Specify an alternate delimiter to use when traversing a nested dict

0.16.4 新版功能.

2015.8.0 版后已移除.