Add a server
    Note: The default server state is ENABLED

    CLI Example:

    .. code-block:: bash

        salt '*' netscaler.server_add 'serverName' 'serverIpAddress'
        salt '*' netscaler.server_add 'serverName' 'serverIpAddress' 'serverState'
359029
def server_add(s_name, s_ip, s_state=None, **connection_args):
    '''
    
    '''
    ret = True
    if server_exists(s_name, **connection_args):
        return False
    nitro = _connect(**connection_args)
    if nitro is None:
        return False
    server = NSServer()
    server.set_name(s_name)
    server.set_ipaddress(s_ip)
    if s_state is not None:
        server.set_state(s_state)
    try:
        NSServer.add(nitro, server)
    except NSNitroError as error:
        log.debug('netscaler module error - NSServer.add() failed: %s', error)
        ret = False
    _disconnect(nitro)
    return ret
15948
def add_new_host(self, hostname, ipv4addr, comment=None):
        
        host = Host(self.session, name=hostname)
        if host.ipv4addrs:
            host.ipv4addrs = []
        host.add_ipv4addr(ipv4addr)
        host.comment = comment
        return host.save()
812069
def vhost_add(cls, resource, params):
        
        try:
            oper = cls.call(
                'hosting.rproxy.vhost.create', cls.usable_id(resource), params)
            cls.echo('Adding your virtual host (%s) into %s' %
                     (params['vhost'], resource))
            cls.display_progress(oper)
            cls.echo('Your virtual host habe been added')
            return oper
        except Exception as err:
            if err.code == 580142:
                dc = cls.info(resource)
                dns_entry = cls.call('hosting.rproxy.vhost.get_dns_entries',
                                     {'datacenter': dc['datacenter']['id'],
                                      'vhost': params['vhost']})
                txt_record = "%s 3600 IN TXT \"%s=%s\"" % (dns_entry['key'],
                                                           dns_entry['key'],
                                                           dns_entry['txt'])

                cname_record = "%s 3600 IN CNAME %s" % (dns_entry['key'],
                                                        dns_entry['cname'])

                cls.echo('The domain don\'t use Gandi DNS or you have not'
                         ' sufficient right to alter the zone file. '
                         'Edit your zone file adding this TXT and CNAME '
                         'record and try again :')
                cls.echo(txt_record)
                cls.echo(cname_record)
                cls.echo('\nOr add a file containing %s at :\n'
                         'http://%s/%s.txt\n' % (dns_entry['txt'],
                                                 dns_entry['domain'],
                                                 dns_entry['txt']))

            else:
                cls.echo(err)
622997
def _update_servers(self):
        
        for address, sd in self._description.server_descriptions().items():
            if address not in self._servers:
                monitor = self._settings.monitor_class(
                    server_description=sd,
                    topology=self,
                    pool=self._create_pool_for_monitor(address),
                    topology_settings=self._settings)

                weak = None
                if self._publish_server:
                    weak = weakref.ref(self._events)
                server = Server(
                    server_description=sd,
                    pool=self._create_pool_for_server(address),
                    monitor=monitor,
                    topology_id=self._topology_id,
                    listeners=self._listeners,
                    events=weak)

                self._servers[address] = server
                server.open()
            else:
                self._servers[address].description = sd

        for address, server in list(self._servers.items()):
            if not self._description.has_server(address):
                server.close()
                self._servers.pop(address)
396897
async def create_server(self, worker, protocol_factory, address=None,
                            sockets=None, idx=0):
        '''
        '''
        cfg = self.cfg
        max_requests = cfg.max_requests
        if max_requests:
            max_requests = int(lognormvariate(log(max_requests), 0.2))
        server = self.server_factory(
            protocol_factory,
            loop=worker._loop,
            max_requests=max_requests,
            keep_alive=cfg.keep_alive,
            name=self.name,
            logger=self.logger,
            server_software=cfg.server_software,
            cfg=cfg,
            idx=idx
        )
        for event in ('connection_made', 'pre_request', 'post_request',
                      'connection_lost'):
            callback = getattr(cfg, event)
            if callback != pass_through:
                server.event(event).bind(callback)
        await server.start_serving(
            sockets=sockets,
            address=address,
            backlog=cfg.backlog,
            sslcontext=self.sslcontext()
        )
        return server
960102
def create(host, port):
    
    wrapper = WrapperEchoServer({
        'server': None
    })
    d = {
        'listen_port': port,
        'changer': wrapper
    }
    if host:
        d['listen_bind_ip'] = host

    ses = EchoServer(d)
    wrapper.server = ses
    return [wrapper], cmd_line
976517
def server_update(s_name, s_ip, **connection_args):
    '''
    
    '''
    altered = False
    cur_server = _server_get(s_name, **connection_args)
    if cur_server is None:
        return False
    alt_server = NSServer()
    alt_server.set_name(s_name)
    if cur_server.get_ipaddress() != s_ip:
        alt_server.set_ipaddress(s_ip)
        altered = True
    # Nothing to update, the server is already idem
    if altered is False:
        return False
    # Perform the update
    nitro = _connect(**connection_args)
    if nitro is None:
        return False
    ret = True
    try:
        NSServer.update(nitro, alt_server)
    except NSNitroError as error:
        log.debug('netscaler module error - NSServer.update() failed: %s', error)
        ret = False
    _disconnect(nitro)
    return ret
902445
def add_dnsbl(name,domain,type='ip',codes={"0"=>"OK","127.0.0.2"=>"Blacklisted"})
			@dnsbls[name] = codes
			@dnsbls[name]['domain'] = domain
			@dnsbls[name]['type'] = type
		end
1250605
def create(provider, count=1, name=None, **kwargs):
    
    '''
    count = int(count)
    provider = provider_by_name(provider)
    options = provider.create_server_defaults
    options.update(kwargs)
    names = [name] * count
    provider.validate_create_options(**options)
    return provider.create_servers(count, names, **options)
74072
def add(name, gid=None, system=False, root=None):
    '''
    
    '''
    cmd = 'mkgroup '
    if system and root is not None:
        cmd += '-a '

    if gid:
        cmd += 'id={0} '.format(gid)

    cmd += name

    ret = __salt__['cmd.run_all'](cmd, python_shell=False)

    return not ret['retcode']
1041672
def ensure_server(data)
      if @servers.include?(data['id'].to_i)
        @servers[data['id'].to_i]
      else
        @servers[data['id'].to_i] = Server.new(data, self)
      end
    end
82296
def create_server(self, *args, **kwargs):
        
        # hpcloud's management console stuffs all of its tags in a "tags" tag.
        # populate it with the stack and role values here only at server
        # creation time.  what users do with it after server creation is up to
        # them.
        tags = kwargs['tags']
        tags[A.tags.TAGS] = ','.join([
                tags.get(A.tags.STACK, ''),
                tags.get(A.tags.ROLE, ''),
                ])
        # Don't create an explicit floating IP; gets one 
        # automatically
        if 'floating_ip' not in kwargs:
            kwargs['floating_ip'] = False
        s = super(HPNova, self).create_server(*args, **kwargs)
        return fix_hp_addrs(s)
711959
def add_service_server(service_server)
      @master.register_service(service_server.service_name,
                               service_server.service_uri)
      service_server.set_manager(self)
      @service_servers.push(service_server)
      service_server
    end
1110983
def add_tcp_callback(self, port, callback, threaded_callback=False):
        
        if not callback:
            raise AttributeError("No callback")

        serversocket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
        serversocket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
        serversocket.bind((_TCP_SOCKET_HOST, port))
        serversocket.listen(1)
        serversocket.setblocking(0)
        self._epoll.register(serversocket.fileno(), select.EPOLLIN)

        # Prepare the callback (wrap in Thread if needed)
        cb = callback if not threaded_callback else \
                partial(_threaded_callback, callback)

        self._tcp_server_sockets[serversocket.fileno()] = (serversocket, cb)
        debug("Socket server started at port %s and callback added." % port)
805347
def _enable(name, started, result=True, skip_verify=False, **kwargs):
    '''
    
    '''
    ret = {}

    if not skip_verify:
        # is service available?
        try:
            if not _available(name, ret):
                return ret
        except CommandExecutionError as exc:
            ret['result'] = False
            ret['comment'] = exc.strerror
            return ret

    # Set default expected result
    ret['result'] = result

    # Check to see if this minion supports enable
    if 'service.enable' not in __salt__ or 'service.enabled' not in __salt__:
        if started is True:
            ret['comment'] = ('Enable is not available on this minion,'
                              ' service {0} started').format(name)
        elif started is None:
            ret['comment'] = ('Enable is not available on this minion,'
                              ' service {0} is in the desired state'
                              ).format(name)
        else:
            ret['comment'] = ('Enable is not available on this minion,'
                              ' service {0} is dead').format(name)
        return ret

    # Service can be enabled
    before_toggle_enable_status = __salt__['service.enabled'](name, **kwargs)
    if before_toggle_enable_status:
        # Service is enabled
        if started is True:
            ret['comment'] = ('Service {0} is already enabled,'
                              ' and is running').format(name)
        elif started is None:
            # always be sure in this case to reset the changes dict
            ret['changes'] = {}
            ret['comment'] = ('Service {0} is already enabled,'
                              ' and is in the desired state').format(name)
        else:
            ret['comment'] = ('Service {0} is already enabled,'
                              ' and is dead').format(name)
        return ret

    # Service needs to be enabled
    if __opts__['test']:
        ret['result'] = None
        ret['comment'] = 'Service {0} set to be enabled'.format(name)
        return ret

    try:
        if __salt__['service.enable'](name, **kwargs):
            # Service has been enabled
            ret['changes'] = {}
            after_toggle_enable_status = __salt__['service.enabled'](
                name,
                **kwargs)
            # on upstart, certain services like apparmor will always return
            # False, even if correctly activated
            # do not trigger a change
            if before_toggle_enable_status != after_toggle_enable_status:
                ret['changes'][name] = True
            if started is True:
                ret['comment'] = ('Service {0} has been enabled,'
                                  ' and is running').format(name)
            elif started is None:
                ret['comment'] = ('Service {0} has been enabled,'
                                  ' and is in the desired state').format(name)
            else:
                ret['comment'] = ('Service {0} has been enabled,'
                                  ' and is dead').format(name)
            return ret
    except CommandExecutionError as exc:
        enable_error = exc.strerror
    else:
        enable_error = False

    # Service failed to be enabled
    ret['result'] = False
    if started is True:
        ret['comment'] = ('Failed when setting service {0} to start at boot,'
                          ' but the service is running').format(name)
    elif started is None:
        ret['comment'] = ('Failed when setting service {0} to start at boot,'
                          ' but the service was already running').format(name)
    else:
        ret['comment'] = ('Failed when setting service {0} to start at boot,'
                          ' and the service is dead').format(name)

    if enable_error:
        ret['comment'] += '. Additional information follows:\n\n{0}'.format(
            enable_error
        )

    return ret
53799
def _add_client(self, url, key=None, secret=None):
        

        if "://" in url:
            server, endpoint = self._deconstruct_url(url)
        else:
            server = url

        if server not in self._server_cache:
            if not (key and secret):
                client = Client(
                    webfinger=self.client.webfinger,
                    name=self.client.name,
                    type=self.client.type,
                )
                client.set_pump(self)
                client.register(server)
            else:
                client = Client(
                    webfinger=self.client.webfinger,
                    key=key,
                    secret=secret,
                    type=self.client.type,
                    name=self.client.name,
                )
                client.set_pump(self)

            self._server_cache[server] = client
1355401
def backend_add(cls, name, backend):
        
        oper = cls.call(
            'hosting.rproxy.server.create', cls.usable_id(name), backend)
        cls.echo('Adding backend %s:%s into webaccelerator' %
                 (backend['ip'], backend['port']))
        cls.display_progress(oper)
        cls.echo('Backend added')
        return oper