Abstract the conductor image from service images #910
Description
ISSUE TYPE
- Feature Idea
- Documentation Report
Consider a scenario where an application needs to be deployed on multiple images of different base operating systems for testing purposes. Specifying the conductor image of one base will cause the build process for service images using a different base to fail. Scanning through current issues, these might be related: #807, #812, #847, #904, as I have experienced the same or very similar errors when building service images that do not match or partially match the conductor image.
The documentation is clear about the fact that service images should be of the same family as the conductor image. This might be limiting as the potential workarounds include creating and maintaining a separate project for each base image. The other option is to use the docker_image to build from Dockerfiles, and then run them with docker_containter. What is not clear in the documentation is how run tasks on the created containers afterwards, if this approach is to be taken.
For example, the build for the below configuration and related role(s) will fail.
container.yml
version: '2'
settings:
conductor:
base: 'centos:7'
services:
centos-server:
from: 'centos:7'
roles:
- role: common
ubuntu-server:
from: 'ubuntu:16.04'
roles:
- role: common
roles/common/tasks/main.yml
---
- name: Install package
package:
name: wget
state: present
or
roles/common/tasks/main.yml
- name: Install package on Ubuntu
apt:
name: wget
state: present
when:
ansible_distribution is match('Ubuntu')
- name: Install package on CentOS
yum:
name: wget
state: present
when:
ansible_distribution is match('CentOS')
Depending on the service images used that do not match the conductor image, the build will error out with a different error message. Using the multi-container example did not help either. What I noticed is that when using service images which do not match the conductor image and do not use any roles, the build process succeeds, for example a configuration file such as below will build successfully.
container.yml
version: '2'
settings:
conductor:
base: 'centos:7'
services:
centos-server:
from: 'centos:7'
roles:
- role: common
ubuntu-server:
from: 'ubuntu:16.04'
I am not sure how practically feasible to abstract the conductor image from the service images. Would the enhancement in #777 help overcome such concerns?