salt.modules.ipset

Support for ipset

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

Append an entry to the specified set.

CLI Example:

salt '*' ipset.add name 192.168.1.26

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

Check that an entry exists in the specified set.

name

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 name '192.168.0.1 comment "Hello"'
salt.modules.ipset.check_set(name=None, family='ipv4')

Check that given ipset set exists.

New in version 2014.7.0.

CLI Example:

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

Delete an entry from the specified set.

CLI Example:

salt '*' ipset.delete name 192.168.0.3,AA:BB:CC:DD:EE:FF
salt.modules.ipset.delete_set(name=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(name=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.new_set(name=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(name=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(name=None, entry=None, family='ipv4', **kwargs)

Test if an entry is in the specified set.

CLI Example:

salt '*' ipset.test name 192.168.0.2

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

Return version from ipset --version

CLI Example:

salt '*' ipset.version