Example #1
0
 def _plugins_play(entities):
     ''' merges all entities adjacent to play '''
     data = {}
     for path in basedirs:
         data = _combine_and_track(
             data,
             get_vars_from_path(self._loader, path, entities,
                                stage), "path '%s'" % path)
     return data
Example #2
0
 def _plugins_play(entities):
     ''' merges all entities adjacent to play '''
     data = {}
     for path in basedirs:
         data = combine_vars(
             data,
             get_vars_from_path(self._loader, path, entities,
                                stage))
     return data
Example #3
0
    def _get_group_variables(self, group):

        # get info from inventory source
        res = group.get_vars()

        # Always load vars plugins
        res = combine_vars(res, get_vars_from_inventory_sources(self.loader, self.inventory._sources, [group], 'all'))
        if context.CLIARGS['basedir']:
            res = combine_vars(res, get_vars_from_path(self.loader, context.CLIARGS['basedir'], [group], 'all'))

        if group.priority != 1:
            res['ansible_group_priority'] = group.priority

        return self._remove_internal(res)
Example #4
0
    def _get_host_variables(self, host):

        if context.CLIARGS['export']:
            # only get vars defined directly host
            hostvars = host.get_vars()

            # Always load vars plugins
            hostvars = combine_vars(hostvars, get_vars_from_inventory_sources(self.loader, self.inventory._sources, [host], 'all'))
            if context.CLIARGS['basedir']:
                hostvars = combine_vars(hostvars, get_vars_from_path(self.loader, context.CLIARGS['basedir'], [host], 'all'))
        else:
            # get all vars flattened by host, but skip magic hostvars
            hostvars = self.vm.get_vars(host=host, include_hostvars=False, stage='all')

        return self._remove_internal(hostvars)