using docker:xenial image in chrismeyersfsu/provision_docker role

Hi,

I have plenty of ansible scripts installing SW on VMs.
I would like to try to containerize my VMs.

I found the role chrismeyersfsu/provision_docker which first looked suitable.
My applications are running on ubuntu 16.04 and I can’t find any example how to use chrismeyers role together with ubuntu:xenial.

I can specify the image ubuntu:xenial but I do not know how to pre load this image with python 2.7 (requirement for ansible).
Creating the docker containers manually I would create a Dockerfile defining the pre installed SW.

My playbooks looks like this:

  • name: Install dockers
    hosts: localhost
    vars:
    inventory:
  • name: “consul-server”
    image: “ubuntu:xenial”

roles:

  • role: provision_docker
    provision_docker_inventory: “{{inventory}}”
    provision_docker_use_docker_connection: true

tasks:

  • name: Group consul
    add_host:
    hostname: “{{item}}”
    groups: consul
    with_items:

  • consul-server
    tags: provision_docker

  • name: Test Install base role
    hosts: consul

roles:

  • { role: base, tags: base }

This playbook fails due to missing python installation:

TASK [Build hosts file] ********************************************************
fatal: [consul-server]: FAILED! => {“changed”: false, “failed”: true, “module_stderr”: “/bin/sh: 1: /usr/bin/python: not found\n”, “module_stdout”: “”, “msg”: “MODULE FAILURE”}

There are Dockerfiles for ubuntu 12 and 14 in files directory of the role which seems to add python to a standard image but I do not understand how and if they are used.
I have tried to update the ubuntu 14 Dockerfile with ubuntu 16 details but that had no affect.

Does anyone know if it is possible to use chrismeyersfsu/provision_docker role with ubuntu 16.04?
If so, how?

Thanks
Mathias

I would guess that should be possible with the ansible docker modules?
Specifically docker-image has an option to use a dockerfile...

https://docs.ansible.com/ansible/docker_module.html

https://docs.ansible.com/ansible/docker_container_module.html#docker-container

https://docs.ansible.com/ansible/docker_image_module.html#docker-image

Johannes

Hi,

I have created a local registry where I upload my image which I have added python too.I refer to this registry in provision_docker later on.

Br Mathias