1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

inventory/Aos - Add session information to group all variables (#21719)

* Add aos.session information to group all variables

* Revert IP address change

* Remove space in empty line for PEP8
This commit is contained in:
Damien 2017-02-22 13:45:49 -08:00 committed by Peter Sprygada
parent 3f391f5a23
commit 0141c0c336

View file

@ -310,6 +310,9 @@ class AosInventory(object):
aos.login()
# Save session information in variables of group all
self.add_var_to_group('all', 'aos_session', aos.session)
# ----------------------------------------------------
# Build the inventory
# 2 modes are supported: device based or blueprint based
@ -482,7 +485,6 @@ class AosInventory(object):
except:
pass
def parse_cli_args(self):
""" Command line argument processing """
@ -517,6 +519,16 @@ class AosInventory(object):
self.inventory['_meta']['hostvars'][host][var] = value
def add_var_to_group(self, group, var, value):
# Check if the group exist, if not initialize it
if group not in self.inventory.keys():
self.inventory[group] = {}
self.inventory[group]['hosts'] = []
self.inventory[group]['vars'] = {}
self.inventory[group]['vars'][var] = value
def add_device_facts_to_var(self, device_name, device):
# Populate variables for this host