def deploy_service_domain(domain_name, company_service_ids): deploy_wiki_wp_service.delay(domain_name, company_service_ids) #added domain name to host name as Windows doesn't allow 2 servers to have the same host name on the local network (otherwise adding server to domain will fail) addc_hostname = "dc-"+domain_name.replace('.com', '') exch_hostname = "mail-"+domain_name.replace('.com', '') addc_admin_pwd = win.new_password() exch_admin_pwd = win.new_password() #rdb.set_trace() #create addc (addc_id, addc_ip) = timeout.attempt(iaas.create_instance, args=[addc_hostname, ADDC_IMG_ID, ADDC_FLAVOR_ID], timeout=60, retries=0) models.new_vminstance(addc_id, addc_ip, addc_admin_pwd, company_service_ids, addc_hostname, [6]) #6 is the service_id for ADDC #create exchange server (exch_id, exch_ip) = timeout.attempt(iaas.create_instance, args=[exch_hostname, EXCH_IMG_ID, EXCH_FLAVOR_ID], timeout=60, retries=0) models.new_vminstance(exch_id, exch_ip, exch_admin_pwd, company_service_ids, exch_hostname, [1]) #1 is the service_id for Exchange Server #delayed task to promote to ADDC promote_addc.delay(domain_name=domain_name, ip=addc_ip, pwd=addc_admin_pwd).wait(propagate=False) deploy_exchange_server.delay(ip=exch_ip, pwd=exch_admin_pwd, domain=domain_name, addc_ip=addc_ip, domain_pwd=addc_admin_pwd)
def turnon_wiki_wp_service(inst_id, ip, company_service_ids, hostname, domain): sids = models.new_vminstance(inst_id, ip, 'dalun', company_service_ids, domain, [15, 13]) for sid in sids: if sid == 15: win.turn_on_wikiwp(ip, 'ubuntu', 'dalun', domain, 'wiki') if sid == 13: win.turn_on_wikiwp(ip, 'ubuntu', 'dalun', domain, 'wp')