コード例 #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],
                   ))
コード例 #2
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')
コード例 #6
0
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)
コード例 #7
0
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'])
コード例 #14
0
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
ファイル: netbox.py プロジェクト: huntdatacenter/charm-netbox
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')
コード例 #16
0
def configure():
    status_set('maintenance', 'configuring nagios-alerta')
    apply_playbook(playbook='ansible/playbook.yaml', tags=['config'])
    status_set('active', 'ready')
    set_flag('gateway.configured')
コード例 #17
0
def stop():
    apply_playbook(playbook, tags=['stop'])
コード例 #18
0
ファイル: thruk.py プロジェクト: huntdatacenter/charm-thruk
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
ファイル: thruk.py プロジェクト: huntdatacenter/charm-thruk
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
ファイル: thruk.py プロジェクト: huntdatacenter/charm-thruk
def cleanup():
    apply_playbook(playbook='ansible/playbook.yaml', tags=['uninstall'])