# Ansible and Google Docker Manifest

**URL:** <https://forum.ansible.com/t/ansible-and-google-docker-manifest/15347>\
**Category:** Ansible Developer\
**Created:** [May 27, 2014, 11:41pm UTC](https://forum.ansible.com/t/ansible-and-google-docker-manifest/15347 "2014-05-27T23:41:33Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Magnus\_Andersson](https://avatars.discourse-cdn.com/v4/letter/m/7ab992/32.png) [@Magnus\_Andersson](https://forum.ansible.com/u/Magnus_Andersson)\
**Post date:** [May 27, 2014, 11:41pm UTC](https://forum.ansible.com/t/ansible-and-google-docker-manifest/15347/1 "2014-05-27T23:41:33Z")

</div>

Hi

I’m having troubles adding a metadata key/value where the value is a multiline string when provisioning with the gce module. I just can’t get it to work from Ansible, I get the error: bad metadata: malformed string. If I do it in the command

The background is this Docker preview in GCE: [https://developers.google.com/compute/docs/containers](https://developers.google.com/compute/docs/containers)

If I provision a GCE machine manually I can se the `--metadata-from-file` flag to load a whole YAML file into a value. The content ends up in the key `google-container-manifest`.

If I provision manually using the command:

> gcloud compute instances create containervm-test-1 \
> 
> –image projects/google-containers/global/images/container-vm-v20140522 \
> 
> –metadata-from-file google-container-manifest=containers.yaml \
> 
> –zone us-central1-a \
> 
> –machine-type f1-micro

It looks like this in the prompt for metadata:

> metadata:
> 
> fingerprint: n5JL5z74Ofk=
> 
> items:
> 
> - key: google-container-manifest
> 
> value: "version: v1beta1\ncontainers:\n - name: simple-echo\n image: google/busybox\n\
> 
> \ command: [‘nc’, ‘-p’, ‘8080’, ‘-l’, ‘-l’, ‘-e’, ‘echo’, ‘hello world!’]\n\
> 
> \ ports:\n - name: nc-echo\n hostPort: 8080\n containerPort:\
> 
> \ 8080"

My Ansible variable looks like this:

> vars:  
> manifest: |  
> version: v1beta1  
> containers:
> 
> - name: repository  
> image: google/docker-registry  
> ports:
> - name: registry  
> containerPort: 5000  
> env:
> - key: GCS\_BUCKET  
> value: mlwr-docker-registry
> - name: client  
> image: localhost:5000/data-loader  
> volumeMounts:
> - name: data  
> path: /mnt/data
> - name: server  
> image: localhost:5000/data-server  
> ports:
> - name: www  
> containerPort: 80  
> volumeMounts:
> - name: data  
> path: /mnt/data  
> volumes:
> - name: data

Used like this:  
gce\_metadata: ‘{“google-container-manifest”: “{{ manifest }}”}’

I have tried all combinations I could come up with, but it seems that something goes wrong with the data before [yaml parsing and `literal_eval`](https://github.com/ansible/ansible/blob/devel/library/cloud/gce#L263) in the GCE Ansible-module. I tried to reproduce in a python console but it seemed to work fine.

Thanks  
/Magnus

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan1](https://avatars.discourse-cdn.com/v4/letter/m/5e9695/32.png) [@Michael\_DeHaan1](https://forum.ansible.com/u/Michael_DeHaan1)\
**Post date:** [May 28, 2014, 1:22pm UTC](https://forum.ansible.com/t/ansible-and-google-docker-manifest/15347/2 "2014-05-28T13:22:36Z")

</div>

Ask on the GCE lists if this is about the GCE YAML tool thing.

(Looked incredibly rough to me, at first glance, but I know nothing about it)
