'Generate an Ansible playbook to orchestrate services.
:param url: registry URL where images were pushed.
:param namespace: registry namespace
:param repository_prefix: prefix to use for the image name
:param settings: settings dict from container.yml
:param pull_from_url: if url to pull from is different than url
:return: playbook dict'

@conductor_only
def generate_orchestration_playbook(self, url=None, namespace=None, settings=None, repository_prefix=None, pull_from_url=None, tag=None, vault_files=None, **kwargs):

    for (service_name, service_config) in self.services.iteritems():
        if service_config.get('roles'):
            if (url and namespace):
                image_id = self.get_latest_image_id_for_service(service_name)
                if (not image_id):
                    raise exceptions.AnsibleContainerConductorException(u'Unable    to    get    image    ID    for    service    {}.    Did    you    forget    to    run    `ansible-container    build`?'.format(service_name))
                image_tag = (tag or self.get_build_stamp_for_image(image_id))
                if repository_prefix:
                    image_name = '{}-{}'.format(self.repository_prefix, service_name)
                elif (repository_prefix is None):
                    image_name = '{}-{}'.format(self.project_name, service_name)
                elif (repository_prefix == ''):
                    image_name = service_name
                repository = '{}/{}'.format(namespace, image_name)
                image_name = '{}:{}'.format(repository, image_tag)
                pull_url = (url if (not pull_from_url) else pull_from_url)
                self.services[service_name][u'image'] = '{}/{}'.format(pull_url.rstrip('/'), image_name)
            else:
                image = self.get_latest_image_for_service(service_name)
                if (image is None):
                    raise exceptions.AnsibleContainerConductorException(u"No    image    found    for    service    {},    make    sure    you've    run    `ansible-container    build`".format(service_name))
                self.services[service_name][u'image'] = image.tags[0]
        else:
            self.services[service_name][u'image'] = service_config['from']
    play = CommentedMap()
    play['name'] = u'Manage    the    lifecycle    of    {}    on    {}'.format(self.project_name, self.display_name)
    play['hosts'] = 'localhost'
    play['gather_facts'] = 'no'
    play['connection'] = 'local'
    play['roles'] = CommentedSeq()
    play['vars_files'] = CommentedSeq()
    play['tasks'] = CommentedSeq()
    role = CommentedMap([('role', 'ansible.kubernetes-modules')])
    play['vars_files'].extend(vault_files)
    play['roles'].append(role)
    play.yaml_set_comment_before_after_key('roles', before='Include    Ansible    Kubernetes    and    OpenShift    modules', indent=4)
    play.yaml_set_comment_before_after_key('tasks', before='Tasks    for    setting    the    application    state.    Valid    tags    include:    start,    stop,    restart,    destroy', indent=4)
    play['tasks'].append(self.deploy.get_namespace_task(state='present', tags=['start']))
    play['tasks'].append(self.deploy.get_namespace_task(state='absent', tags=['destroy']))
    play['tasks'].extend(self.deploy.get_secret_tasks(tags=['start']))
    play['tasks'].extend(self.deploy.get_service_tasks(tags=['start']))
    play['tasks'].extend(self.deploy.get_deployment_tasks(engine_state='stop', tags=['stop', 'restart']))
    play['tasks'].extend(self.deploy.get_deployment_tasks(tags=['start', 'restart']))
    play['tasks'].extend(self.deploy.get_pvc_tasks(tags=['start']))
    playbook = CommentedSeq()
    playbook.append(play)
    logger.debug(u'Created    playbook    to    run    project', playbook=playbook)
    return playbook
