def create(state, host, ctid, template=None):
    '''
    Create OpenVZ containers.

    + ctid: CTID of the container to create
    '''

    # Check we don't already have a container with this CTID
    current_containers = host.fact.openvz_containers
    if ctid in current_containers:
        raise OperationError(
            'An OpenVZ container with CTID {0} already exists'.format(ctid),
        )

    args = ['{0}'.format(ctid)]

    if template:
        args.append('--ostemplate {0}'.format(template))

    yield 'vzctl create {0}'.format(' '.join(args))
Create OpenVZ containers.

    + ctid: CTID of the container to create