What I want to achieve: I want to be able to create multiple VM instance using AWX playbook or Deployment Manager. The script will read instance configuration in a csv uploaded to gcloud or bitbucket, then create the resources as the values in the csv.

What I did: I have created a csv with value such as the instance name, disk size, and image family and it doesn't seem to be working. This is what my var file look like. The code is in the jinja template

Var file contains
rname: "{{ item.name }}"

#reading csv

- name: Read instances from CSV file and return a list
fieldnames: name,image
path: ./roles/autocreate-vm/templates/instances.csv
delimiter: ','
register: instances

 - include_tasks: <<path for jinja template>>
loop: "{{ instances.list }}"

Error I received:

ERROR: (gcloud.deployment-manager.deployments.create) ResponseError: code=400, 
message=Invalid value for field 'resource.name': 'instance-1'. 
Must be a match of regex '[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?'


  1. Has anyone done something similar i.e. (deploying multiple VMs instance while reading instance configuration from a csv)?
  2. Is there any public article that I can follow? Can't find anything on Google search
  • I haven't tried using a CSV as config template but this article might help. With regards to GCP documentation for such use case, you can follow this one.
    – Alex G
    Commented Aug 16, 2021 at 7:39


You must log in to answer this question.

Browse other questions tagged .