Exemple #1
0
def get_and_add_docker_jenkins_config(jenkins_docker_path):
    """
        Launch a dockerized Jenkins server.
    """
    encrypt_passwd = hashlib.md5()
    encrypt_passwd.update(str(datetime.datetime.now()))
    jenkins_passwd = encrypt_passwd.hexdigest()

    use_existing_vpc = raw_input(
        """\nWould you like to use existing VPC for ECS? [y/n] :""")
    if use_existing_vpc == 'y':
        existing_vpc_id = raw_input("Enter the VPC ID :")
        replace_tfvars('existing_vpc_ecs', existing_vpc_id, get_tfvars_file())
    else:
        replace_tfvars_map("autovpc", "true", get_tfvars_file())
        desired_vpc_cidr = raw_input(
            "Enter the desired CIDR for VPC (default - 10.0.0.0/16) :"
        ) or "10.0.0.0/16"
        replace_tfvars("vpc_cidr_block", desired_vpc_cidr, get_tfvars_file())

    # Get values to create the array
    parameter_list = [
        "replaceme", "admin", jenkins_passwd, "replaceme", "root", "2200",
        "replaceme", "replaceme"
    ]
    print(parameter_list[0:])

    add_jenkins_config_to_files(parameter_list)
Exemple #2
0
def add_sonar_config_to_files(sonar_server_elb, sonar_username, sonar_passwd):
    """
        Add Sonar configuration to terraform.tfvars
     """

    replace_tfvars('sonar_server_elb', sonar_server_elb, get_tfvars_file())
    replace_tfvars('sonar_username', sonar_username, get_tfvars_file())
    replace_tfvars('sonar_passwd', sonar_passwd, get_tfvars_file())
    replace_tfvars('codeq', 1, get_tfvars_file())
Exemple #3
0
def add_gitlab_config_to_files(parameter_list):
    """
    Add gitlab configuration to terraform.tfvars
    parameter_list = [  gitlab_public_ip ,
                        gitlab_username,
                        gitlab_passwd ]
    """
    print("Adding Gitlab config to Terraform variables")
    replace_tfvars('scm_publicip', parameter_list[0], get_tfvars_file())
    replace_tfvars('scm_elb', parameter_list[0], get_tfvars_file())
    replace_tfvars('scm_username', parameter_list[1], get_tfvars_file())
    replace_tfvars('scm_passwd', parameter_list[2], get_tfvars_file())
Exemple #4
0
def add_sonar_config_to_files(parameter_list):
    """
        Add Sonar configuration to terraform.tfvars
        parameter_list = [  sonar_server_elb ,
                            sonar_username,
                            sonar_passwd,
                            sonar_server_public_ip]
     """

    replace_tfvars('sonar_server_elb', parameter_list[0], get_tfvars_file())
    replace_tfvars('sonar_username', parameter_list[1], get_tfvars_file())
    replace_tfvars('sonar_passwd', parameter_list[2], get_tfvars_file())
    replace_tfvars('sonar_server_public_ip', parameter_list[3], get_tfvars_file())
    replace_tfvars('codequality_type', 'sonarqube', get_tfvars_file())
    replace_tfvars('codeq', 1, get_tfvars_file())
def add_bitbucket_config_to_files(parameter_list):
    """
        Add bitbucket configuration to terraform.tfvars
        parameter_list = [  bitbucket_server_elb ,
                            bitbucket_username,
                            bitbucket_passwd,
                            bitbucket_server_public_ip]
     """

    replace_tfvars('scm_elb', parameter_list[0], get_tfvars_file())
    replace_tfvars('scm_username', parameter_list[1], get_tfvars_file())
    replace_tfvars('scm_passwd', parameter_list[2], get_tfvars_file())
    replace_tfvars('scm_publicip', parameter_list[3], get_tfvars_file())
    replace_tfvars('scm_type', 'bitbucket', get_tfvars_file())
    replace_tfvars('scm_pathext', '/scm', get_tfvars_file())
Exemple #6
0
def add_gitlab_config_to_files(scm_publicip, scm_username, scm_passwd):
    """
    Add gitlab configuration to terraform.tfvars
    parameter_list = [  scm_publicip ,
                        scm_username,
                        scm_passwd ]
    """
    print("Adding Gitlab config to Terraform variables")
    replace_tfvars('scm_publicip', scm_publicip, get_tfvars_file())
    replace_tfvars('scm_elb', scm_publicip, get_tfvars_file())
    replace_tfvars('scm_username', scm_username, get_tfvars_file())
    replace_tfvars('scm_passwd', scm_passwd, get_tfvars_file())
    replace_tfvars('scm_type', 'gitlab', get_tfvars_file())
    replace_tfvars('scm_pathext', '/', get_tfvars_file())
Exemple #7
0
def add_jenkins_config_to_files(parameter_list):
    """
        Adding Jenkins Server configuration details to terraform.tfvars
           parameter_list = [   jenkins_server_elb ,
                                jenkins_username,
                                jenkins_passwd,
                                jenkins_server_public_ip,
                                jenkins_server_ssh_login,
                                jenkins_server_ssh_port,
                                jenkins_server_security_group,
                                jenkins_server_subnet]
    """

    replace_tfvars('jenkins_elb', parameter_list[0], get_tfvars_file())
    replace_tfvars('jenkinsuser', parameter_list[1], get_tfvars_file())
    replace_tfvars('jenkinspasswd', parameter_list[2], get_tfvars_file())
    replace_tfvars('jenkins_public_ip', parameter_list[3], get_tfvars_file())
    replace_tfvars('jenkins_ssh_login', parameter_list[4], get_tfvars_file())
    replace_tfvars('jenkins_ssh_port', parameter_list[5], get_tfvars_file())
    replace_tfvars('jenkins_security_group', parameter_list[6],
                   get_tfvars_file())
    replace_tfvars('jenkins_subnet', parameter_list[7], get_tfvars_file())
Exemple #8
0
        '../../docker_creation.out'
    ])
    # Get values to create the array
    parameter_list = []
    with open("docker_jenkins_vars") as f:
        for line in f:
            parameter_list.append(line.rstrip())

=======
    encrypt_passwd = hashlib.md5()
    encrypt_passwd.update(str(datetime.datetime.now()))
    jenkins_passwd = encrypt_passwd.hexdigest()

    use_existing_vpc = raw_input(
        """\nWould you like to use existing VPC for ECS? [y/n] :""")
    if use_existing_vpc == 'y':
        existing_vpc_id = raw_input("Enter the VPC ID :")
        replace_tfvars('existing_vpc_ecs', existing_vpc_id, get_tfvars_file())
    else:
        replace_tfvars_map("autovpc", "true", get_tfvars_file())
        desired_vpc_cidr = raw_input("Enter the desired CIDR for VPC (default - 10.0.0.0/16) :") or "10.0.0.0/16"
        replace_tfvars("vpc_cidr_block", desired_vpc_cidr, get_tfvars_file())

    # Get values to create the array
    parameter_list = ["replaceme", "admin", jenkins_passwd, "replaceme",
                      "root", "2200", "replaceme", "replaceme"]
>>>>>>> upstream/master
    print(parameter_list[0:])

    add_jenkins_config_to_files(parameter_list)
Exemple #9
0

def add_gitlab_config_to_files(scm_publicip, scm_username, scm_passwd):
    """
    Add gitlab configuration to terraform.tfvars
    parameter_list = [  scm_publicip ,
                        scm_username,
                        scm_passwd ]
    """
    print("Adding Gitlab config to Terraform variables")
    replace_tfvars('scm_publicip', scm_publicip, get_tfvars_file())
    replace_tfvars('scm_elb', scm_publicip, get_tfvars_file())
    replace_tfvars('scm_username', scm_username, get_tfvars_file())
    replace_tfvars('scm_passwd', scm_passwd, get_tfvars_file())
>>>>>>> upstream/master
    replace_tfvars('scm_type', 'gitlab', get_tfvars_file())
    replace_tfvars('scm_pathext', '/', get_tfvars_file())


def get_and_add_docker_gitlab_config(gitlab_docker_path, parameter_cred_list=[]):
    """
        Launch a Dockerized Gitlab server.
    """
<<<<<<< HEAD
    os.chdir(gitlab_docker_path)
    print("Running docker launch script  for gitlab")

    subprocess.call([
        'sg', 'docker',  './launch_gitlab_docker.sh %s %s' %( str(parameter_cred_list[1]) , str(parameter_cred_list[0])), '|', 'tee', '-a',
        '../../gitlab_creation.out'
    ])