community.general.ipify_facts 模块 – 获取互联网网关的公网 IP
注意
此模块是 community.general 集合 (版本 10.1.0) 的一部分。
如果您使用的是 ansible
包,则可能已安装此集合。它不包含在 ansible-core
中。要检查它是否已安装,请运行 ansible-galaxy collection list
。
要安装它,请使用:ansible-galaxy collection install community.general
。
要在 playbook 中使用它,请指定:community.general.ipify_facts
。
概要
如果您位于 NAT 后面并且需要知道您的互联网网关的公网 IP。
参数
属性
备注
注意
访问 https://www.ipify.org 获取更多信息。
示例
# Gather IP facts from ipify.org
- name: Get my public IP
community.general.ipify_facts:
# Gather IP facts from your own ipify service endpoint with a custom timeout
- name: Get my public IP
community.general.ipify_facts:
api_url: http://api.example.com/ipify
timeout: 20
返回值
常见的返回值已在 此处 记录,以下是此模块特有的字段