Python ansible.parsing.dataloader.DataLoader() Examples

The following are 30 code examples for showing how to use ansible.parsing.dataloader.DataLoader(). These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example.

You may check out the related API usage on the sidebar.

You may also want to check out all available functions/classes of the module ansible.parsing.dataloader , or try the search function .

Example 1
Project: im   Author: grycap   File: ansible_launcher.py    License: GNU General Public License v3.0 7 votes vote down vote up
def get_play_prereqs_2_4(self, options):
        loader = DataLoader()

        if self.vault_pass:
            loader.set_vault_secrets([('default', VaultSecret(_bytes=to_bytes(self.vault_pass)))])

        # create the inventory, and filter it based on the subset specified (if any)
        inventory = InventoryManager(loader=loader, sources=options.inventory)

        # create the variable manager, which will be shared throughout
        # the code, ensuring a consistent view of global variables
        try:
            # Ansible 2.8
            variable_manager = VariableManager(loader=loader, inventory=inventory,
                                               version_info=self.version_info(ansible_version))
            variable_manager._extra_vars = self.extra_vars
        except TypeError:
            variable_manager = VariableManager(loader=loader, inventory=inventory)
            variable_manager.extra_vars = self.extra_vars
            variable_manager.options_vars = {'ansible_version': self.version_info(ansible_version)}

        return loader, inventory, variable_manager 
Example 2
Project: Practical-Network-Automation-Second-Edition   Author: PacktPublishing   File: checkpython.py    License: MIT License 7 votes vote down vote up
def ansible_part():
    playbook_path = "checktemplate.yml"
    inventory_path = "hosts"

    Options = namedtuple('Options', ['connection', 'module_path', 'forks', 'become', 'become_method', 'become_user', 'check', 'diff', 'listhosts', 'listtasks', 'listtags', 'syntax'])
    loader = DataLoader()
    options = Options(connection='local', module_path='', forks=100, become=None, become_method=None, become_user=None, check=False,
                    diff=False, listhosts=False, listtasks=False, listtags=False, syntax=False)
    passwords = dict(vault_pass='secret')

    inventory = InventoryManager(loader=loader, sources=['inventory'])
    variable_manager = VariableManager(loader=loader, inventory=inventory)
    executor = PlaybookExecutor(  
                playbooks=[playbook_path], inventory=inventory, variable_manager=variable_manager, loader=loader,  
                options=options, passwords=passwords)  
    results = executor.run()  
    print results 
Example 3
Project: im   Author: grycap   File: ansible_launcher.py    License: GNU General Public License v3.0 6 votes vote down vote up
def get_play_prereqs_2(self, options):
        loader = DataLoader()

        if self.vault_pass:
            loader.set_vault_password(self.vault_pass)

        variable_manager = VariableManager()
        variable_manager.extra_vars = self.extra_vars
        variable_manager.options_vars = {'ansible_version': self.version_info(ansible_version)}

        inventory = Inventory(loader=loader, variable_manager=variable_manager, host_list=options.inventory)
        variable_manager.set_inventory(inventory)

        # let inventory know which playbooks are using so it can know the
        # basedirs
        inventory.set_playbook_basedir(os.path.dirname(self.playbook_file))

        return loader, inventory, variable_manager 
Example 4
Project: AnsibleUI   Author: lotus-dgas   File: AnsibleApi_v29.py    License: GNU General Public License v3.0 6 votes vote down vote up
def AnsiblePlaybookExecApi29(task_id, playbook_path, inventory_data=None, extra_vars={}):
    # playbook_path = ['playbooks/test_debug.yml']
    passwords = ""
    options = get_default_options()
    if inventory_data:
        inventory = BaseInventory(inventory_data)
    else:
        inventory = BaseInventory(InventoryInit().get_data())
    loader = DataLoader()
    variable_manager = VariableManagerVars(loader=loader, inventory=inventory)
    variable_manager.extra_vars = extra_vars
    executor = MyPlaybookExecutor_V2(
        task_id=task_id,
        playbooks=playbook_path,
        inventory=inventory,
        variable_manager=variable_manager,
        loader=loader,
        passwords={"conn_pass": passwords},
    )

    context.CLIARGS = ImmutableDict(options)
    executor.run() 
Example 5
Project: chain   Author: hequan2017   File: runner.py    License: Apache License 2.0 6 votes vote down vote up
def __init__(self, playbook_path, inventory=None, options=None):
        """
        :param options: Ansible options like ansible.cfg
        :param inventory: Ansible inventory
        :param BaseInventory:The BaseInventory parameter hostname must be equal to the hosts in yaml
        or the BaseInventory parameter groups must equal to the hosts in yaml.
        """
        if options:
            self.options = options
        C.RETRY_FILES_ENABLED = False
        self.inventory = inventory
        # self.loader = self.loader_class()
        self.loader = DataLoader()
        self.results_callback = self.results_callback_class()
        # self.playbook_path = options.playbook_path
        self.playbook_path = playbook_path
        self.variable_manager = self.variable_manager_class(
            loader=self.loader, inventory=self.inventory
        )
        # self.passwords = options.passwords
        self.passwords = {"passwords": ''}  # 为了修改paramiko中的bug添加入,无实际意义
        self.__check() 
Example 6
Project: tidb-ansible   Author: pingcap   File: inventory_check.py    License: Apache License 2.0 6 votes vote down vote up
def parse_inventory(inventory):
    loader = DataLoader()
    inv = InventoryManager(loader=loader, sources=[inventory])
    vars = VariableManager(loader=loader, inventory=inv)
    all_groups = inv.get_groups_dict()
    tidb_nodes = all_groups['tidb_servers']
    tikv_nodes = all_groups['tikv_servers']
    tidb_servers = {}
    tikv_servers = {}
    for tidb in tidb_nodes:
        var = vars.get_vars(host=inv.get_host(hostname=str(tidb)))
        ip = var['ansible_host'] if 'ansible_host' in var else var['inventory_hostname']
        tidb_port = var.get('tidb_port', 4000)
        tidb_status_port = var.get('tidb_status_port', 10080)
        deploy_dir = var['deploy_dir']

        if ip in tidb_servers:
            tidb_servers[ip].append([tidb_port, tidb_status_port, deploy_dir])
        else:
            tidb_servers[ip] = [[tidb_port, tidb_status_port, deploy_dir]]

    for tikv in tikv_nodes:
        var = vars.get_vars(host=inv.get_host(hostname=str(tikv)))
        ip = var['ansible_host'] if 'ansible_host' in var else var['inventory_hostname']
        tikv_port = var.get('tikv_port', 20160)
        tikv_status_port = var.get('tikv_status_port', 20180)
        deploy_dir = var['deploy_dir']

        if ip in tikv_servers:
            tikv_servers[ip].append([tikv_port, tikv_status_port, deploy_dir])
        else:
            tikv_servers[ip] = [[tikv_port, tikv_status_port, deploy_dir]]

    return [tidb_servers, tikv_servers] 
Example 7
Project: devops   Author: cc0411   File: runner.py    License: GNU General Public License v3.0 6 votes vote down vote up
def __init__(self, playbook_path, inventory=None, options=None):
        """
        :param options: Ansible options like ansible.cfg
        :param inventory: Ansible inventory
        :param BaseInventory:The BaseInventory parameter hostname must be equal to the hosts in yaml
        or the BaseInventory parameter groups must equal to the hosts in yaml.
        """
        if options:
            self.options = options
        C.RETRY_FILES_ENABLED = False
        self.inventory = inventory
        # self.loader = self.loader_class()
        self.loader = DataLoader()
        self.results_callback = self.results_callback_class()
        # self.playbook_path = options.playbook_path
        self.playbook_path = playbook_path
        self.variable_manager = self.variable_manager_class(
            loader=self.loader, inventory=self.inventory
        )
        # self.passwords = options.passwords
        self.passwords = {"passwords": ''}  # 为了修改paramiko中的bug添加入,无实际意义
        self.__check() 
Example 8
Project: Learning-Python-Networking-Second-Edition   Author: PacktPublishing   File: execute_playbook.py    License: MIT License 6 votes vote down vote up
def execute_playbook():
    playbook_path = "playbook_template.yml"
    inventory_path = "hosts"

    Options = namedtuple('Options', ['connection', 'module_path', 'forks', 'become', 'become_method', 'become_user', 'check', 'diff', 'listhosts', 'listtasks', 'listtags', 'syntax'])
    loader = DataLoader()
    options = Options(connection='local', module_path='', forks=100, become=None, become_method=None, become_user=None, check=False,
                    diff=False, listhosts=False, listtasks=False, listtags=False, syntax=False)
    passwords = dict(vault_pass='secret')

    inventory = InventoryManager(loader=loader, sources=['inventory'])
    variable_manager = VariableManager(loader=loader, inventory=inventory)
    executor = PlaybookExecutor(  
                playbooks=[playbook_path], inventory=inventory, variable_manager=variable_manager, loader=loader,  
                options=options, passwords=passwords)  
    results = executor.run()  
    print results 
Example 9
Project: ops-cli   Author: adobe   File: generator.py    License: Apache License 2.0 6 votes vote down vote up
def __init__(self, inventory_generator):
        """
        :type inventory_generator: ops.inventory.generator.InventoryGenerator
        """

        self.inventory_generator = inventory_generator
        self.generated_path, self.ssh_config_path = inventory_generator.generate()

        # clean up variables cache for tests
        ansible_vars.VARIABLE_CACHE = dict()
        ansible_vars.HOSTVARS_CACHE = dict()
        ansible_inventory.HOSTS_PATTERNS_CACHE = dict()

        loader = DataLoader()
        loader.set_basedir(self.generated_path)
        self.inventory = InventoryManager(
            loader=loader, sources=[
                self.generated_path])
        self.variable_manager = VariableManager(
            loader=loader, inventory=self.inventory) 
Example 10
Project: ops-cli   Author: adobe   File: config.py    License: Apache License 2.0 6 votes vote down vote up
def get(self):
        data_loader = DataLoader()
        # data_loader.set_vault_password()
        variable_manager = VariableManager(loader=data_loader)

        extra_vars = self.console_args.extra_vars[:]

        extra_vars.append(
            'cluster=' +
            get_cluster_name(
                self.cluster_config_path))

        options = collections.namedtuple('options', 'extra_vars')
        variable_manager.extra_vars = load_extra_vars(
            loader=data_loader, options=options(extra_vars=extra_vars))

        variables = variable_manager.get_vars()

        rendered = self.template.render(self.cluster_config_path, variables)

        return yaml.safe_load(rendered) 
Example 11
Project: imoocc   Author: iopsgroup   File: ansible_api.py    License: GNU General Public License v2.0 6 votes vote down vote up
def __initializeData(self):
        """ 初始化ansible """
        Options = namedtuple('Options', ['connection','module_path', 'forks', 'timeout',  'remote_user',
                'ask_pass', 'private_key_file', 'ssh_common_args', 'ssh_extra_args', 'sftp_extra_args',
                'scp_extra_args', 'become', 'become_method', 'become_user', 'ask_value_pass', 'verbosity',
                'check', 'listhosts', 'listtasks', 'listtags', 'syntax','diff'])

        self.loader = DataLoader()
        self.options = Options(connection='smart', module_path=None, forks=100, timeout=10,
                remote_user='root', ask_pass=False, private_key_file=None, ssh_common_args=None, ssh_extra_args=None,
                sftp_extra_args=None, scp_extra_args=None, become=None, become_method=None,
                become_user='root', ask_value_pass=False, verbosity=None, check=False, listhosts=False,
                listtasks=False, listtags=False, syntax=False, diff=True)

        self.passwords = dict(sshpass=None, becomepass=None)
        myinvent = MyInventory(self.resource, self.loader, self.variable_manager)
        self.inventory = myinvent.inventory
        self.variable_manager = myinvent.variable_manager

        # self.variable_manager.set_inventory(self.inventory)
        # self.variable_manager = VariableManager(loader=self.loader, inventory=self.inventory) 
Example 12
Project: infrared   Author: redhat-openstack   File: workspaces.py    License: Apache License 2.0 6 votes vote down vote up
def _get_inventory(self, workspace_name=None):
        """Returns Inventory object for the provided workspace.

           Uses active workspace as default.

           :param workspace_name: workspace name to list nodes from.
        """
        workspace = self.get(
            workspace_name) if workspace_name else self.get_active_workspace()

        if workspace is None:
            if workspace_name is None:
                raise exceptions.IRNoActiveWorkspaceFound()
            else:
                raise exceptions.IRWorkspaceMissing(workspace=workspace_name)

        # need to have import here to avoid ansible patching
        from ansible.inventory.manager import InventoryManager
        from ansible.parsing.dataloader import DataLoader

        return InventoryManager(DataLoader(), sources=workspace.inventory) 
Example 13
Project: autoops   Author: hequan2017   File: runner.py    License: Apache License 2.0 6 votes vote down vote up
def __init__(self, playbook_path, inventory=None, options=None):
            """
            :param options: Ansible options like ansible.cfg
            :param inventory: Ansible inventory
            :param BaseInventory:The BaseInventory parameter hostname must be equal to the hosts in yaml
            or the BaseInventory parameter groups must equal to the hosts in yaml.
            """
            if options:
                self.options = options
            C.RETRY_FILES_ENABLED = False
            self.inventory = inventory
            # self.loader = self.loader_class()
            self.loader = DataLoader()
            self.results_callback = self.results_callback_class()
            # self.playbook_path = options.playbook_path
            self.playbook_path = playbook_path
            self.variable_manager = self.variable_manager_class(
                loader=self.loader, inventory=self.inventory
            )
            # self.passwords = options.passwords
            self.passwords = {"passwords":''}#为了修改paramiko中的bug添加入,无实际意义
            self.__check() 
Example 14
Project: AnsibleUI   Author: lotus-dgas   File: AnsibleApi_v29.py    License: GNU General Public License v3.0 5 votes vote down vote up
def AnsibleExecApi29(task_id, tasks=[], inventory_data=None):
    options = get_default_options()
    context.CLIARGS = ImmutableDict(options)

    loader = DataLoader()
    passwords = dict(vault_pass='secret')
    results_callback = RedisCallBack(task_id)
    # inventory = InventoryManager(loader=loader, sources='localhost,')
    if inventory_data:
        inventory = BaseInventory(inventory_data)
    else:
        inventory = BaseInventory(InventoryInit().get_data())
    variable_manager = VariableManager(loader=loader, inventory=inventory)
    play_source =  dict(
            name="Ansible Play",
            hosts='localhost',
            gather_facts='no',
            tasks=tasks,
        )
    play = Play().load(play_source, variable_manager=variable_manager, loader=loader)
    tqm = None
    try:
        tqm = MyTaskQueueManager(
                inventory=inventory,
                variable_manager=variable_manager,
                loader=loader,
                passwords=passwords,
                stdout_callback=results_callback,
            )
        result = tqm.run(play)
    finally:
        if tqm is not None:
            tqm.cleanup()

        shutil.rmtree(C.DEFAULT_LOCAL_TMP, True)


# Ansible 2.9 版本的 vars/manager.py: VariableManager 未有 extra_vars.setter 
Example 15
Project: pipelinewise   Author: transferwise   File: utils.py    License: Apache License 2.0 5 votes vote down vote up
def load_yaml(yaml_file, vault_secret=None):
    """
    Load a YAML file into a python dictionary.

    The YAML file can be fully encrypted by Ansible-Vault or can contain
    multiple inline Ansible-Vault encrypted values. Ansible Vault
    encryption is ideal to store passwords or encrypt the entire file
    with sensitive data if required.
    """
    vault = VaultLib()

    if vault_secret:
        secret_file = get_file_vault_secret(filename=vault_secret, loader=DataLoader())
        secret_file.load()
        vault.secrets = [('default', secret_file)]

    data = None
    if os.path.isfile(yaml_file):
        with open(yaml_file, 'r') as stream:
            try:
                if is_encrypted_file(stream):
                    file_data = stream.read()
                    data = yaml.load(vault.decrypt(file_data, None))
                else:
                    loader = AnsibleLoader(stream, None, vault.secrets)
                    try:
                        data = loader.get_single_data()
                    except Exception as exc:
                        raise Exception(f'Error when loading YAML config at {yaml_file} {exc}')
                    finally:
                        loader.dispose()
            except yaml.YAMLError as exc:
                raise Exception(f'Error when loading YAML config at {yaml_file} {exc}')
    else:
        LOGGER.debug('No file at %s', yaml_file)

    return data 
Example 16
Project: pipelinewise   Author: transferwise   File: utils.py    License: Apache License 2.0 5 votes vote down vote up
def vault_encrypt(plaintext, secret):
    """
    Vault encrypt a piece of data.
    """
    try:
        vault = VaultLib()
        secret_file = get_file_vault_secret(filename=secret, loader=DataLoader())
        secret_file.load()
        vault.secrets = [('default', secret_file)]

        return vault.encrypt(plaintext)
    except AnsibleError as exc:
        LOGGER.critical('Cannot encrypt string: %s', exc)
        sys.exit(1) 
Example 17
Project: KubeOperator   Author: KubeOperator   File: runner.py    License: Apache License 2.0 5 votes vote down vote up
def __init__(self, inventory, options=None):
        self.options = self.get_options(options)
        self.inventory = inventory
        self.loader = DataLoader()
        self.variable_manager = VariableManager(
            loader=self.loader, inventory=self.inventory
        )
        self.set_result_callback() 
Example 18
Project: chain   Author: hequan2017   File: runner.py    License: Apache License 2.0 5 votes vote down vote up
def __init__(self, inventory, options=None):
        if options:
            self.options = options
        self.inventory = inventory
        self.loader = DataLoader()
        self.variable_manager = VariableManager(
            loader=self.loader, inventory=self.inventory
        ) 
Example 19
Project: heartbeats   Author: 510908220   File: ansible_task.py    License: MIT License 5 votes vote down vote up
def __init__(self, host_list, private_key_file, forks, extra_vars=None):
        self._summary = {}
        self._results = {}

        self.variable_manager = VariableManager()
        if extra_vars:
            self.variable_manager.extra_vars = extra_vars
        self.loader = DataLoader()
        self.inventory = Inventory(loader=self.loader,
                                   variable_manager=self.variable_manager,
                                   host_list=host_list)
        Options = namedtuple('Options',
                             ['listtags', 'listtasks', 'listhosts', 'syntax', 'connection', 'module_path', 'forks',
                              'remote_user', 'private_key_file', 'ssh_common_args', 'ssh_extra_args',
                              'sftp_extra_args', 'scp_extra_args', 'become', 'become_method', 'become_user',
                              'verbosity', 'check'])

        self.options = Options(listtags=False,
                               listtasks=False,
                               listhosts=False,
                               syntax=False,
                               connection='ssh',
                               module_path=None,
                               forks=forks, remote_user='root',
                               private_key_file=private_key_file,
                               ssh_common_args=None,
                               ssh_extra_args=None,
                               sftp_extra_args=None,
                               scp_extra_args=None,
                               become=False,
                               become_method=None,
                               become_user='root',
                               verbosity=None, check=False) 
Example 20
Project: commcare-cloud   Author: dimagi   File: main.py    License: BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def _ansible_inventory_data_loader(self):
        return DataLoader() 
Example 21
Project: devops   Author: cc0411   File: runner.py    License: GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, inventory, options=None):
        if options:
            self.options = options
        self.inventory = inventory
        self.loader = DataLoader()
        self.variable_manager = VariableManager(
            loader=self.loader, inventory=self.inventory
        ) 
Example 22
Project: ansible-inventory-grapher   Author: willthames   File: inventory.py    License: GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, inventory, ask_vault_pass, vault_password_files, vault_ids):
        from ansible.cli import CLI
        super(AnsibleInventory, self).__init__()
        loader = DataLoader()
        if vault_ids or vault_password_files or ask_vault_pass:
            CLI.setup_vault_secrets(loader, vault_ids, vault_password_files, ask_vault_pass)
        self.inventory = ansible.inventory.manager.InventoryManager(loader=loader,
                                                                    sources=inventory)
        self.variable_manager = VariableManager(loader=loader)
        self.variable_manager.set_inventory(self.inventory)

    # internal fuctions that actually do the work
    # adapted almost entirely from lib/ansible/vars/manager.py 
Example 23
Project: DevOps   Author: YoLoveLife   File: playbook.py    License: GNU General Public License v2.0 5 votes vote down vote up
def make_inventory(self, group):
        self.loader = DataLoader()
        self.inventory = InventoryManager(loader=DataLoader(),)
        self.inventory.add_group(str(group.uuid))
        for host in group.hosts.all():
            self.inventory.add_host(host.connect_ip, str(group.uuid), host.sshport) 
Example 24
Project: insights-core   Author: RedHatInsights   File: cluster.py    License: Apache License 2.0 5 votes vote down vote up
def parse_inventory(path):
    inventory = InventoryManager(loader=DataLoader(), sources=path)
    return inventory.get_groups_dict() 
Example 25
Project: codo-cmdb   Author: opendevops-cn   File: myinventory.py    License: GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, host_list=None):
        self.loader = DataLoader()
        super(MyInventory, self).__init__(self.loader, host_list) 
Example 26
Project: swallow   Author: JiaJunZz   File: ansible_api.py    License: MIT License 5 votes vote down vote up
def __init__(self, sources='/etc/ansible/hosts'):
        self.sources = sources
        self.variable_manager = None
        self.loader = None
        self.options = None
        self.passwords = None
        self.callback = ResultCallback()
        self.results_raw = {}
        Options = namedtuple('Options', ['connection', 'module_path', 'forks', 'timeout', 'remote_user',
                                         'ask_pass', 'private_key_file', 'ssh_common_args', 'ssh_extra_args',
                                         'sftp_extra_args',
                                         'scp_extra_args', 'become', 'become_method', 'become_user', 'ask_value_pass',
                                         'verbosity',
                                         'check', 'listhosts', 'listtasks', 'listtags', 'syntax', 'diff'])
        self.options = Options(connection='smart', module_path=None, forks=100, timeout=10,
                               remote_user='root', ask_pass=False, private_key_file=None, ssh_common_args=None,
                               ssh_extra_args=None,
                               sftp_extra_args=None, scp_extra_args=None, become=None, become_method=None,
                               become_user='root', ask_value_pass=False, verbosity=None, check=False, listhosts=False,
                               listtasks=False, listtags=False, syntax=False, diff=False)

        self.loader = DataLoader()
        self.passwords = dict(vault_pass='secret')
        self.inventory = InventoryManager(self.loader, self.sources)
        # 把inventory传递给variable_manager管理
        self.variable_manager = VariableManager(loader=self.loader, inventory=self.inventory) 
Example 27
Project: pytest-ansible   Author: ansible   File: v2.py    License: MIT License 5 votes vote down vote up
def initialize_inventory(self):
        log.debug("HostManagerV2.initialize_inventory()")

        self.options['loader'] = DataLoader()
        self.options['variable_manager'] = VariableManager()
        self.options['inventory_manager'] = Inventory(loader=self.options['loader'],
                                                      variable_manager=self.options['variable_manager'],
                                                      host_list=self.options['inventory'])
        self.options['variable_manager'].set_inventory(self.options['inventory_manager']) 
Example 28
Project: pytest-ansible   Author: ansible   File: v28.py    License: MIT License 5 votes vote down vote up
def initialize_inventory(self):
        log.debug("HostManagerV28.initialize_inventory()")
        self.options['loader'] = DataLoader()
        self.options['inventory_manager'] = InventoryManager(loader=self.options['loader'],
                                                             sources=self.options['inventory'])
        self.options['variable_manager'] = VariableManager(loader=self.options['loader'],
                                                           inventory=self.options['inventory_manager'])
        # self.options['inventory_manager'].clear_caches() 
Example 29
Project: pytest-ansible   Author: ansible   File: v25.py    License: MIT License 5 votes vote down vote up
def initialize_inventory(self):
        log.debug("HostManagerV25.initialize_inventory()")
        self.options['loader'] = DataLoader()
        self.options['inventory_manager'] = InventoryManager(loader=self.options['loader'],
                                                             sources=self.options['inventory'])
        self.options['variable_manager'] = VariableManager(loader=self.options['loader'],
                                                           inventory=self.options['inventory_manager'])
        # self.options['inventory_manager'].clear_caches() 
Example 30
Project: pytest-ansible   Author: ansible   File: v24.py    License: MIT License 5 votes vote down vote up
def initialize_inventory(self):
        log.debug("HostManagerV24.initialize_inventory()")
        self.options['loader'] = DataLoader()
        self.options['inventory_manager'] = InventoryManager(loader=self.options['loader'],
                                                             sources=self.options['inventory'])
        self.options['variable_manager'] = VariableManager(loader=self.options['loader'],
                                                           inventory=self.options['inventory_manager'])
        # self.options['inventory_manager'].clear_caches()