hetzner.hcloud.primary_ip_info 模块 – 收集关于 Hetzner Cloud 主 IP 的信息。

注意

此模块是 hetzner.hcloud 集合 (版本 4.2.2) 的一部分。

如果您使用的是 ansible 包,则可能已经安装了此集合。它不包含在 ansible-core 中。要检查它是否已安装,请运行 ansible-galaxy collection list

要安装它,请使用: ansible-galaxy collection install hetzner.hcloud。您需要其他要求才能使用此模块,有关详细信息,请参阅 需求

要在 playbook 中使用它,请指定: hetzner.hcloud.primary_ip_info

概要

  • 收集关于您的 Hetzner Cloud 主 IP 的信息。

别名:hcloud_primary_ip_info

需求

在执行此模块的主机上需要以下要求。

  • python-dateutil >= 2.7.5

  • requests >=2.20

参数

参数

注释

api_endpoint

别名:endpoint

字符串

Hetzner Cloud 的 API 端点。

您也可以使用 HCLOUD_ENDPOINT 环境变量设置此选项。

默认值: "https://api.hetzner.cloud/v1"

api_token

字符串 / 必需

Hetzner Cloud 的 API 令牌。

您也可以使用 HCLOUD_TOKEN 环境变量设置此选项。

id

整数

要获取的主 IP 的 ID。

如果提供的 ID 无效,则模块将失败。

label_selector

字符串

要获取的主 IP 的标签选择器。

name

字符串

要获取的主 IP 的名称。

另请参阅

另请参阅

Hetzner Cloud API 文档

Hetzner Cloud API 的完整参考。

示例

- name: Gather hcloud Primary IP infos
  hetzner.hcloud.primary_ip_info:
  register: output

- name: Gather hcloud Primary IP infos by id
  hetzner.hcloud.primary_ip_info:
    id: 673954
  register: output

- name: Gather hcloud Primary IP infos by name
  hetzner.hcloud.primary_ip_info:
    name: srv1-v4
  register: output

- name: Gather hcloud Primary IP infos by label
  hetzner.hcloud.primary_ip_info:
    label_selector: srv03-ips
  register: output

- name: Print the gathered infos
  debug:
    var: output

返回值

常见的返回值已在此处记录 此处,以下是此模块特有的字段

描述

hcloud_primary_ip_info

复杂类型

主 IP 信息列表

返回: 始终

assignee_id

整数

分配主 IP 的资源的数字标识符。

返回: 始终

示例: 19584637

assignee_type

字符串

分配主 IP 的类型的名称。

返回: 始终

示例: "server"

auto_delete

布尔值

删除分配它的资源时删除主 IP。

返回: 始终

示例: false

delete_protection

布尔值

如果主 IP 受保护以防止删除,则为 True

返回: 始终

dns_ptr

字符串

显示主 IP 的 DNS PTR 记录。

返回: 始终

示例: "srv01.example.com"

home_location

字符串

创建主 IP 的数据中心所在位置

返回: 始终

示例: "fsn1-dc1"

id

整数

主 IP 的数字标识符

返回: 始终

示例: 1937415

ip

字符串

主 IP 的 IP 地址

返回: 始终

示例: "131.232.99.1"

labels

字典

用户定义的标签(键值对)

返回: 始终

name

字符串

主 IP 的名称

返回: 始终

示例: "my-primary-ip"

type

字符串

主 IP 的类型

返回: 始终

示例: "ipv4"

作者

  • Lukas Kaemmerling (@LKaemmerling)

  • Kevin Castner (@kcastner)