'Determine which images we expect to need for this host.
Returns: a set of required images like \'openshift/origin:v3.6\'
The thorny issue of determining the image names from the variables is under consideration
via https://github.com/openshift/openshift-ansible/issues/4415
For now we operate as follows:
* For containerized components (master, node, ...) we look at the deployment type and
use openshift/origin or openshift3/ose as the base for those component images. The
version is openshift_image_tag as determined by the openshift_version role.
* For OpenShift-managed infrastructure (router, registry...) we use oreg_url if
it is defined; otherwise we again use the base that depends on the deployment type.
Registry is not included in constructed images. It may be in oreg_url or etcd image.'

def required_images(self):

    required = set()
    deployment_type = self.get_var('openshift_deployment_type')
    host_groups = self.get_var('group_names')
    image_tag = self.get_var('openshift_image_tag', default='latest')
    image_info = DEPLOYMENT_IMAGE_INFO[deployment_type]
    if (not image_info):
        return required
    image_url = '{}/{}-{}:{}'.format(image_info['namespace'], image_info['name'], '${component}', '${version}')
    image_url = (self.get_var('oreg_url', default='') or image_url)
    if ('nodes' in host_groups):
        for suffix in NODE_IMAGE_SUFFIXES:
            required.add(image_url.replace('${component}', suffix).replace('${version}', image_tag))
        required.add(image_info['registry_console_image'])
    if self.get_var('openshift', 'common', 'is_containerized'):
        components = set()
        if ('nodes' in host_groups):
            components.update(['node', 'openvswitch'])
        if ('masters' in host_groups):
            components.add(image_info['name'])
        for component in components:
            required.add('{}/{}:{}'.format(image_info['namespace'], component, image_tag))
        if ('etcd' in host_groups):
            required.add('registry.access.redhat.com/rhel7/etcd')
    return required
