Пример #1
0
def stop():
    apply_playbook(playbook='ansible/playbook.yaml',
                   tags=['uninstall'],
                   extra_vars=dict(
                       exp_port=config.get('port'),
                       exp_host=get_ip()[0],
                   ))
def config_changed():
    """
    Only run the config_changed ansible playbook tags if elasticsearch
    is present in the bundle
    """
    status_set(status_maintenance, msg_config_changed)
    apply_playbook(playbook, tags=['config_changed'])
Пример #3
0
def upgrade_charm():
    clear_flag('prometheus-virtfs-exporter.version')
    apply_playbook(playbook='ansible/playbook.yaml',
                   extra_vars=dict(
                       exp_port=config.get('port'),
                       exp_host=get_ip()[0],
                   ))
    status_set('active', 'ready')
Пример #4
0
def start():
    apply_playbook(playbook='ansible/playbook.yaml',
                   tags=['install'],
                   extra_vars=dict(
                       exp_port=config.get('port'),
                       exp_host=get_ip()[0],
                   ))
    status_set('active', 'ready')
Пример #5
0
def install_deps():
    status_set('maintenance', 'installing dependencies')
    apply_playbook(playbook='ansible/playbook.yaml',
                   extra_vars=dict(
                       exp_port=config.get('port'),
                       exp_host=get_ip()[0],
                   ))
    status_set('active', 'ready')
    set_flag('prometheus-virtfs-exporter.installed')
def config_changed():
    """
    Only run the config_changed ansible playbook tags if elasticsearch
    is present in the bundle
    """
    if is_relation_made("elasticsearch"):
        status_set(status_maintenance, msg_config_changed)
        apply_playbook(playbook, tags=['config_changed'])
    else:
        status_set(status_blocked, msg_missing_es_rel)
def start():
    """
    Special process for the start action so that after the playbook is run
    we can update the status in juju
    """
    apply_playbook(playbook, tags=['start'])
    if service_running(service_name):
        status_set(status_active, msg_service_running)
    else:
        status_set(status_maintenance, msg_service_failed_to_start)
Пример #8
0
def install_configurator():
    log("Starting configuration...")
    status_set('maintenance', 'configuring tvault...')
    try:
        ansible.apply_playbook('site.yaml')
        status_set('active', 'Ready...')
    except Exception as e:
        log("ERROR:  {}".format(e))
        log("Check the ansible log in TVault to find more info")
        status_set('blocked', 'configuration failed')
    set_flag('trilio-configurator.installed')
Пример #9
0
def start():
    """
    Special process for the start action so that after the playbook is run
    we can update the status in juju
    """
    if is_relation_made("rest"):
        apply_playbook(playbook, tags=['start'])
        if service_running(service_name):
            status_set(status_active, msg_service_running)
        else:
            status_set(status_maintenance, msg_service_failed_to_start)
    else:
        status_set(status_blocked, msg_missing_es_rel)
Пример #10
0
def config_changed():
    """
    Only run the config_changed ansible playbook tags if elasticsearch
    is present in the bundle
    """
    if is_relation_made("rest"):
        status_set(status_maintenance, msg_config_changed)
        apply_playbook(playbook, tags=['config_changed'])
    else:
        status_set(status_blocked, msg_missing_es_rel)

    update_nrpe_config()
    open_port(config('kibana_ssl_port'), protocol='TCP')
Пример #11
0
def configure_appliance():
    log("Starting configuration...")
    status_set('maintenance', 'configuring tvault...')
    try:
        get_keystone_admin()
        log("configure_appliance: {}".format(config))
        ansible.apply_playbook('site.yaml')
        status_set('active', 'Configured ! Ready...')
        set_flag('trilio-appliance.configured')
    except Exception as e:
        log("ERROR:  {}".format(e))
        log("Check the ansible log in TrilioVault to find more info")
        status_set('blocked', 'configuration failed')
Пример #12
0
def update_status():
    try:
        apply_playbook(playbook='ansible/playbook.yaml',
                       tags=['start'],
                       extra_vars=dict(
                           exp_port=config.get('port'),
                           exp_host=get_ip()[0],
                       ))
    except Exception:
        log('Exporter service failed to start. Need libvirt-bin service.')
        status_set('active', 'Service failed to start')
    else:
        status_set('active', 'ready')
Пример #13
0
def install2():
    """
    Install a custom version of ansible for our charm.
    Because of the hack required to install python with xenial
    our install script is called install2, need to call the ansible playbook
    using the install tag.
    """
    status_set(status_maintenance, msg_install_prereqs)
    apt_install(required_aps)

    status_set(status_maintenance, msg_install_ansible)
    pip_install(required_pip_packages, fatal=True)

    status_set(status_maintenance, msg_install_service)
    apply_playbook(playbook, tags=['install'])
def install_megaraid():
    status_set('maintenance', 'installing megaraid check')
    apply_playbook(playbook='ansible/playbook.yaml',
                   extra_vars=dict(plugin_name=PLUGIN_NAME))
    set_flag('megaraid.installed')
Пример #15
0
def configure_netbox():
    status_set('maintenance', 'configuring netbox')
    apply_playbook(playbook='ansible/playbook.yaml')
    open_port(80)
    status_set('active', 'ready')
    set_flag('netbox.configured')
def configure():
    status_set('maintenance', 'configuring nagios-alerta')
    apply_playbook(playbook='ansible/playbook.yaml', tags=['config'])
    status_set('active', 'ready')
    set_flag('gateway.configured')
def stop():
    apply_playbook(playbook, tags=['stop'])
Пример #18
0
def install_thruk():
    status_set('maintenance', 'installing thruk')
    apply_playbook(playbook='ansible/playbook.yaml')
    status_set('active', 'ready')
    set_flag('thruk.configured')
    set_flag('thruk.installed')
Пример #19
0
def configure_thruk():
    status_set('maintenance', 'configuring thruk')
    apply_playbook(playbook='ansible/playbook.yaml', tags=['config'])
    status_set('active', 'ready')
    set_flag('thruk.configured')
Пример #20
0
def config_changed():
    status_set(status_maintenance, msg_config_changed)
    apply_playbook(playbook, tags=['config_changed'])

    update_nrpe_config()
    open_port(config('elasticsearch_http_port'), protocol='TCP')
Пример #21
0
def cleanup():
    apply_playbook(playbook='ansible/playbook.yaml', tags=['uninstall'])