steampunk.aws.ec2_volume_info (0.9.0) — module

List EC2 EBS volumes

Authors: Manca Bizjak (@mancabizjak), Aljaz Kosir (@aljazkosir), Saso Stanovnik (@sstanovnik), Miha Dolinar (@mdolinar), Tadej Borovsak (@tadeboro)

preview | supported by XLAB Steampunk

Install collection

Install with ansible-galaxy collection install steampunk.aws:==0.9.0


Add to requirements.yml

  collections:
    - name: steampunk.aws
      version: 0.9.0

Description

Retrieve information about AWS EC2 EBS volumes.

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: List all EC2 EBS volumes
  ec2_volume_info:
  register: result
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: List a specific EC2 EBS volume
  ec2_volume_info:
    ids: vol-123asd
  register: result
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: List several EC2 EBS volumes according to their name tag
  ec2_volume_info:
    names:
      - volume-1
      - volume-2
  register: result

Inputs

    
ids:
    description:
    - Perform the operation for the specified resources.
    elements: str
    type: list

auth:
    description:
    - Parameters for authenticating with the AWS service. Each of them may be defined
      via environment variables.
    suboptions:
      access_key:
        description:
        - The AWS access key ID. If not set, the value of the AWS_ACCESS_KEY environment
          variable will be checked.
        - Mutually exclusive with I(profile).
        required: false
        type: str
      profile:
        description:
        - The name of the AWS profile configured with C(aws configure).
        - Can be used instead of explicitly specifying your access credentials and region.
        - Use C(default) to use the default profile.
        - Mutually exclusive with I(access_key) and I(secret_key).
        required: false
        type: str
      region:
        description:
        - The name of the AWS region.
        - If not set, the value of the AWS_REGION environment variable will be checked.
        - If you set a I(profile) that specifies a default region, that region is used
          and you can omit this parameter. Use this parameter to override the profile's
          default region.
        type: str
      secret_key:
        description:
        - The AWS secret access key. If not set, the value of the AWS_SECRET_KEY environment
          variable will be checked.
        - Mutually exclusive with I(profile).
        required: false
        type: str
      url:
        description:
        - The URL to the AWS service related to the resource. By default, this is automatically
          determined through the region parameter.
        - If not set explicitly, the value of the AWS_<SERVICE>_URL environment variable
          will be used.
        - The services currently supported are EC2 and S3.
        required: false
        type: str
    type: dict

type:
    description: Limit the results to EBS volumes of the specified type.
    type: str

names:
    description:
    - Limit the results to the resources with specified names.
    elements: str
    type: list

filters:
    description:
    - Filters to use when querying AWS resources. They must be provided as key/value pairs.
    - Keys and values are case-sensitive and must be strings.
    - Each key can have multiple values, provided as a list. Within these values, I(any)
      value must match for the AWS resource to be included.
    - When multiple filters are provided, the result contains AWS resources matching I(all)
      of them.
    - If a filter is specified in C(filters) and also in another top-level parameter,
      the filter in the top-level parameter has precedence. The two are not merged.
    - If a module accepts a top-level parameter for querying the AWS resources, and you
      also specify the filter it corresponds to via C(filters), the top-level parameter
      has precedence.
    type: dict

availability_zone:
    description:
    - ID of the availability zone
    - Limit the results to EBS volumes in the specified availability zone.
    type: str

Outputs

objects:
  contains:
    attachment:
      contains:
        device:
          description: Name of the block device under which this volume is available
            to the instance.
          returned: always
          type: str
        instance:
          description: The ID of the instance the volume is attached to.
          returned: always
          type: str
        keep_on_termination:
          description: Whether the volume is preserved when terminating the instance.
          returned: always
          type: bool
      description: The attachment of this volume to an instance, if any.
      returned: when I(state=attached)
      type: dict
    availability_zone:
      description: The ID of the availability zone in which the volume exists.
      returned: always
      type: str
    id:
      description: The ID of the volume.
      returned: always
      type: str
    size_gib:
      description: Size of the volume in GiB.
      returned: always
      type: int
    state:
      description: State of the EC2 volume as reported by AWS.
      returned: always
      type: str
    tags:
      description: The tags assigned to this volume.
      returned: always
      type: dict
    type:
      description: The type of the volume.
      returned: always
      type: str
  description:
  - A list of objects representing EC2 EBS volumes.
  returned: success
  sample:
    objects:
    - attachment:
        device: /dev/sdf
        instance: i-18fg46a2dsd
        keep_on_termination: true
      availability_zone: eun1-az1
      id: vol-07bf55269d200d90e
      size_gib: 5
      state: available
      tags:
        Name: myfirstvolume
      type: standard
  type: list

See also