ansible.plugins.filter package

Submodules

ansible.plugins.filter.core module

class ansible.plugins.filter.core.AnsibleJSONEncoder(skipkeys=False, ensure_ascii=True, check_circular=True, allow_nan=True, sort_keys=False, indent=None, separators=None, encoding='utf-8', default=None)[source]

Bases: json.encoder.JSONEncoder

Simple encoder class to deal with JSON encoding of internal types like HostVars

default(o)[source]
ansible.plugins.filter.core.to_yaml(a, *args, **kw)[source]

Make verbose, human readable yaml

ansible.plugins.filter.core.to_nice_yaml(a, indent=4, *args, **kw)[source]

Make verbose, human readable yaml

ansible.plugins.filter.core.to_json(a, *args, **kw)[source]

Convert the value to JSON

ansible.plugins.filter.core.to_nice_json(a, indent=4, *args, **kw)[source]

Make verbose, human readable JSON

ansible.plugins.filter.core.to_bool(a)[source]

return a bool for the arg

ansible.plugins.filter.core.quote(a)[source]

return its argument quoted for shell usage

ansible.plugins.filter.core.fileglob(pathname)[source]

return list of matched files for glob

ansible.plugins.filter.core.regex_replace(value='', pattern='', replacement='', ignorecase=False)[source]

Perform a re.sub returning a string

ansible.plugins.filter.core.regex_findall(value, regex, multiline=False, ignorecase=False)[source]

Perform re.findall and return the list of matches

Perform re.search and return the list of matches or a backref

ansible.plugins.filter.core.ternary(value, true_val, false_val)[source]

value ? true_val : false_val

ansible.plugins.filter.core.version_compare(value, version, operator='eq', strict=False)[source]

Perform a version comparison on a value

ansible.plugins.filter.core.regex_escape(string)[source]

Escape all regular expressions special characters from STRING.

ansible.plugins.filter.core.rand(environment, end, start=None, step=None)[source]
ansible.plugins.filter.core.randomize_list(mylist)[source]
ansible.plugins.filter.core.get_hash(data, hashtype='sha1')[source]
ansible.plugins.filter.core.get_encrypted_password(password, hashtype='sha512', salt=None)[source]
ansible.plugins.filter.core.to_uuid(string)[source]
ansible.plugins.filter.core.mandatory(a)[source]
ansible.plugins.filter.core.combine(*terms, **kwargs)[source]
ansible.plugins.filter.core.comment(text, style='plain', **kw)[source]
ansible.plugins.filter.core.extract(item, container, morekeys=None)[source]
class ansible.plugins.filter.core.FilterModule[source]

Bases: object

Ansible core jinja2 filters

filters()[source]

ansible.plugins.filter.ipaddr module

class ansible.plugins.filter.ipaddr.mac_linux[source]

Bases: netaddr.strategy.eui48.mac_unix

word_fmt = '%.2x'
ansible.plugins.filter.ipaddr.ipaddr(value, query='', version=False, alias='ipaddr')[source]

Check if string is an IP address or network and filter it

ansible.plugins.filter.ipaddr.ipwrap(value, query='')[source]
ansible.plugins.filter.ipaddr.ipv4(value, query='')[source]
ansible.plugins.filter.ipaddr.ipv6(value, query='')[source]
ansible.plugins.filter.ipaddr.ipsubnet(value, query='', index='x')[source]

Manipulate IPv4/IPv6 subnets

ansible.plugins.filter.ipaddr.nthhost(value, query='')[source]

Get the nth host within a given network

ansible.plugins.filter.ipaddr.slaac(value, query='')[source]

Get the SLAAC address within given network

ansible.plugins.filter.ipaddr.hwaddr(value, query='', alias='hwaddr')[source]

Check if string is a HW/MAC address and filter it

ansible.plugins.filter.ipaddr.macaddr(value, query='')[source]
ansible.plugins.filter.ipaddr.ip4_hex(arg)[source]

Convert an IPv4 address to Hexadecimal notation

class ansible.plugins.filter.ipaddr.FilterModule[source]

Bases: object

IP address and network manipulation filters

filter_map = {'hwaddr': <function hwaddr at 0x1031e27d0>, 'macaddr': <function macaddr at 0x1031e2848>, 'ipsubnet': <function ipsubnet at 0x1031e2668>, 'ipwrap': <function ipwrap at 0x1031e2500>, 'ipv6': <function ipv6 at 0x1031e25f0>, 'ip4_hex': <function ip4_hex at 0x1031e2938>, 'nthhost': <function nthhost at 0x1031e26e0>, 'ipaddr': <function ipaddr at 0x1031e2488>, 'slaac': <function slaac at 0x1031e2758>, 'ipv4': <function ipv4 at 0x1031e2578>}
filters()[source]

ansible.plugins.filter.mathstuff module

ansible.plugins.filter.mathstuff.unique(a)[source]
ansible.plugins.filter.mathstuff.intersect(a, b)[source]
ansible.plugins.filter.mathstuff.difference(a, b)[source]
ansible.plugins.filter.mathstuff.symmetric_difference(a, b)[source]
ansible.plugins.filter.mathstuff.union(a, b)[source]
ansible.plugins.filter.mathstuff.min(a)[source]
ansible.plugins.filter.mathstuff.max(a)[source]
ansible.plugins.filter.mathstuff.isnotanumber(x)[source]
ansible.plugins.filter.mathstuff.logarithm(x, base=2.718281828459045)[source]
ansible.plugins.filter.mathstuff.power(x, y)[source]
ansible.plugins.filter.mathstuff.inversepower(x, base=2)[source]
ansible.plugins.filter.mathstuff.human_readable(size, isbits=False, unit=None)[source]
class ansible.plugins.filter.mathstuff.FilterModule[source]

Bases: object

Ansible math jinja2 filters

filters()[source]