Merge pull request #6391 from sergevanginderachter/hashmerge_inventoryscripts
Allow hash_behaviour=merge to be respected in core inventory
This commit is contained in:
commit
d5856bd475
1 changed files with 2 additions and 1 deletions
|
@ -16,6 +16,7 @@
|
||||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
import ansible.constants as C
|
import ansible.constants as C
|
||||||
|
from ansible import utils
|
||||||
|
|
||||||
class Host(object):
|
class Host(object):
|
||||||
''' a single ansible host '''
|
''' a single ansible host '''
|
||||||
|
@ -56,7 +57,7 @@ class Host(object):
|
||||||
results = {}
|
results = {}
|
||||||
groups = self.get_groups()
|
groups = self.get_groups()
|
||||||
for group in sorted(groups, key=lambda g: g.depth):
|
for group in sorted(groups, key=lambda g: g.depth):
|
||||||
results.update(group.get_variables())
|
results = utils.combine_vars(results, group.get_variables())
|
||||||
results.update(self.vars)
|
results.update(self.vars)
|
||||||
results['inventory_hostname'] = self.name
|
results['inventory_hostname'] = self.name
|
||||||
results['inventory_hostname_short'] = self.name.split('.')[0]
|
results['inventory_hostname_short'] = self.name.split('.')[0]
|
||||||
|
|
Loading…
Reference in a new issue