summaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
authorDan Nicholson <nicholson@endlessm.com>2018-12-20 06:06:11 -0600
committerJohn R Barker <john@johnrbarker.com>2018-12-20 12:06:11 +0000
commit3ada56e2b1aef340f3ff98ac3a2b8a31d02a2ef3 (patch)
treed01e3cb3e08b963d68c6412ae4566739c9af8eb9 /contrib
parent4951e5a5b716766936af9d1d01f26a7dcfc43066 (diff)
downloadansible-3ada56e2b1aef340f3ff98ac3a2b8a31d02a2ef3.tar.gz
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.
Diffstat (limited to 'contrib')
-rwxr-xr-xcontrib/inventory/packet_net.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/contrib/inventory/packet_net.py b/contrib/inventory/packet_net.py
index d919a67d80..5368de4eb0 100755
--- a/contrib/inventory/packet_net.py
+++ b/contrib/inventory/packet_net.py
@@ -298,10 +298,15 @@ class PacketInventory(object):
if device.state not in self.packet_device_states:
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
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']
if not dest: