noderings.cloud.role module – Manage custom IAM roles in a NodeRings organization

Note

This module is part of the noderings.cloud collection (version 0.2.0).

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 noderings.cloud. You need further requirements to be able to use this module, see Requirements for details.

To use it in a playbook, specify: noderings.cloud.role.

New in noderings.cloud 0.1.0

Synopsis

  • Creates, updates and deletes custom roles. A role is a set of API permissions.

  • Built-in roles (Owner, Administrator, Operator, Billing, Viewer) cannot be changed or deleted.

Requirements

The below requirements are needed on the host that executes this module.

  • python >= 3.9

Parameters

Parameter

Comments

api_retries

integer

How many times a request is retried after rate limiting (HTTP 429) or a gateway error (HTTP 502, 503 or 504).

Orders (virtual machines, game servers, snapshots) are never retried blindly.

Default: 5

api_timeout

integer

Timeout in seconds for a single HTTP request.

Default: 60

api_token

aliases: token

string

A NodeRings service-account token.

Create one in the NodeRings console under Organization > Service accounts.

If not set, the value of the NODERINGS_TOKEN, NODERINGS_API_TOKEN or NR_API_TOKEN environment variable is used.

api_url

string

Base URL of the NodeRings API.

If not set, the value of the NODERINGS_API_URL environment variable is used.

Default: "https://api.noderings.com"

description

string

Description of the role.

name

string / required

Name of the role. Unique within the organization.

organization_id

string

Organization to act in, sent as the X-Organization-ID header.

Defaults to the organization the token belongs to.

If not set, the value of the NODERINGS_ORGANIZATION_ID or NR_ORGANIZATION_ID environment variable is used.

permissions

list / elements=string

Permissions, by method name such as ListVirtualMachines or by ID. See noderings.cloud.iam_info.

Leave unset to not manage permissions.

purge_permissions

boolean

Remove permissions that are not in permissions. With false, permissions are only added.

Choices:

  • false

  • true ← (default)

state

string

Whether the role should exist.

Choices:

  • "present" ← (default)

  • "absent"

validate_certs

boolean

Whether to validate the API’s TLS certificate.

Choices:

  • false

  • true ← (default)

Attributes

Attribute

Support

Description

check_mode

Support: full

Can run in check_mode and return changed status prediction without modifying the target.

diff_mode

Support: full

Will return details on what has changed (or possibly needs changing in check_mode), when in diff mode.

Notes

Note

  • All modules in this collection belong to the noderings.cloud.noderings action group, so connection options can be set once with module_defaults.

Examples

- name: Read-only access to servers and DNS
  noderings.cloud.role:
    name: server-viewer
    description: Can see servers and DNS
    permissions:
      - ListVirtualMachines
      - GetVirtualMachine
      - ListDnsZones
      - ListDnsRecords

Return Values

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

Key

Description

role

dictionary

The role. permissions are method names. Empty after state=absent.

Returned: always

Sample: {"description": "Can see servers and DNS", "id": "4c3b2a19-0000-0000-0000-000000000000", "is_builtin": false, "name": "server-viewer", "permission_ids": ["043f4a01-0000-0000-0000-000000000000"], "permissions": ["GetVirtualMachine", "ListDnsRecords", "ListDnsZones", "ListVirtualMachines"]}

Authors

  • Shaygun (@shaygun)