@@ -1306,6 +1306,18 @@ def _add_region_groups(self):
1306
1306
)
1307
1307
1308
1308
def _fill_host_variables (self , host , hostname ):
1309
+ extracted_primary_ip = self .extract_primary_ip (host = host )
1310
+ if extracted_primary_ip :
1311
+ self .inventory .set_variable (hostname , "ansible_host" , extracted_primary_ip )
1312
+
1313
+ extracted_primary_ip4 = self .extract_primary_ip4 (host = host )
1314
+ if extracted_primary_ip4 :
1315
+ self .inventory .set_variable (hostname , "primary_ip4" , extracted_primary_ip4 )
1316
+
1317
+ extracted_primary_ip6 = self .extract_primary_ip6 (host = host )
1318
+ if extracted_primary_ip6 :
1319
+ self .inventory .set_variable (hostname , "primary_ip6" , extracted_primary_ip6 )
1320
+
1309
1321
for attribute , extractor in self .group_extractors .items ():
1310
1322
extracted_value = extractor (host )
1311
1323
@@ -1338,18 +1350,6 @@ def _fill_host_variables(self, host, hostname):
1338
1350
else :
1339
1351
self .inventory .set_variable (hostname , attribute , extracted_value )
1340
1352
1341
- extracted_primary_ip = self .extract_primary_ip (host = host )
1342
- if extracted_primary_ip :
1343
- self .inventory .set_variable (hostname , "ansible_host" , extracted_primary_ip )
1344
-
1345
- extracted_primary_ip4 = self .extract_primary_ip4 (host = host )
1346
- if extracted_primary_ip4 :
1347
- self .inventory .set_variable (hostname , "primary_ip4" , extracted_primary_ip4 )
1348
-
1349
- extracted_primary_ip6 = self .extract_primary_ip6 (host = host )
1350
- if extracted_primary_ip6 :
1351
- self .inventory .set_variable (hostname , "primary_ip6" , extracted_primary_ip6 )
1352
-
1353
1353
def _get_host_virtual_chassis_master (self , host ):
1354
1354
virtual_chassis = host .get ("virtual_chassis" , None )
1355
1355
0 commit comments