noderings.cloud.virtual_machine module – Order and manage NodeRings virtual machines
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.virtual_machine.
New in noderings.cloud 0.1.0
Synopsis
Orders a virtual machine from a hosting provider on the NodeRings marketplace, keeps its tags, firewall and power state as configured, reinstalls it on request, and deletes it.
Choose what to order either with
plan_idandregion_id, or let the module pick an offer fromplan_code,countryandcity(see noderings.cloud.marketplace_offer_info).Plan, region and offer options are only used when the VM is ordered. An existing VM is never moved to another offer, so a cheaper offer appearing later does not replace your server.
Requirements
The below requirements are needed on the host that executes this module.
python >= 3.9
Parameters
Parameter |
Comments |
|---|---|
Reinstall an existing VM when Choices:
|
|
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: |
|
Timeout in seconds for a single HTTP request. Default: |
|
A NodeRings service-account token. Create one in the NodeRings console under If not set, the value of the |
|
Base URL of the NodeRings API. If not set, the value of the Default: |
|
Strongly recommended with Choices:
|
|
City of the offer, for example |
|
Country of the offer, for example |
|
Promotion code applied to the order. |
|
Operating system, for example Defaults to the provider’s default distro, or the instant app’s distro. For an existing VM a different value only takes effect with |
|
Name or ID of the firewall ruleset to attach. An empty string detaches the current one. Leave unset to not manage the firewall. The provider must support |
|
Hostname of the VM. Used to find an existing VM, so keep it unique within the organization. Required unless |
|
ID of an existing VM. Takes precedence over |
|
Slug of a one-click application to install, for example |
|
Settings for the instant app. |
|
Organization to act in, sent as the Defaults to the organization the token belongs to. If not set, the value of the |
|
Root password. Only used when the VM is ordered or reinstalled. Prefer |
|
Marketplace plan code, for example |
|
Only consider offers from this hosting provider, given by its provider ID, its storefront slug (for example A name that more than one provider uses fails; give the provider ID or storefront slug then. Without a provider the module picks the best offer from any provider (see Mutually exclusive with |
|
Only consider offers from this hosting provider. |
|
Region of |
|
Only consider providers that support all of these, for example
Default: |
|
Only consider offers with IPv6 in the city. Choices:
|
|
How to choose between offers. Choices:
|
|
Names or IDs of SSH keys to install for root. See noderings.cloud.ssh_key. Only used when the VM is ordered or reinstalled. Default: |
|
Choices:
|
|
Only consider offers from the provider with this public storefront. |
|
Tags. Firewall rules can match VMs by tag. Leave unset to not manage tags. |
|
Whether to validate the API’s TLS certificate. Choices:
|
|
Wait until the operation has finished before returning. Choices:
|
|
How long to wait, in seconds, when Default: |
Attributes
Attribute |
Support |
Description |
|---|---|---|
Support: full |
Can run in check_mode and return changed status prediction without modifying the target. |
|
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.noderingsaction group, so connection options can be set once withmodule_defaults.
Examples
- name: Order a small hourly server in Ashburn
noderings.cloud.virtual_machine:
hostname: web-1
plan_code: SC-GC-1C-1G-20
country: United States
city: Ashburn
billing_type: usage
distro: ubuntu_24_04
ssh_keys: [laptop]
tags: [web, prod]
firewall_ruleset: web
state: running
register: vm
- name: Order the same size from one provider, by its storefront slug
noderings.cloud.virtual_machine:
hostname: web-2
plan_code: SC-GC-1C-1G-20
country: United States
city: Ashburn
billing_type: usage
provider: acme-hosting
distro: ubuntu_24_04
ssh_keys: [laptop]
state: running
- name: Wait for SSH
ansible.builtin.wait_for:
host: "{{ vm.virtual_machine.ipv4 }}"
port: 22
- name: Stop it for the night
noderings.cloud.virtual_machine:
hostname: web-1
state: stopped
- name: Delete it
noderings.cloud.virtual_machine:
hostname: web-1
state: absent
Return Values
Common return values are documented here, the following are the fields unique to this module:
Key |
Description |
|---|---|
The VM. Empty after Returned: always Sample: |