nttmcp.mcp.server_nic (1.0.9) — module

Add, update or remove the NIC configuration for an existing server

| "added in version" 2.10.0 of nttmcp.mcp"

Authors: Ken Sinfield (@kensinfield)

preview | supported by NTT Ltd.

Install collection

Install with ansible-galaxy collection install nttmcp.mcp:==1.0.9


Add to requirements.yml

  collections:
    - name: nttmcp.mcp
      version: 1.0.9

Description

Add, update or remove the NIC configuration for an existing server


Requirements

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- hosts: 127.0.0.1
  connection: local
  collections:
    - nttmcp.mcp
  tasks:

  - name: Add a NIC
    server_nic:
      region: na
      datacenter: NA9
      network_domain: my_network_domain
      server: server01
      type: E1000
      vlan: my_vlan
      state: present

  - name: Change the NIC type
    server_nic:
      region: na
      datacenter: NA9
      network_domain: my_network_domain
      server: server01
      type: VMXNET3
      vlan: my_vlan
      state: present

  - name: Disconnect a NIC
    server_nic:
      region: na
      datacenter: NA9
      network_domain: my_network_domain
      server: server01
      vlan: my_vlan
      connected: False

  - name: Connect a NIC
    server_nic:
      region: na
      datacenter: NA9
      network_domain: my_network_domain
      server: server01
      vlan: my_vlan

  - name: Exchange VLANs between two NICs
    server_nic:
      region: na
      datacenter: NA9
      network_domain: my_network_domain
      server: server01
      vlan: my_vlan_1
      vlan_2: my_vlan_2
      state: exchange

  - name: Delete a NIC
    server_nic:
      region: na
      datacenter: NA9
      network_domain: my_network_domain
      server: server01
      vlan: my_vlan
      state: absent

Inputs

    
auth:
    description:
    - Optional dictionary containing the authentication and API information for Cloud
      Control
    required: false
    suboptions:
      api:
        description:
        - The Cloud Control API endpoint e.g. api-na.mcp-services.net
        required: false
        type: str
      api_version:
        description:
        - The Cloud Control API version e.g. 2.11
        required: false
        type: str
      password:
        description:
        - The Cloud Control API user password
        required: false
        type: str
      username:
        description:
        - The Cloud Control API username
        required: false
        type: str
    type: dict

stop:
    default: true
    description:
    - Should the server be stopped if it is running
    - Disk operations can only be performed while the server is stopped
    required: false
    type: bool

type:
    choices:
    - VMXNET3
    - E1000
    default: VMXNET3
    description:
    - The type of NIC adapter
    required: false
    type: str

vlan:
    description:
    - The name of the VLAN for this NIC operation
    - servers can only have a single NIC in a given VLAN
    required: false
    type: str

wait:
    default: true
    description:
    - Should Ansible wait for the task to complete before continuing
    required: false
    type: bool

start:
    default: true
    description:
    - Should the server be started after the NIC operations have completed
    required: false
    type: bool

state:
    choices:
    - present
    - absent
    - exchange
    default: present
    description:
    - The action to be performed
    required: false
    type: str

region:
    default: na
    description:
    - The geographical region
    required: false
    type: str

server:
    description:
    - The name of the server
    required: true
    type: str

vlan_2:
    description:
    - The name of the VLAN for the secondary NIC when exchanging NIC VLANs
    required: false
    type: str

connected:
    default: true
    description:
    - Should the NIC be connected at boot
    required: false
    type: bool

wait_time:
    default: 1200
    description: The maximum time the Ansible should wait for the task to complete in
      seconds
    required: false
    type: int

datacenter:
    description:
    - The datacenter name
    required: true
    type: str

ipv4_address:
    description:
    - The IPv4 address for for the NIC to be operated on
    - If both the VLAN and IPv4 address are supplied, the IPv4 address takes precendence
    required: false
    type: str

ipv4_address_2:
    description:
    - The IPv4 address for for the secondary NIC when exchanging NIC VLANs
    - If both the VLAN and IPv4 address are supplied, the IPv4 address takes precendence
    required: false
    type: str

network_domain:
    description:
    - The name of the Cloud Network Domain
    required: true
    type: str

wait_for_vmtools:
    default: false
    description:
    - Should Ansible wait for VMWare Tools to be running before continuing
    - This should only be used for server images that are running VMWare Tools
    - This should not be used for NGOC (Non Guest OS Customization) servers/images
    required: false
    type: bool

wait_poll_interval:
    default: 30
    description:
    - The time in between checking the status of the task in seconds
    required: false
    type: int

Outputs

data:
  contains:
    cpu:
      contains:
        coresPerSocket:
          description: The number of cores per CPU socket
          sample: 1
          type: int
        count:
          description: The number of CPUs
          sample: 2
          type: int
        speed:
          description: The CPU reservation to be applied
          sample: STANDARD
          type: str
      description: The default CPU specifications for the image
      returned: when state == present and wait is True
      type: complex
    createTime:
      description: The creation date of the server
      returned: when state == present and wait is True
      sample: '2019-01-14T11:12:31.000Z'
      type: str
    datacenterId:
      description: Datacenter id/location
      returned: when state == present and wait is True
      sample: NA9
      type: str
    deployed:
      description: Is the server deployed
      returned: when state == present and wait is True
      type: bool
    floppy:
      contains:
        driveNumber:
          description: The drive number
          sample: 0
          type: int
        id:
          description: The UUID of the drive
          sample: b2fbd7e6-ddbb-4eb6-a2dd-ad048bc5b9ae
          type: str
        key:
          description: Internal usage
          sample: 8000
          type: int
        state:
          description: The state of the drive
          sample: NORMAL
          type: str
      description: List of the attached floppy drives
      returned: when state == present and wait is True
      type: complex
    guest:
      contains:
        operatingSystem:
          contains:
            displayName:
              description: The OS display name
              sample: CENTOS7/64
              type: str
            family:
              description: The OS family
              sample: UNIX
              type: str
            id:
              description: The OS UUID
              sample: b2fbd7e6-ddbb-4eb6-a2dd-ad048bc5b9ae
              type: str
            osUnitsGroupId:
              description: The OS billing group
              sample: CENTOS
              type: str
          description: Operating system information
          type: complex
        osCustomization:
          description: Does the image support guest OS customization
          type: bool
        vmTools:
          contains:
            apiVersion:
              description: The version of VMWare Tools
              sample: 9256
              type: int
            runningStatus:
              description: Is VMWare Tools running
              sample: NOT_RUNNING
              type: str
            type:
              description: VMWare Tools or Open VM Tools
              sample: VMWARE_TOOLS
              type: str
            versionStatus:
              description: Additional information
              sample: NEED_UPGRADE
              type: str
          description: VMWare Tools information
          type: complex
      description: Information about the guest OS
      returned: when state == present and wait is True
      type: complex
    id:
      description: The UUID of the server
      returned: when state == present
      sample: b2fbd7e6-ddbb-4eb6-a2dd-ad048bc5b9ae
      type: str
    ideController:
      contains:
        adapterType:
          description: The type of the controller
          sample: IDE
          type: str
        channel:
          description: The IDE channel number
          sample: 0
          type: int
        deviceOrDisk:
          contains:
            device:
              contains:
                id:
                  description: The UUID of the device/disk
                  sample: b2fbd7e6-ddbb-4eb6-a2dd-ad048bc5b9ae
                  type: str
                slot:
                  description: The slot number on the controller used by this device
                  sample: 0
                  type: int
                state:
                  description: The state of the device/disk
                  sample: NORMAL
                  type: str
                type:
                  description: The type of the device/disk
                  sample: CDROM
                  type: str
              description: Device/Disk object
              type: complex
          description: List of the attached devices/disks
          type: complex
        id:
          description: The UUID of the controller
          sample: b2fbd7e6-ddbb-4eb6-a2dd-ad048bc5b9ae
          type: str
        key:
          description: Internal Usage
          sample: 200
          type: int
        state:
          description: The state of the controller
          sample: NORMAL
          type: str
      description: List of the server's IDE controllers
      returned: when state == present and wait is True
      type: complex
    memoryGb:
      description: Server memory in GB
      returned: when state == present and wait is True
      sample: 4
      type: int
    name:
      description: The name of the server
      returned: when state == present and wait is True
      sample: my_server
      type: str
    networkInfo:
      contains:
        networkDomainId:
          description: The UUID of the Cloud Network Domain the server resides in
          sample: b2fbd7e6-ddbb-4eb6-a2dd-ad048bc5b9ae
          type: str
        primaryNic:
          contains:
            connected:
              description: Is the NIC connected
              type: bool
            id:
              description: The UUID of the NIC
              sample: b2fbd7e6-ddbb-4eb6-a2dd-ad048bc5b9ae
              type: str
            ipv6:
              description: The IPv6 address of the server
              sample: 1111:1111:1111:1111:0:0:0:1
              type: str
            key:
              description: Internal Usage
              sample: 4000
              type: int
            macAddress:
              description: the MAC address
              sample: aa:aa:aa:aa:aa:aa
              type: str
            networkAdapter:
              description: The VMWare NIC type
              sample: VMXNET3
              type: str
            privateIpv4:
              description: The IPv4 address of the server
              sample: 10.0.0.10
              type: str
            state:
              description: The state of the NIC
              sample: NORMAL
              type: str
            vlanId:
              description: the UUID of the VLAN the server resides in
              sample: b2fbd7e6-ddbb-4eb6-a2dd-ad048bc5b9ae
              type: str
            vlanName:
              description: The name of the VLAN the server resides in
              sample: my_vlan
              type: str
          description: The primary NIC on the server
          type: complex
      description: Server network information
      returned: when state == present and wait is True
      type: complex
    sataController:
      contains:
        adapterType:
          description: The name of the adapter
          sample: LSI_LOGIC_SAS
          type: str
        busNumber:
          description: The SCSI bus number
          sample: 1
          type: int
        disk:
          contains:
            id:
              description: The disk id
              sample: 112b7faa-ffff-ffff-ffff-dc273085cbe4
              type: str
            scsiId:
              description: The id of the disk on the SCSI controller
              sample: 0
              type: int
            sizeGb:
              description: The initial size of the disk in GB
              sample: 10
              type: int
            speed:
              description: The disk speed
              sample: STANDARD
              type: str
          description: List of disks associated with this image
          type: complex
        id:
          description: The SCSI controller id
          sample: 112b7faa-ffff-ffff-ffff-dc273085cbe4
          type: str
        key:
          description: Internal use
          sample: 1000
          type: int
      description: List of SATA controllers on the server
      returned: when state == present and wait is True
      type: list
    scsiController:
      contains:
        adapterType:
          description: The name of the adapter
          sample: LSI_LOGIC_SAS
          type: str
        busNumber:
          description: The SCSI bus number
          sample: 1
          type: int
        disk:
          contains:
            id:
              description: The disk id
              sample: 112b7faa-ffff-ffff-ffff-dc273085cbe4
              type: str
            scsiId:
              description: The id of the disk on the SCSI controller
              sample: 0
              type: int
            sizeGb:
              description: The initial size of the disk in GB
              sample: 10
              type: int
            speed:
              description: The disk speed
              sample: STANDARD
              type: str
          description: List of disks associated with this image
          type: complex
        id:
          description: The SCSI controller id
          sample: 112b7faa-ffff-ffff-ffff-dc273085cbe4
          type: str
        key:
          description: Internal use
          sample: 1000
          type: int
      description: List of the SCSI controllers and disk configuration for the image
      returned: when state == present and wait is True
      type: complex
    source:
      contains:
        type:
          description: The id type of the image
          sample: IMAGE_ID
          type: str
        value:
          description: The UUID of the image
          sample: b2fbd7e6-ddbb-4eb6-a2dd-ad048bc5b9ae
          type: str
      description: The source of the image
      returned: when state == present and wait is True
      type: complex
    started:
      description: Is the server running
      returned: when state == present and wait is True
      type: bool
    state:
      description: The state of the server
      returned: when state == present and wait is True
      sample: NORMAL
      type: str
    tag:
      contains:
        tagKeyId:
          description: the UUID of the tag
          sample: b2fbd7e6-ddbb-4eb6-a2dd-ad048bc5b9ae
          type: str
        tagKeyName:
          description: The tag name
          sample: my_tag
          type: str
        value:
          description: The tag value
          sample: my_tag_value
          type: str
      description: List of informational tags associated with the server
      returned: when state == present and wait is True
      type: complex
    virtualHardware:
      contains:
        upToDate:
          description: Is the VM hardware up to date
          type: bool
        version:
          description: The VM hardware version
          sample: VMX-10
          type: str
      description: Information on the virtual hardware of the server
      returned: when state == present and wait is True
      type: complex
  description: Server objects
  returned: success
  type: complex