Documentation
PLEASE NOTE: This document applies to latest version and not to the latest stable release v2.20
Documentation for other releases can be found by using the version selector in the top right of any doc page.ipaddr
Manage IP addresses on network interfaces.
Attributes
check_mode:
support: full
Parameters
| Parameter | Required | Type | Values | Description |
|---|---|---|---|---|
| address | true | string | IP address with CIDR (e.g., 192.168.1.10/24). | |
| family | string | ipv4 ipv6 |
IP address family (ipv4 or ipv6). Auto-detected from address format if not specified. [default: "ipv4"] |
|
| interface | true | string | Network interface name. | |
| state | string | present absent |
Whether the address should be present or absent. [default: "present"] |
Examples
- name: Add IP address to interface
ipaddr:
interface: eth0
address: 192.168.1.10/24
- name: Add IPv6 address
ipaddr:
interface: eth0
address: 2001:db8::1/64
family: ipv6
- name: Remove IP address from interface
ipaddr:
interface: eth0
address: 192.168.1.10/24
state: absent
- name: Add secondary IP address
ipaddr:
interface: eth0
address: 192.168.2.10/24