mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-07 22:02:50 +00:00
Skip non-management Packet IP addresses (#48168)
Non-management (elastic) IP addresses require manual configuration on the host as described in https://help.packet.net/article/54-elastic-ips. Skip those so that only the automatically configured management addresses are used. Otherwise, a non-routable address may be returned in the inventory.
This commit is contained in:
committed by
John R Barker
parent
4951e5a5b7
commit
3ada56e2b1
@@ -298,10 +298,15 @@ class PacketInventory(object):
|
|||||||
if device.state not in self.packet_device_states:
|
if device.state not in self.packet_device_states:
|
||||||
return
|
return
|
||||||
|
|
||||||
# Select the best destination address
|
# Select the best destination address. Only include management
|
||||||
|
# addresses as non-management (elastic) addresses need manual
|
||||||
|
# host configuration to be routable.
|
||||||
|
# See https://help.packet.net/article/54-elastic-ips.
|
||||||
dest = None
|
dest = None
|
||||||
for ip_address in device.ip_addresses:
|
for ip_address in device.ip_addresses:
|
||||||
if ip_address['public'] is True and ip_address['address_family'] == 4:
|
if ip_address['public'] is True and \
|
||||||
|
ip_address['address_family'] == 4 and \
|
||||||
|
ip_address['management'] is True:
|
||||||
dest = ip_address['address']
|
dest = ip_address['address']
|
||||||
|
|
||||||
if not dest:
|
if not dest:
|
||||||
|
|||||||
Reference in New Issue
Block a user