def configure_jenkins(endpoint, defaultport, userpw, sshuser, secgrp, subnet): # Check is the jenkins user exist in jenkins server if not check_jenkins_user(endpoint, defaultport, userpw): sys.exit( "Kindly provide an 'Admin' Jenkins user with correct password and run the installer again!" ) check_jenkins_pem() # Default Jenkins instance ssh Port ssh_port = "22" replace_tfvars('dockerizedJenkins', 'false', get_tfvars_file(), quoteVal=False) update_jenkins_terraform(endpoint, defaultport, userpw, sshuser, ssh_port, secgrp, subnet)
def configure_jenkins(endpoint, defaultport, userpw, sshuser, secgrp, subnet, existing_vpc_id, vpc_cidr): # Check is the jenkins user exist in jenkins server if not check_jenkins_user(endpoint, defaultport, userpw): sys.exit( "Kindly provide an 'Admin' Jenkins user with correct password and run the installer again!" ) check_jenkins_pem() # Default Jenkins instance ssh Port ssh_port = "22" if existing_vpc_id: replace_tfvars('existing_vpc_ecs', existing_vpc_id, get_tfvars_file()) else: replace_tfvars("autovpc", "true", get_tfvars_file(), False) replace_tfvars("vpc_cidr_block", vpc_cidr, get_tfvars_file()) replace_tfvars('dockerizedJenkins', 'false', get_tfvars_file(), quoteVal=False) update_jenkins_terraform(endpoint, defaultport, userpw, sshuser, ssh_port, secgrp, subnet)
def update_jenkins_terraform(endpoint, defaultport, userpw, sshuser, ssh_port, secgrp, subnet): replace_tfvars('jenkins_elb', '{0}:{1}'.format(endpoint, defaultport), get_tfvars_file()) replace_tfvars('jenkins_rawendpoint', endpoint, get_tfvars_file()) replace_tfvars('jenkins_security_group', secgrp, get_tfvars_file()) replace_tfvars('jenkins_subnet', subnet, get_tfvars_file()) replace_tfvars('jenkinsuser', userpw[0], get_tfvars_file()) replace_tfvars('jenkinspasswd', userpw[1], get_tfvars_file()) replace_tfvars('jenkins_ssh_login', sshuser, get_tfvars_file()) replace_tfvars('jenkins_ssh_port', ssh_port, get_tfvars_file()) replace_tfvars('jenkins_ssh_key', '{0}'.format(jenkins_pem), get_tfvars_file())
def configure_jenkins_container(existing_vpc_id, vpc_cidr, ecs_range): """ Launch a containerized Jenkins server. """ if existing_vpc_id: replace_tfvars('existing_vpc_ecs', existing_vpc_id, get_tfvars_file()) else: replace_tfvars("autovpc", "true", get_tfvars_file(), False) replace_tfvars("vpc_cidr_block", vpc_cidr, get_tfvars_file()) replace_tfvars('network_range', ecs_range, get_tfvars_file()) replace_tfvars('jenkinsuser', "admin", get_tfvars_file()) replace_tfvars('jenkinspasswd', passwd_generator(), get_tfvars_file())