inspur.sm.edit_ipv4 – Set ipv4 information.

Note

This plugin is part of the inspur.sm collection (version 1.3.0).

You might already have this collection installed if you are using the ansible package. It is not included in ansible-core. To check whether it is installed, run ansible-galaxy collection list.

To install it, use: ansible-galaxy collection install inspur.sm.

To use it in a playbook, specify: inspur.sm.edit_ipv4.

New in version 0.1.0: of inspur.sm

Synopsis

  • Set ipv4 information on Inspur server.

Parameters

Parameter

Comments

host

string

Specifies the DNS host name or address for connecting to the remote device over the specified transport. The value of host is used as the destination address for the transport.

interface_name

string / required

Set interface_name.

Choices:

  • eth0

  • eth1

  • bond0

ipv4_address

string

If DHCP is disabled, specify a static IPv4 address to be configured for the selected interface.

Required when ipv4_dhcp_enable=static.

ipv4_dhcp_enable

string

Enable ‘Enable DHCP’ to dynamically configure IPv4 address using Dynamic Host Configuration Protocol (DHCP).

Choices:

  • dhcp

  • static

ipv4_gateway

string

If DHCP is disabled, specify a static Default Gateway to be configured for the selected interface.

Required when ipv4_dhcp_enable=static.

ipv4_status

string

Enable or disable IPV4.

Choices:

  • enable

  • disable

ipv4_subnet

string

If DHCP is disabled, specify a static Subnet Mask to be configured for the selected interface.

Required when ipv4_dhcp_enable=static.

password

string

Specifies the password to use to authenticate the connection to the remote device. If the value is not specified in the task, the value of environment variable ANSIBLE_NET_PASSWORD will be used instead.

provider

dictionary

A dict object containing connection details.

host

string

Specifies the DNS host name or address for connecting to the remote device over the specified transport. The value of host is used as the destination address for the transport.

password

string

Specifies the password to use to authenticate the connection to the remote device. If the value is not specified in the task, the value of environment variable ANSIBLE_NET_PASSWORD will be used instead.

username

string

Configures the username to use to authenticate the connection to the remote device. If the value is not specified in the task, the value of environment variable ANSIBLE_NET_USERNAME will be used instead.

username

string

Configures the username to use to authenticate the connection to the remote device. If the value is not specified in the task, the value of environment variable ANSIBLE_NET_USERNAME will be used instead.

Examples

- name: Ipv4 test
  hosts: ism
  connection: local
  gather_facts: no
  vars:
    ism:
      host: "{{ ansible_ssh_host }}"
      username: "{{ username }}"
      password: "{{ password }}"

  tasks:

  - name: "Set ipv4 information"
    inspur.sm.edit_ipv4:
      interface_name: "eth0"
      ipv4_status: "disable"
      provider: "{{ ism }}"

  - name: "Set ipv4 information"
    inspur.sm.edit_ipv4:
      interface_name: "eth0"
      ipv4_status: "enable"
      ipv4_dhcp_enable: "dhcp"
      provider: "{{ ism }}"

  - name: "Set ipv4 information"
    inspur.sm.edit_ipv4:
      interface_name: "eth0"
      ipv4_status: "enable"
      ipv4_dhcp_enable: "static"
      ipv4_address: "100.2.36.10"
      ipv4_subnet: "255.255.255.0"
      ipv4_gateway: "100.2.36.1"
      provider: "{{ ism }}"

Return Values

Common return values are documented here, the following are the fields unique to this module:

Key

Description

changed

boolean

Check to see if a change was made on the device.

Returned: always

message

string

Messages returned after module execution.

Returned: always

state

string

Status after module execution.

Returned: always

Authors

  • WangBaoshan (@ISIB-group)