How to use the enoslib.api.run_ansible function in enoslib

To help you get started, we’ve selected a few enoslib examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github BeyondTheClouds / enos / enos / task.py View on Github external
# provision a external pool of ip regardless the number of nic available
    # (in g5k this would be a kavlan) but in this case we'll need to know
    # whether the network is physicaly attached (or no) to the physical nics
    provider_net = lookup_network(
        env['networks'],
        [NEUTRON_EXTERNAL_INTERFACE, NETWORK_INTERFACE])

    if not provider_net:
        msg = "External network not found, define %s networks" % " or ".join(
            [NEUTRON_EXTERNAL_INTERFACE, NETWORK_INTERFACE])
        raise Exception(msg)
    enos_action = 'pull' if kwargs.get('--pull') else 'deploy'
    playbook_values.update(
        provider_net=provider_net,
        enos_action=enos_action)
    run_ansible([playbook_path],
                inventory_path,
                extra_vars=playbook_values)
github BeyondTheClouds / enos / enos / task.py View on Github external
'influx_vip':        pop_ip(vip_pool),
       'grafana_vip':       pop_ip(vip_pool),
       'resultdir':         env['resultdir'],
       'rabbitmq_password': "demo",
       'database_password': "demo"
    })

    options = {}
    options.update(env['config'])
    enos_action = "pull" if kwargs.get("--pull") else "deploy"
    options.update(enos_action=enos_action)
    options.update(context=str(provider))
    # Runs playbook that initializes resources (eg,
    # installs the registry, install monitoring tools, ...)
    up_playbook = os.path.join(ANSIBLE_DIR, 'enos.yml')
    run_ansible([up_playbook], env['inventory'], extra_vars=options,
                tags=kwargs['--tags'])
github BeyondTheClouds / enos / enos / task.py View on Github external
backup_dir = kwargs['--backup_dir'] \
        or kwargs['--env'] \
        or SYMLINK_NAME

    backup_dir = os.path.abspath(backup_dir)
    # create if necessary
    if not os.path.isdir(backup_dir):
        os.mkdir(backup_dir)
    # update the env
    env['config']['backup_dir'] = backup_dir
    options = {}
    options.update(env['config'])
    options.update({'enos_action': 'backup'})
    playbook_path = os.path.join(ANSIBLE_DIR, 'enos.yml')
    inventory_path = os.path.join(env['resultdir'], 'multinode')
    run_ansible([playbook_path], inventory_path, extra_vars=options)
github BeyondTheClouds / enos / enos / task.py View on Github external
if kwargs['--include-images']:
            command.append('--include-images')
        kolla_kwargs = {'--': True,
                  '--env': kwargs['--env'],
                  '-v': kwargs['-v'],
                  '': command,
                  '--silent': kwargs['--silent'],
                  'kolla': True}
        options = {
            "enos_action": "destroy"
        }
        up_playbook = os.path.join(ANSIBLE_DIR, 'enos.yml')

        inventory_path = os.path.join(env['resultdir'], 'multinode')
        # Destroying enos resources
        run_ansible([up_playbook], inventory_path, extra_vars=options)
        # Destroying kolla resources
        _kolla(env=env, **kolla_kwargs)
github BeyondTheClouds / enos / enos / task.py View on Github external
'args': a
                    }
                    bench.update({'reset': False})
                    if reset and idx == 0:
                        bench.update({'reset': True})

                    if "plugin" in scenario:
                        plugin = os.path.join(workload_dir,
                                           scenario["plugin"])
                        if os.path.isdir(plugin):
                            plugin = plugin + "/"
                        bench['plugin_location'] = plugin
                    playbook_values.update(bench=bench)
                    playbook_values.update(enos_action="bench")

                    run_ansible([playbook_path],
                                inventory_path,
                                extra_vars=playbook_values)