def join_domain(name, username=None, password=None, account_ou=None, account_exists=False, restart=False):
 ret = {'name': name, 'changes': {}, 'result': True, 'comment': "Computer already added to '{0}'".format(name)}
 domain = name
 current_domain_dic = __salt__['system.get_domain_workgroup']()
 if ('Domain' in current_domain_dic):
  current_domain = current_domain_dic['Domain']
 elif ('Workgroup' in current_domain_dic):
  current_domain = 'Workgroup'
 else:
  current_domain = None
 if (domain == current_domain):
  ret['comment'] = "Computer already added to '{0}'".format(name)
  return ret
 if __opts__['test']:
  ret['result'] = None
  ret['comment'] = "Computer will be added to '{0}'".format(name)
  return ret
 result = __salt__['system.join_domain'](domain, username, password, account_ou, account_exists, restart)
 if (result is not False):
  ret['comment'] = "Computer added to '{0}'".format(name)
 else:
  ret['comment'] = "Computer failed to join '{0}'".format(name)
  ret['result'] = False
 return ret

def join_domain ( name , username = None , password = None , account_ou = None , account_exists = False , restart = False ) : ret = { 'name' : name , 'changes' : { } , 'result' : True , 'comment' : "Computer already added to '{0}'" . format ( name ) } domain = name current_domain_dic = __salt__ [ 'system.get_domain_workgroup' ] ( ) if ( 'Domain' in current_domain_dic ) : current_domain = current_domain_dic [ 'Domain' ] elif ( 'Workgroup' in current_domain_dic ) : current_domain = 'Workgroup' else : current_domain = None if ( domain == current_domain ) : ret [ 'comment' ] = "Computer already added to '{0}'" . format ( name ) return ret if __opts__ [ 'test' ] : ret [ 'result' ] = None ret [ 'comment' ] = "Computer will be added to '{0}'" . format ( name ) return ret result = __salt__ [ 'system.join_domain' ] ( domain , username , password , account_ou , account_exists , restart ) if ( result is not False ) : ret [ 'comment' ] = "Computer added to '{0}'" . format ( name ) else : ret [ 'comment' ] = "Computer failed to join '{0}'" . format ( name ) ret [ 'result' ] = False return ret
checks if a computer is joined to the domain .