�
�Udac @` s� d d l m Z m Z m Z e Z i d d 6d g d 6d d 6Z d Z d Z d
Z d d l
Z
d d l m Z d
d d g Z
d e f d � � YZ d � Z e d k r� e � n d S( i ( t absolute_importt divisiont print_functions 1.1t metadata_versiont previewt statust communityt supported_bys)
---
module: ipadm_addr
short_description: Manage IP addresses on an interface on Solaris/illumos systems
description:
- Create/delete static/dynamic IP addresses on network interfaces on Solaris/illumos systems.
- Up/down static/dynamic IP addresses on network interfaces on Solaris/illumos systems.
- Manage IPv6 link-local addresses on network interfaces on Solaris/illumos systems.
version_added: "2.3"
author: Adam Števko (@xen0l)
options:
address:
description:
- Specifiies an IP address to configure in CIDR notation.
required: false
aliases: [ "addr" ]
addrtype:
description:
- Specifiies a type of IP address to configure.
required: false
default: static
choices: [ 'static', 'dhcp', 'addrconf' ]
addrobj:
description:
- Specifies an unique IP address on the system.
required: true
temporary:
description:
- Specifies that the configured IP address is temporary. Temporary
IP addresses do not persist across reboots.
required: false
default: false
type: bool
wait:
description:
- Specifies the time in seconds we wait for obtaining address via DHCP.
required: false
default: 60
state:
description:
- Create/delete/enable/disable an IP address on the network interface.
required: false
default: present
choices: [ 'absent', 'present', 'up', 'down', 'enabled', 'disabled', 'refreshed' ]
s�
- name: Configure IP address 10.0.0.1 on e1000g0
ipadm_addr: addr=10.0.0.1/32 addrobj=e1000g0/v4 state=present
- name: Delete addrobj
ipadm_addr: addrobj=e1000g0/v4 state=absent
- name: Configure link-local IPv6 address
ipadm_addr: addtype=addrconf addrobj=vnic0/v6
- name: Configure address via DHCP and wait 180 seconds for address obtaining
ipadm_addr: addrobj=vnic0/dhcp addrtype=dhcp wait=180
s�
addrobj:
description: address object name
returned: always
type: str
sample: bge0/v4
state:
description: state of the target
returned: always
type: str
sample: present
temporary:
description: specifies if operation will persist across reboots
returned: always
type: bool
sample: True
addrtype:
description: address type
returned: always
type: str
sample: static
address:
description: IP address
returned: only if addrtype is 'static'
type: str
sample: 1.3.3.7/32
wait:
description: time we wait for DHCP
returned: only if addrtype is 'dhcp'
type: str
sample: 10
N( t
AnsibleModulet statict addrconft dhcpt Addrc B` st e Z d � Z d � Z d � Z d � Z d � Z d � Z d � Z d � Z d � Z
d � Z d
� Z d � Z
RS( c C` sm | | _ | j d | _ | j d | _ | j d | _ | j d | _ | j d | _ | j d | _ d S( Nt addresst addrtypet addrobjt temporaryt statet wait( t modulet paramsR
R R R R R ( t selfR ( ( sN /usr/lib/python2.7/site-packages/ansible/modules/network/illumos/ipadm_addr.pyt __init__w s c C` s | j j d � d k S( Nt /i ( R
t count( R ( ( sN /usr/lib/python2.7/site-packages/ansible/modules/network/illumos/ipadm_addr.pyt is_cidr_notation� s c C` sz | j j d � d } yH t | j d � � d k rJ t j t j | � n t j t j | � Wn t j k
ru t SXt S( NR i t .i (
R
t splitt lent sockett inet_ptont AF_INETt AF_INET6t errort Falset True( R t
ip_address( ( sN /usr/lib/python2.7/site-packages/ansible/modules/network/illumos/ipadm_addr.pyt is_valid_address� s c C` s� | j j d � g } | j d � | j d � | j d � | j d � | j | j � | j j | � \ } } } | d k r� | j � d k r� t St S| j j d d | | j | f d
| d | � d S( Nt ipadms show-addrs -ps -ot typei R t msgs&