ansible.builtin.pow filter – power 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 pow. However, we recommend you use the Fully Qualified Collection Name (FQCN) ansible.builtin.pow for easy linking to the plugin documentation and to avoid conflicting with other collections that may have the same filter plugin name.

Synopsis

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

Input

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

Parameter

Comments

Input

float / required

The base.

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.pow(positional1, positional2, ...)

Parameter

Comments

_power

float / required

Which power (exponent) to use.

Notes

Note

  • This is a passthrough to Python’s math.pow.

Examples

# => 32768
eight_power_five: "{{ 8 | pow(5) }}"

# 4
square_of_2: "{{ 2 | pow(2) }}"

# me ^ 3
cube_me: "{{ me | pow(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.