From 65f04da1a7df3f7000599a3c565d8dec67394d40 Mon Sep 17 00:00:00 2001 From: Markus Opolka Date: Fri, 9 Dec 2022 12:18:41 +0100 Subject: [PATCH] Add option to use public_ip as hostname in inventory plugin --- plugins/inventory/instance.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/plugins/inventory/instance.py b/plugins/inventory/instance.py index 9d579ba0..d9b0ba79 100644 --- a/plugins/inventory/instance.py +++ b/plugins/inventory/instance.py @@ -32,6 +32,7 @@ default: v4_default_ip choices: - v4_default_ip + - v4_public_ip - hostname filter_by_zone: description: Only return instances in the provided zone. @@ -97,6 +98,9 @@ name: {{ instance.name }} hostname: {{ instance.hostname or instance.name | lower }} v4_default_ip: {{ instance.nic[0].ipaddress }} + {% if instance.publicip %} + v4_public_ip: {{ instance.publicip }} + {% endif %} zone: {{ instance.zonename }} domain: {{ instance.domain | lower }}