phoenixnap.bmc.storage_network (1.17.0) — module

Create/delete storage network on phoenixNAP Bare Metal Cloud.

| "added in version" 1.6.0 of phoenixnap.bmc"

Authors: Pavle Jojkic (@pajuga) <pavlej@phoenixnap.com>, Goran Jelenic (@goranje) <goranje@phoenixnap.com>

preview | supported by certified

Install collection

Install with ansible-galaxy collection install phoenixnap.bmc:==1.17.0


Add to requirements.yml

  collections:
    - name: phoenixnap.bmc
      version: 1.17.0

Description

Create/delete storage network on phoenixNAP Bare Metal Cloud.

This module has a dependency on requests

API is documented at U(https://developers.phoenixnap.com/docs/network-storage/1/overview).

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# All the examples assume that you have file config.yaml with your 'clientId' and 'clientSecret'
# in location: ~/.pnap/config.yaml

- name: Create new storage network for account
  hosts: localhost
  gather_facts: false
  vars_files:
    - ~/.pnap/config.yaml
  tasks:
    - name: Create a storage network and volume
      phoenixnap.bmc.storage_network:
        client_id: "{{ clientId }}"
        client_secret: "{{ clientSecret }}"
        name: My storage network
        location: PHX
        description: My description
        volumes:
          - name: My volume name
            capacityInGb: 1000
        state: present
      register: output
    - name: Print the storage network information
      ansible.builtin.debug:
        var: output.storage_networks
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Delete storage network
  hosts: localhost
  gather_facts: false
  vars_files:
    - ~/.pnap/config.yaml
  tasks:
    - name: Delete storage network
      phoenixnap.bmc.storage_network:
        client_id: "{{ clientId }}"
        client_secret: "{{ clientSecret }}"
        name: My storage network
        state: absent
      register: output
    - name: Print the storage network information
      ansible.builtin.debug:
        var: output.storage_networks

Inputs

    
name:
    description: Storage network friendly name.
    type: str

state:
    choices:
    - present
    - absent
    default: present
    description: Indicate desired state of the target.
    type: str

volumes:
    description:
    - Volume to be created alongside storage.
    - Once a volume is created, it cannot be modified through a playbook
    elements: dict
    suboptions:
      capacityInGb:
        description: Capacity of Volume in GB.
        type: int
      description:
        description: Volume description.
        type: str
      name:
        description: Volume friendly name.
        type: str
      pathSuffix:
        description: Last part of volume's path.
        type: str
      tags:
        description: Tag request to assign to resource.
        elements: dict
        suboptions:
          name:
            description: The name of the tag.
            type: str
          value:
            description: The value of the tag assigned to the resource.
            type: str
        type: list
    type: list

location:
    description:
    - Location of storage network.
    - Once a network is created, it cannot be modified through a playbook
    type: str

client_id:
    description: Client ID (Application Management)
    type: str

client_vlan:
    description: Custom Client VLAN that the Storage Network will be set to.
    type: int

description:
    description: Storage network description.
    type: str

client_secret:
    description: Client Secret (Application Management)
    type: str

Outputs

storage_networks:
  contains:
    createdOn:
      description: Date and time when this storage network was created.
      returned: always
      type: str
    deleteRequestedOn:
      description: Date and time of the initial request for storage network deletion.
      returned: always
      type: str
    description:
      description: Storage network description.
      returned: always
      sample: My storage network description
      type: str
    id:
      description: Storage network ID.
      returned: always
      sample: 603f3b2cfcaf050643b89a4b
      type: str
    ips:
      description: IP of the storage network.
      elements: str
      returned: always
      sample:
      - 100.64.0.1
      - 100.64.0.2
      type: list
    location:
      description: Location of storage network.
      returned: always
      sample: PHX
      type: str
    name:
      description: Storage network friendly name.
      returned: always
      sample: My storage network
      type: str
    networkId:
      description: Id of network the storage belongs to.
      returned: always
      sample: 603f3b2cfcaf050643b89a4b
      type: str
    status:
      description: Status of the resource.
      returned: always
      sample: READY
      type: str
    volumes:
      contains:
        capacityInGb:
          description: Maximum capacity in GB.
          example: 2000
          type: int
        createdOn:
          description: Date and time when this volume was created.
          returned: always
          type: str
        deleteRequestedOn:
          description: Date and time of the initial request for volume deletion.
          returned: always
          type: str
        description:
          description: Volume description.
          example: My volume description
          type: str
        id:
          description: Volume ID.
          sample: 50dc434c-9bba-427b-bcd6-0bdba45c4dd2
          type: str
        name:
          description: Volume friendly name.
          example: My volume name
          type: str
        path:
          description: Volume's full path. It is in form of /{volumeId}/pathSuffix'.
          example: /qjul77ahf5fplr2ba484/shared-docs
          type: str
        pathSuffix:
          description: Last part of volume's path.
          example: /shared-docs
          type: str
        permissions:
          description: Permissions for a volume.
          type: dict
        protocol:
          description: File system protocol. Currently this field should be set to
            NFS.
          example: NFS
          type: str
        status:
          description: Status of the resource.
          example: READY
          type: str
        tags:
          contains:
            createdBy:
              description: Who the tag was created by.
              type: str
            id:
              description: The unique id of the tag.
              type: str
            isBillingTag:
              description: Whether or not to show the tag as part of billing and invoices.
              type: bool
            name:
              description: The name of the tag.
              type: str
            value:
              description: The value of the tag assigned to the resource.
              type: str
          description: The tags assigned if any.
          type: list
        usedCapacityInGb:
          description: Used capacity in GB, updated periodically.
          example: 2000
          type: int
      description: Volume for a storage network.
      returned: always
      type: list
  description: The storage networks information as list
  returned: success
  type: complex