def create_cert_binding(name, site, hostheader='', ipaddress='*', port=443, sslflags=0):
 ret = {'name': name, 'changes': {}, 'comment': str(), 'result': None}
 binding_info = _get_binding_info(hostheader, ipaddress, port)
 current_cert_bindings = __salt__['win_iis.list_cert_bindings'](site)
 if (binding_info in current_cert_bindings):
  current_name = current_cert_bindings[binding_info]['certificatehash']
  if (name == current_name):
   ret['comment'] = 'Certificate binding already present: {0}'.format(name)
   ret['result'] = True
   return ret
  ret['comment'] = 'Certificate binding already present with a different thumbprint: {0}'.format(current_name)
  ret['result'] = False
 elif __opts__['test']:
  ret['comment'] = 'Certificate binding will be created: {0}'.format(name)
  ret['changes'] = {'old': None, 'new': name}
 else:
  ret['comment'] = 'Created certificate binding: {0}'.format(name)
  ret['changes'] = {'old': None, 'new': name}
  ret['result'] = __salt__['win_iis.create_cert_binding'](name, site, hostheader, ipaddress, port, sslflags)
 return ret

def create_cert_binding ( name , site , hostheader = '' , ipaddress = '*' , port = 443 , sslflags = 0 ) : ret = { 'name' : name , 'changes' : { } , 'comment' : str ( ) , 'result' : None } binding_info = _get_binding_info ( hostheader , ipaddress , port ) current_cert_bindings = __salt__ [ 'win_iis.list_cert_bindings' ] ( site ) if ( binding_info in current_cert_bindings ) : current_name = current_cert_bindings [ binding_info ] [ 'certificatehash' ] if ( name == current_name ) : ret [ 'comment' ] = 'Certificate binding already present: {0}' . format ( name ) ret [ 'result' ] = True return ret ret [ 'comment' ] = 'Certificate binding already present with a different thumbprint: {0}' . format ( current_name ) ret [ 'result' ] = False elif __opts__ [ 'test' ] : ret [ 'comment' ] = 'Certificate binding will be created: {0}' . format ( name ) ret [ 'changes' ] = { 'old' : None , 'new' : name } else : ret [ 'comment' ] = 'Created certificate binding: {0}' . format ( name ) ret [ 'changes' ] = { 'old' : None , 'new' : name } ret [ 'result' ] = __salt__ [ 'win_iis.create_cert_binding' ] ( name , site , hostheader , ipaddress , port , sslflags ) return ret
assign a certificate to an iis binding .