ansible.builtin.root filter – root of (math operation)

Note

This filter plugin is part of ansible-core and included in all Ansible installations. In most cases, you can use the short plugin name root even without specifying the collections: keyword. However, we recommend you use the FQCN for easy linking to the plugin documentation and to avoid conflicting with other collections that may have the same filter plugin name.

New in Ansible 1.9

Synopsis

  • Math operation that returns the Nth root of inputed number X ^^ N.

Input

This describes the input of the filter, the value before | ansible.builtin.root.

Parameter

Comments

Input

float / required

Number to operate on.

Positional parameters

This describes positional parameters of the filter. These are the values positional1, positional2 and so on in the following example: input | ansible.builtin.root(positional1, positional2, ...).

Parameter

Comments

base

float

Which root to take.

Default: 2.0

Examples

# => 8
fiveroot: "{{ 32768 | root (5) }}"

# 2
sqrt_of_2: "{{ 4 | root }}"

# me ^^ 3
cuberoot_me: "{{ me | root(3) }}"

Return Value

Key

Description

Return value

float

Resulting number.

Returned: success

Hint

Configuration entries for each entry type have a low to high priority order. For example, a variable that is lower in the list will override a variable that is higher up.