noderings.cloud.firewall_ruleset module – Manage NodeRings firewall rulesets and their rules
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.firewall_ruleset.
New in noderings.cloud 0.1.0
Synopsis
A ruleset is an ordered list of firewall rules that can be attached to virtual machines (see
firewall_ruleset).When
rulesis given, the ruleset is made to hold exactly those rules, in that order. Rules that already match are kept, so their IDs stay the same.The firewall runs in the guest, so the VM’s hosting provider must support
guest_firewall.
Requirements
The below requirements are needed on the host that executes this module.
python >= 3.9
Parameters
Parameter |
Comments |
|---|---|
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: |
|
With Choices:
|
|
Name of the ruleset. Unique within the organization. |
|
Organization to act in, sent as the Defaults to the organization the token belongs to. If not set, the value of the |
|
The rules, first evaluated first. At most 50. Leave unset to not manage the rules. An empty list removes all rules. |
|
What to do with matching traffic. Choices:
|
|
Where the traffic goes. |
|
IDs of address groups. Default: |
|
Names of address groups (see noderings.cloud.firewall_address_group). Default: |
|
Addresses or prefixes. Default: |
|
Match the addresses of your virtual machines that have any of these tags. Each tag must be on at least one existing virtual machine when the rule is written, so create the VMs first. If no VM has the tag any more, the platform skips the rule. Default: |
|
One port such as |
|
Choices:
|
|
IP protocol in lower case, for example Any IANA protocol name the platform knows is accepted, such as Default: |
|
Where the traffic comes from. A rule needs a |
|
IDs of address groups. Default: |
|
Names of address groups (see noderings.cloud.firewall_address_group). Default: |
|
Addresses or prefixes. Default: |
|
Match the addresses of your virtual machines that have any of these tags. Each tag must be on at least one existing virtual machine when the rule is written, so create the VMs first. If no VM has the tag any more, the platform skips the rule. Default: |
|
One port such as |
|
Whether the ruleset should exist. Choices:
|
|
Whether to validate the API’s TLS certificate. Choices:
|
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: Web server firewall
noderings.cloud.firewall_ruleset:
name: web
rules:
- {direction: ingress, action: accept, protocol: tcp, destination_ports: "22", source: {address_groups: [office]}}
- {direction: ingress, action: accept, protocol: tcp, destination_ports: "80", source: {cidrs: [0.0.0.0/0]}}
- {direction: ingress, action: accept, protocol: tcp, destination_ports: "443", source: {cidrs: [0.0.0.0/0]}}
- {direction: ingress, action: accept, protocol: tcp, destination_ports: "443", source: {cidrs: ["::/0"]}}
- {direction: ingress, action: accept, protocol: icmp, source: {cidrs: [0.0.0.0/0]}}
- {direction: ingress, action: drop, protocol: any, source: {cidrs: [0.0.0.0/0]}}
register: fw
- name: Remove a ruleset
noderings.cloud.firewall_ruleset:
name: old
state: absent
force: true
Return Values
Common return values are documented here, the following are the fields unique to this module:
Key |
Description |
|---|---|
The ruleset with its rules. Empty after Returned: always Sample: |