nttmcp.mcp.sec_group (1.0.9) — module

Create, Update and Remove Security Groups

| "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

Create, Update and Remove Security Groups

https://docs.mcp-services.net/x/NgMu


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: Create a VLAN Security Group
    sec_group:
      region: na
      datacenter: NA9
      network_domain: my_cnd
      name: my_vlan_sec_group
      vlan: my_vlan
      description: "My VLAN Security Group"

  - name: Create a Server Security Group
    sec_group:
      region: na
      datacenter: NA9
      network_domain: my_cnd
      name: my_server_sec_group
      description: "My Server Security Group"

  - name: Update a Server Security Group
    sec_group:
      region: na
      datacenter: NA9
      network_domain: my_cnd
      name: my_server_sec_group
      new_name: my_new_sec_group
      description: "My New Server Security Group"

  - name: Update a Server Security Group by ID
    sec_group:
      region: na
      datacenter: NA9
      network_domain: my_cnd
      id: b2fbd7e6-ddbb-4eb6-a2dd-ad048bc5b9ae
      new_name: my_new_sec_group
      description: "My New Server Security Group"

  - name: Remove a Security Group by name
    sec_group:
      region: na
      datacenter: NA9
      network_domain: my_cnd
      name: my_vlan_sec_group
      state: absent

  - name: Remove a Security Group by ID
    sec_group:
      region: na
      datacenter: NA9
      network_domain: my_cnd
      id: b2fbd7e6-ddbb-4eb6-a2dd-ad048bc5b9ae
      state: absent

Inputs

    
id:
    description:
    - The UUID of the Security Group
    required: false
    type: str

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

name:
    description:
    - The name of the Security Group
    required: false
    type: str

vlan:
    description:
    - The name of the vlan to search on
    required: false
    type: str

force:
    default: false
    description:
    - Forces the deltion of the Security Group even if there are still servers as members
    - This action will remove all servers first and then the Security Group itself
    required: false
    type: bool

state:
    choices:
    - present
    - absent
    default: present
    description:
    - The action to be performed
    - Unless force is set to True a Security Group can only be removed once there are
      no member servers
    required: false
    type: str

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

new_name:
    description:
    - Used when updating the name of an existing Security Group
    required: false
    type: str

datacenter:
    description:
    - The datacenter name e.g NA9
    required: true
    type: str

description:
    description:
    - The description for the Security Group
    required: false
    type: str

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

Outputs

data:
  contains:
    createTime:
      description: The time (in zulu) that the Security Group was created
      sample: '2019-11-26T19:29:52.000Z'
      type: str
    datacenterId:
      description: The MCP/datacenter ID
      sample: NA12
      type: str
    description:
      description: Text description
      sample: My VLAN security group
      type: str
    id:
      description: The UUID of the Security Group
      sample: b2fbd7e6-ddbb-4eb6-a2dd-ad048bc5b9ae
      type: str
    name:
      description: The name of the Security Group
      sample: my_vlan_security_group
      type: str
    nics:
      contains:
        nic:
          contains:
            id:
              description: The UUID of the NIC
              sample: 7b664273-05fa-467f-82c2-6dea32cdf233
              type: str
            ipv4Address:
              description: The IPv4 address of the NIC
              sample: 10.0.0.7
              type: str
            ipv6Address:
              description: The IPv6 address of the NIC
              sample: 1111:1111:1111:1111:0:0:0:1
              type: str
            primary:
              description: Is the NIC the primary NIC on the server
              type: bool
            server:
              contains:
                id:
                  description: The UUID of the server
                  sample: b2fbd7e6-ddbb-4eb6-a2dd-ad048bc5b9ae
                  type: str
                name:
                  description: The name of the server
                  sample: myServer03
                  type: str
              description: dict containing server information for this NIC
              type: complex
          description: List of NICs in this Security Group
          type: list
        vlanId:
          description: The UUID of the VLAN for the NICs
          sample: b2fbd7e6-ddbb-4eb6-a2dd-ad048bc5b9ae
          type: str
      description: List of NICs associated with the Security Group
      returned: type == vlan and at least 1 NIC is configured in this group
      type: complex
    servers:
      contains:
        networkDomainId:
          description: The UUID of the Cloud Network Domain
          sample: b2fbd7e6-ddbb-4eb6-a2dd-ad048bc5b9ae
          type: str
        server:
          contains:
            id:
              description: The UUID of the server
              sample: b2fbd7e6-ddbb-4eb6-a2dd-ad048bc5b9ae
              type: str
            name:
              description: The name of the server
              sample: myServer01
              type: str
          description: List of server objects
          type: list
      description: List of servers associated with the Security Group
      returned: type == server and at least 1 server is configured in this group
      type: complex
    state:
      description: The operational state
      sample: NORMAL
      type: str
    type:
      description: The Security Group type
      sample: VLAN
      type: str
  description: Security Group object
  returned: state == present
  type: complex
msg:
  description: A helpful message
  returned: state == absent and on failure
  sample: The Security Group was successfully removed
  type: str