# using docker:xenial image in chrismeyersfsu/provision\_docker role

**URL:** <https://forum.ansible.com/t/using-docker-xenial-image-in-chrismeyersfsu-provision-docker-role/23507>\
**Category:** Ansible Project\
**Tags:** ubuntu\
**Created:** [January 19, 2017, 7:28pm UTC](https://forum.ansible.com/t/using-docker-xenial-image-in-chrismeyersfsu-provision-docker-role/23507 "2017-01-19T19:28:26Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mathias\_Aldrin](https://avatars.discourse-cdn.com/v4/letter/m/85f322/32.png) [@Mathias\_Aldrin](https://forum.ansible.com/u/Mathias_Aldrin)\
**Post date:** [January 19, 2017, 7:28pm UTC](https://forum.ansible.com/t/using-docker-xenial-image-in-chrismeyersfsu-provision-docker-role/23507/1 "2017-01-19T19:28:26Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Johannes\_Kastl](https://avatars.discourse-cdn.com/v4/letter/j/bbe5ce/32.png) [@Johannes\_Kastl](https://forum.ansible.com/u/Johannes_Kastl)\
**Post date:** [January 20, 2017, 8:04am UTC](https://forum.ansible.com/t/using-docker-xenial-image-in-chrismeyersfsu-provision-docker-role/23507/2 "2017-01-20T08:04:41Z")

</div>

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_module.html)

[https://docs.ansible.com/ansible/docker\_container\_module.html#docker-container](https://docs.ansible.com/ansible/docker_container_module.html#docker-container)

[https://docs.ansible.com/ansible/docker\_image\_module.html#docker-image](https://docs.ansible.com/ansible/docker_image_module.html#docker-image)

Johannes

---

<div class="post-metadata">

**Author:** ![Mathias\_Aldrin](https://avatars.discourse-cdn.com/v4/letter/m/85f322/32.png) [@Mathias\_Aldrin](https://forum.ansible.com/u/Mathias_Aldrin)\
**Post date:** [January 22, 2017, 9:19pm UTC](https://forum.ansible.com/t/using-docker-xenial-image-in-chrismeyersfsu-provision-docker-role/23507/3 "2017-01-22T21:19:27Z")

</div>

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
