salt.modules.ipset

Support for ipset

salt.modules.ipset.add(setname=None, entry=None, family='ipv4', **kwargs)

Append an entry to the specified set.

CLI Example:

salt '*' ipset.add setname 192.168.1.26

salt '*' ipset.add setname 192.168.0.3,AA:BB:CC:DD:EE:FF
salt.modules.ipset.check(set=None, entry=None, family='ipv4')

Check that an entry exists in the specified set.

set

The ipset name

entry

An entry in the ipset. This parameter can be a single IP address, a range of IP addresses, or a subnet block. Example:

192.168.0.1
192.168.0.2-192.168.0.19
192.168.0.0/25
family

IP protocol version: ipv4 or ipv6

CLI Example:

salt '*' ipset.check setname '192.168.0.1 comment "Hello"'
salt.modules.ipset.check_set(set=None, family='ipv4')

Check that given ipset set exists.

New in version 2014.7.0.

CLI Example:

salt '*' ipset.check_set setname
salt.modules.ipset.delete(set=None, entry=None, family='ipv4', **kwargs)

Delete an entry from the specified set.

CLI Example:

salt '*' ipset.delete setname 192.168.0.3,AA:BB:CC:DD:EE:FF
salt.modules.ipset.delete_set(set=None, family='ipv4')

New in version 2014.7.0.

Delete ipset set.

CLI Example:

salt '*' ipset.delete_set custom_set

IPv6:
salt '*' ipset.delete_set custom_set family=ipv6
salt.modules.ipset.flush(set=None, family='ipv4')

Flush entries in the specified set, Flush all sets if set is not specified.

CLI Example:

salt '*' ipset.flush

salt '*' ipset.flush set

IPv6:
salt '*' ipset.flush

salt '*' ipset.flush set
salt.modules.ipset.list_sets(family='ipv4')

New in version 2014.7.0.

List all ipset sets.

CLI Example:

salt '*' ipset.list_sets
salt.modules.ipset.long_range(start, end)
salt.modules.ipset.new_set(set=None, set_type=None, family='ipv4', comment=False, **kwargs)

New in version 2014.7.0.

Create new custom set

CLI Example:

salt '*' ipset.new_set custom_set list:set

salt '*' ipset.new_set custom_set list:set comment=True

IPv6:
salt '*' ipset.new_set custom_set list:set family=ipv6
salt.modules.ipset.rename_set(set=None, new_set=None, family='ipv4')

New in version 2014.7.0.

Delete ipset set.

CLI Example:

salt '*' ipset.rename_set custom_set new_set=new_set_name

IPv6:
salt '*' ipset.rename_set custom_set new_set=new_set_name family=ipv6
salt.modules.ipset.test(set=None, entry=None, family='ipv4', **kwargs)

Test if an entry is in the specified set.

CLI Example:

salt '*' ipset.test setname 192.168.0.2

IPv6:
salt '*' ipset.test setname fd81:fc56:9ac7::/48
salt.modules.ipset.version()

Return version from ipset --version

CLI Example:

salt '*' ipset.version