Create a new node if it does not already exist.

    hostname
        The host/address of the bigip device
    username
        The iControl REST username
    password
        The iControl REST password
    name
        The name of the pool to create
    members
        List of members to be added to the pool
    allow_nat
        [yes | no]
    allow_snat
        [yes | no]
    description
        [string]
    gateway_failsafe_device
        [string]
    ignore_persisted_weight
        [enabled | disabled]
    ip_tos_to_client
        [pass-through | [integer]]
    ip_tos_to_server
        [pass-through | [integer]]
    link_qos_to_client
        [pass-through | [integer]]
    link_qos_to_server
        [pass-through | [integer]]
    load_balancing_mode
        [dynamic-ratio-member | dynamic-ratio-node |
        fastest-app-response | fastest-node |
        least-connections-members |
        least-connections-node |
        least-sessions |
        observed-member | observed-node |
        predictive-member | predictive-node |
        ratio-least-connections-member |
        ratio-least-connections-node |
        ratio-member | ratio-node | ratio-session |
        round-robin | weighted-least-connections-member |
        weighted-least-connections-node]
    min_active_members
        [integer]
    min_up_members
        [integer]
    min_up_members_action
        [failover | reboot | restart-all]
    min_up_members_checking
        [enabled | disabled]
    monitor
        [name]
    profiles
        [none | profile_name]
    queue_depth_limit
        [integer]
    queue_on_connection_limit
        [enabled | disabled]
    queue_time_limit
        [integer]
    reselect_tries
        [integer]
    service_down_action
        [drop | none | reselect | reset]
    slow_ramp_time
        [integer]

def create_pool(hostname, username, password, name, members=None,
                allow_nat=None,
                allow_snat=None,
                description=None,
                gateway_failsafe_device=None,
                ignore_persisted_weight=None,
                ip_tos_to_client=None,
                ip_tos_to_server=None,
                link_qos_to_client=None,
                link_qos_to_server=None,
                load_balancing_mode=None,
                min_active_members=None,
                min_up_members=None,
                min_up_members_action=None,
                min_up_members_checking=None,
                monitor=None,
                profiles=None,
                queue_depth_limit=None,
                queue_on_connection_limit=None,
                queue_time_limit=None,
                reselect_tries=None,
                service_down_action=None,
                slow_ramp_time=None):
    '''
    Create a new node if it does not already exist.

    hostname
        The host/address of the bigip device
    username
        The iControl REST username
    password
        The iControl REST password
    name
        The name of the pool to create
    members
        List of members to be added to the pool
    allow_nat
        [yes | no]
    allow_snat
        [yes | no]
    description
        [string]
    gateway_failsafe_device
        [string]
    ignore_persisted_weight
        [enabled | disabled]
    ip_tos_to_client
        [pass-through | [integer]]
    ip_tos_to_server
        [pass-through | [integer]]
    link_qos_to_client
        [pass-through | [integer]]
    link_qos_to_server
        [pass-through | [integer]]
    load_balancing_mode
        [dynamic-ratio-member | dynamic-ratio-node |
        fastest-app-response | fastest-node |
        least-connections-members |
        least-connections-node |
        least-sessions |
        observed-member | observed-node |
        predictive-member | predictive-node |
        ratio-least-connections-member |
        ratio-least-connections-node |
        ratio-member | ratio-node | ratio-session |
        round-robin | weighted-least-connections-member |
        weighted-least-connections-node]
    min_active_members
        [integer]
    min_up_members
        [integer]
    min_up_members_action
        [failover | reboot | restart-all]
    min_up_members_checking
        [enabled | disabled]
    monitor
        [name]
    profiles
        [none | profile_name]
    queue_depth_limit
        [integer]
    queue_on_connection_limit
        [enabled | disabled]
    queue_time_limit
        [integer]
    reselect_tries
        [integer]
    service_down_action
        [drop | none | reselect | reset]
    slow_ramp_time
        [integer]
    '''

    ret = {'name': name, 'changes': {}, 'result': False, 'comment': ''}

    if __opts__['test']:
        return _test_output(ret, 'create', params={
            'hostname': hostname,
            'username': username,
            'password': password,
            'name': name,
            'members': members,
            'allow_nat': allow_nat,
            'allow_snat': allow_snat,
            'description': description,
            'gateway_failsafe_device': gateway_failsafe_device,
            'ignore_persisted_weight': ignore_persisted_weight,
            'ip_tos_client:': ip_tos_to_client,
            'ip_tos_server': ip_tos_to_server,
            'link_qos_to_client': link_qos_to_client,
            'link_qos_to_server': link_qos_to_server,
            'load_balancing_mode': load_balancing_mode,
            'min_active_members': min_active_members,
            'min_up_members': min_up_members,
            'min_up_members_checking': min_up_members_checking,
            'monitor': monitor,
            'profiles': profiles,
            'queue_depth_limit': queue_depth_limit,
            'queue_on_connection_limit': queue_on_connection_limit,
            'queue_time_limit': queue_time_limit,
            'reselect_tries': reselect_tries,
            'service_down_action': service_down_action,
            'slow_ramp_time': slow_ramp_time
            }
        )

    #is this pool currently configured?
    existing = __salt__['bigip.list_pool'](hostname, username, password, name)

    # if it exists
    if existing['code'] == 200:

        ret['result'] = True
        ret['comment'] = 'A pool by this name currently exists.  No change made.'

    # if it doesn't exist
    elif existing['code'] == 404:

        response = __salt__['bigip.create_pool'](hostname=hostname,
                                                 username=username,
                                                 password=password,
                                                 name=name,
                                                 members=members,
                                                 allow_nat=allow_nat,
                                                 allow_snat=allow_snat,
                                                 description=description,
                                                 gateway_failsafe_device=gateway_failsafe_device,
                                                 ignore_persisted_weight=ignore_persisted_weight,
                                                 ip_tos_to_client=ip_tos_to_client,
                                                 ip_tos_to_server=ip_tos_to_server,
                                                 link_qos_to_client=link_qos_to_client,
                                                 link_qos_to_server=link_qos_to_server,
                                                 load_balancing_mode=load_balancing_mode,
                                                 min_active_members=min_active_members,
                                                 min_up_members=min_up_members,
                                                 min_up_members_action=min_up_members_action,
                                                 min_up_members_checking=min_up_members_checking,
                                                 monitor=monitor,
                                                 profiles=profiles,
                                                 queue_depth_limit=queue_depth_limit,
                                                 queue_on_connection_limit=queue_on_connection_limit,
                                                 queue_time_limit=queue_time_limit,
                                                 reselect_tries=reselect_tries,
                                                 service_down_action=service_down_action,
                                                 slow_ramp_time=slow_ramp_time)
        if response['code'] == 200:
            ret['result'] = True
            ret['changes']['old'] = {}
            ret['changes']['new'] = response['content']
            ret['comment'] = 'Pool was successfully created.'
        else:
            ret = _load_result(existing, ret)

    # else something else was returned
    else:
        ret = _load_result(existing, ret)

    return ret