def get_variables(self, hostname, **kwargs): result = BaseInventory.get_variables(self, hostname, **kwargs) if hasattr(self, 'get_host_variables'): result = utils.combine_vars( result, self.get_host_variables( hostname, vault_password=self._vault_password)) return PloyInventoryDict(result)
def test_simple_string_fqdn_vars(self): inventory = Inventory('foo.example.com:2222,bar.example.com') var = inventory.get_variables('foo.example.com') self.assertEqual(var['ansible_ssh_port'], 2222)
def test_simple_string_ipv6_vars(self): inventory = Inventory('[FE80:EF45::12:1]:2222,192.168.1.1') var = inventory.get_variables('FE80:EF45::12:1') self.assertEqual(var['ansible_ssh_port'], 2222)
def test_simple_string_ipv4_vars(self): inventory = Inventory('127.0.0.1:2222,192.168.1.1') var = inventory.get_variables('127.0.0.1') self.assertEqual(var['ansible_ssh_port'], 2222)
def test_simple_string_ipv6_vars(self): inventory = Inventory("[FE80:EF45::12:1]:2222,192.168.1.1") var = inventory.get_variables("FE80:EF45::12:1") self.assertEqual(var["ansible_ssh_port"], 2222)