From 679573af73517de06d44198279fdd1437ebf2fde Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Moser?= Date: Sun, 15 Jan 2023 22:53:15 +0100 Subject: [PATCH] inventory: add v6_main_ip to attributes (#54) --- changelogs/fragments/inventory-ipv6.yml | 2 ++ plugins/inventory/vultr.py | 11 +++++++++++ 2 files changed, 13 insertions(+) create mode 100644 changelogs/fragments/inventory-ipv6.yml diff --git a/changelogs/fragments/inventory-ipv6.yml b/changelogs/fragments/inventory-ipv6.yml new file mode 100644 index 0000000..f481e65 --- /dev/null +++ b/changelogs/fragments/inventory-ipv6.yml @@ -0,0 +1,2 @@ +minor_changes: + - inventory - Added IPv6 support by adding ``v6_main_ip`` to the attributes and improved docs (https://github.com/vultr/ansible-collection-vultr/pull/54). diff --git a/plugins/inventory/vultr.py b/plugins/inventory/vultr.py index 62596f1..96103f7 100644 --- a/plugins/inventory/vultr.py +++ b/plugins/inventory/vultr.py @@ -75,6 +75,7 @@ - plan - hostname - main_ip + - v6_main_ip filters: description: - Filter hosts with Jinja2 templates. @@ -125,6 +126,16 @@ plugin: vultr.cloud.vultr compose: ansible_host: vultr_main_ip + +# Respectively for IPv6: +plugin: vultr.cloud.vultr +compose: + ansible_host: vultr_v6_main_ip + +# Prioritize IPv6 over IPv4 if available. +plugin: vultr.cloud.vultr +compose: + ansible_host: vultr_v6_main_ip or vultr_main_ip """ RETURN = r""" # """