def generate_role_with_colon_format(content, defined_role, generated_role):
    """Generate role data with input as Compute:ComputeA

    In Compute:ComputeA, the defined role 'Compute' can be added to
    roles_data.yaml by changing the name to 'ComputeA'. This allows duplicating
    the defined roles so that hardware specific nodes can be targeted with
    specific roles.

    :param content defined role file's content
    :param defined_role defined role's name
    :param generated_role role's name to generate from defined role
    :exception ValueError if generated role name is of invalid format
    """

    # "Compute:Compute" is invalid format
    if generated_role == defined_role:
        msg = ("Generated role name cannot be same as existing role name ({}) "
               "with colon format".format(defined_role))
        raise ValueError(msg)

    # "Compute:A" is invalid format
    if not generated_role.startswith(defined_role):
        msg = ("Generated role name ({}) name should start with existing role "
               "name ({})".format(generated_role, defined_role))
        raise ValueError(msg)

    name_line = "name:%s" % defined_role
    name_line_match = False
    processed = []
    for line in content.split('\n'):
        stripped_line = line.replace(' ', '')
        # Only 'name' need to be replaced in the existing role
        if name_line in stripped_line:
            line = line.replace(defined_role, generated_role)
            name_line_match = True
        processed.append(line)

    if not name_line_match:
        raise ValueError(" error")

    return '\n'.join(processed)