hetzner.hcloud.firewall_resource module – Manage Resources a Hetzner Cloud Firewall is applied to.
Note
This module is part of the hetzner.hcloud collection (version 4.2.2).
You might already have this collection installed if you are using the ansible
package.
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 hetzner.hcloud
.
You need further requirements to be able to use this module,
see Requirements for details.
To use it in a playbook, specify: hetzner.hcloud.firewall_resource
.
New in hetzner.hcloud 2.5.0
Synopsis
Add and Remove Resources a Hetzner Cloud Firewall is applied to.
Aliases: hcloud_firewall_resource
Requirements
The below requirements are needed on the host that executes this module.
python-dateutil >= 2.7.5
requests >=2.20
Parameters
Parameter |
Comments |
---|---|
The API Endpoint for the Hetzner Cloud. You can also set this option by using the Default: |
|
The API Token for the Hetzner Cloud. You can also set this option by using the |
|
Name or ID of the Hetzner Cloud Firewall. |
|
List of Label Selector. |
|
List of Server Name or ID. |
|
State of the firewall resources. Choices:
|
See Also
See also
- Documentation for Hetzner Cloud API
Complete reference for the Hetzner Cloud API.
Examples
- name: Apply a firewall to a list of servers
hetzner.hcloud.firewall_resource:
firewall: my-firewall
servers:
- my-server
- 3456789
state: present
- name: Remove a firewall from a list of servers
hetzner.hcloud.firewall_resource:
firewall: my-firewall
servers:
- my-server
- 3456789
state: absent
- name: Apply a firewall to resources using label selectors
hetzner.hcloud.firewall_resource:
firewall: my-firewall
label_selectors:
- env=prod
state: present
- name: Remove a firewall from resources using label selectors
hetzner.hcloud.firewall_resource:
firewall: my-firewall
label_selectors:
- env=prod
state: absent
Return Values
Common return values are documented here, the following are the fields unique to this module:
Key |
Description |
---|---|
The Resources a Hetzner Cloud Firewall is applied to. Returned: always |
|
Name of the Hetzner Cloud Firewall. Returned: success Sample: |
|
List of Label Selector. Returned: success Sample: |
|
List of Server Name. Returned: success Sample: |