On this page
ce_ip_interface - Manages L3 attributes for IPv4 and IPv6 interfaces on HUAWEI CloudEngine switches.
New in version 2.4.
Synopsis
- Manages Layer 3 attributes for IPv4 and IPv6 interfaces on HUAWEI CloudEngine switches.
 
Parameters
| Parameter | Choices/Defaults | Comments | 
|---|---|---|
| addr | 
        
        IPv4 or IPv6 Address.
         | 
     |
| interface  
        required
         | 
      
        
        Full name of interface, i.e. 40GE1/0/22, vlanif10.
         | 
     |
| ipv4_type | 
       
  | 
      
        
        Specifies an address type. The value is an enumerated type. main, primary IP address. sub, secondary IP address.
         | 
     
| mask | 
        
        Subnet mask for IPv4 or IPv6 Address in decimal format.
         | 
     |
| state | 
       
  | 
      
        
        Specify desired state of the resource.
         | 
     
| version | 
       
  | 
      
        
        IP address version.
         | 
     
Notes
Note
- Interface must already be a L3 port when using this module.
 - Logical interfaces (loopback, vlanif) must be created first.
 maskmust be inserted in decimal format (i.e. 24) for both IPv6 and IPv4.- A single interface can have multiple IPv6 configured.
 
Examples
- name: ip_interface module test
  hosts: cloudengine
  connection: local
  gather_facts: no
  vars:
    cli:
      host: "{{ inventory_hostname }}"
      port: "{{ ansible_ssh_port }}"
      username: "{{ username }}"
      password: "{{ password }}"
      transport: cli
  tasks:
  - name: Ensure ipv4 address is configured on 10GE1/0/22
    ce_ip_interface:
      interface: 10GE1/0/22
      version: v4
      state: present
      addr: 20.20.20.20
      mask: 24
      provider: '{{ cli }}'
  - name: Ensure ipv4 secondary address is configured on 10GE1/0/22
    ce_ip_interface:
      interface: 10GE1/0/22
      version: v4
      state: present
      addr: 30.30.30.30
      mask: 24
      ipv4_type: sub
      provider: '{{ cli }}'
  - name: Ensure ipv6 is enabled on 10GE1/0/22
    ce_ip_interface:
      interface: 10GE1/0/22
      version: v6
      state: present
      provider: '{{ cli }}'
  - name: Ensure ipv6 address is configured on 10GE1/0/22
    ce_ip_interface:
      interface: 10GE1/0/22
      version: v6
      state: present
      addr: 2001::db8:800:200c:cccb
      mask: 64
      provider: '{{ cli }}'
  Return Values
Common return values are documented here, the following are the fields unique to this module:
| Key | Returned | Description | 
|---|---|---|
| changed  
        boolean
         | 
      always | 
        
        check to see if a change was made on the device
         Sample:
        
       
        True
         | 
     
| end_state  
        dict
         | 
      always | 
        
        k/v pairs of IP attributes after module execution
         Sample:
        
       
        {'ipv4': [{'ifIpAddr': '20.20.20.20', 'subnetMask': '255.255.255.0', 'addrType': 'main'}], 'interface': '10GE1/0/22'}
         | 
     
| existing  
        dict
         | 
      always | 
        
        k/v pairs of existing IP attributes on the interface
         Sample:
        
       
        {'ipv4': [{'ifIpAddr': '11.11.11.11', 'subnetMask': '255.255.0.0', 'addrType': 'main'}], 'interface': '10GE1/0/22'}
         | 
     
| proposed  
        dict
         | 
      always | 
        
        k/v pairs of parameters passed into module
         Sample:
        
       
        {'addr': '20.20.20.20', 'interface': '10GE1/0/22', 'mask': '24'}
         | 
     
| updates  
        list
         | 
      always | 
        
        commands sent to the device
         Sample:
        
       
        ['interface 10GE1/0/22', 'ip address 20.20.20.20 24']
         | 
     
Status
This module is flagged as preview which means that it is not guaranteed to have a backwards compatible interface.
Maintenance
This module is flagged as community which means that it is maintained by the Ansible Community. See Module Maintenance & Support for more info.
For a list of other modules that are also maintained by the Ansible Community, see here.
Author
- QijunPan (@CloudEngine-Ansible)
 
Hint
If you notice any issues in this documentation you can edit this document to improve it.
© 2012–2018 Michael DeHaan
© 2018–2019 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
 https://docs.ansible.com/ansible/2.6/modules/ce_ip_interface_module.html