Esempio n. 1
0
def disable_ra(module, blade):
    """Disable Remote Assist"""
    changed = True
    if not module.check_mode:
        ra_settings = Support(remote_assist_active=False)
        try:
            blade.support.update_support(support=ra_settings)
        except Exception:
            module.fail_json(msg='Disabling Remote Assist failed')
    module.exit_json(changed=changed)
def disable_ph(module, blade):
    """Disable Phone Home"""
    changed = True
    if not module.check_mode:
        ph_settings = Support(phonehome_enabled=False)
        try:
            blade.support.update_support(support=ph_settings)
        except Exception:
            module.fail_json(msg='Disabling Phone Home failed')
    module.exit_json(changed=changed)
def delete_proxy(module, blade):
    """Delete proxy settings"""
    changed = True
    if not module.check_mode:
        current_proxy = blade.support.list_support().items[0].proxy
        if current_proxy != '':
            try:
                proxy_settings = Support(proxy='')
                blade.support.update_support(support=proxy_settings)
            except Exception:
                module.fail_json(msg='Delete proxy settigs failed')
        else:
            changed = False
    module.exit_json(changed=changed)
def create_proxy(module, blade):
    """Set proxy settings"""
    changed = True
    if not module.check_mode:
        current_proxy = blade.support.list_support().items[0].proxy
        if current_proxy is not None:
            new_proxy = "https://" + module.params['host'] + ":" + str(module.params['port'])
            if new_proxy != current_proxy:
                try:
                    proxy_settings = Support(proxy=new_proxy)
                    blade.support.update_support(support=proxy_settings)
                except Exception:
                    module.fail_json(msg='Set phone home proxy failed.')
            else:
                changed = False

    module.exit_json(changed=changed)