code: def install(self):
          
          domain_settings = DomainSettings.get()
  
          with root():
              if os.path.exists(self.SMBCONF_FILE):
                  os.remove(self.SMBCONF_FILE)
  
              if domain_settings.mode == 'ad':
                  domain_settings.adminpass = make_password(15)
                  domain_settings.save()
  
                  run("samba-tool domain provision "
                      "--domain='%s' "
                      "--workgroup='%s' "
                      "--realm='%s' "
                      "--use-xattrs=yes "
                      "--use-rfc2307 "
                      "--server-role='domain controller' "
                      "--use-ntvfs "
                      "--adminpass='%s'" %
                      (domain_settings.domain,
                       domain_settings.workgroup,
                       domain_settings.realm,
                       domain_settings.adminpass))
  
                  self.smbconf.write()
  
                  shutil.copy2(self.SMB_KRB5CONF_FILE, self.KRB5CONF_FILE)
  
                  # XXX FIXME move this to network
                  run("echo 'nameserver 127.0.0.1' > /etc/resolv.conf")
                  # TODO manage shares
                  run("touch /etc/samba/shares.conf")
  
              elif domain_settings.mode == 'member':
                  # TODO
                  pass
docs: Installation procedure, it writes basic smb.conf and uses samba-tool to
          provision the domain