def add_pool_member(hostname, username, password, name, member):
 ret = {'name': name, 'changes': {}, 'result': False, 'comment': ''}
 if __opts__['test']:
  return _test_output(ret, 'add', params={'hostname': hostname, 'username': username, 'password': password, 'name': name, 'members': member})
 existing_pool = __salt__['bigip.list_pool'](hostname, username, password, name)
 if (existing_pool['code'] == 200):
  current_members = existing_pool['content']['membersReference']['items']
  exists = False
  for current_member in current_members:
   if (current_member['name'] == member['name']):
    exists = True
    break
  if exists:
   ret['result'] = True
   ret['comment'] = 'Member: {name} already exists within this pool.  No changes made.'.format(name=member['name'])
   ret['changes']['old'] = {}
   ret['changes']['new'] = {}
  else:
   new_member = __salt__['bigip.add_pool_member'](hostname, username, password, name, member)
   if (new_member['code'] == 200):
    ret['result'] = True
    ret['comment'] = 'Member: {name} has been successfully added to the pool.'.format(name=member['name'])
    ret['changes']['old'] = {}
    pool_listing = __salt__['bigip.list_pool'](hostname, username, password, name)
    if (pool_listing['code'] != 200):
     ret = _load_result(new_member, ret)
     return ret
    members = pool_listing['content']['membersReference']['items']
    for current_member in members:
     if (current_member['name'] == member['name']):
      added_member = current_member
      break
    ret['changes']['new'] = added_member
   else:
    ret = _load_result(new_member, ret)
 elif (existing_pool['code'] == 404):
  ret['comment'] = 'A pool with this name was not found.'
 else:
  ret = _load_result(existing_pool, ret)
 return ret

def add_pool_member ( hostname , username , password , name , member ) : ret = { 'name' : name , 'changes' : { } , 'result' : False , 'comment' : '' } if __opts__ [ 'test' ] : return _test_output ( ret , 'add' , params = { 'hostname' : hostname , 'username' : username , 'password' : password , 'name' : name , 'members' : member } ) existing_pool = __salt__ [ 'bigip.list_pool' ] ( hostname , username , password , name ) if ( existing_pool [ 'code' ] == 200 ) : current_members = existing_pool [ 'content' ] [ 'membersReference' ] [ 'items' ] exists = False for current_member in current_members : if ( current_member [ 'name' ] == member [ 'name' ] ) : exists = True break if exists : ret [ 'result' ] = True ret [ 'comment' ] = 'Member: {name} already exists within this pool.  No changes made.' . format ( name = member [ 'name' ] ) ret [ 'changes' ] [ 'old' ] = { } ret [ 'changes' ] [ 'new' ] = { } else : new_member = __salt__ [ 'bigip.add_pool_member' ] ( hostname , username , password , name , member ) if ( new_member [ 'code' ] == 200 ) : ret [ 'result' ] = True ret [ 'comment' ] = 'Member: {name} has been successfully added to the pool.' . format ( name = member [ 'name' ] ) ret [ 'changes' ] [ 'old' ] = { } pool_listing = __salt__ [ 'bigip.list_pool' ] ( hostname , username , password , name ) if ( pool_listing [ 'code' ] != 200 ) : ret = _load_result ( new_member , ret ) return ret members = pool_listing [ 'content' ] [ 'membersReference' ] [ 'items' ] for current_member in members : if ( current_member [ 'name' ] == member [ 'name' ] ) : added_member = current_member break ret [ 'changes' ] [ 'new' ] = added_member else : ret = _load_result ( new_member , ret ) elif ( existing_pool [ 'code' ] == 404 ) : ret [ 'comment' ] = 'A pool with this name was not found.' else : ret = _load_result ( existing_pool , ret ) return ret
add a node to a pool cli examples: .