Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

Deployment manager : Adding Templates

Creating a basic template

A template is a file you create, written in either Jinja or Python

Create a file with extension .jinja.

Paste the below code

resources:
- name: vm-template
  type: compute.v1.instance
  properties:
    zone: us-central1-a
    machineType: zones/us-central1-a/machineTypes/n1-standard-1
    disks:
    - deviceName: boot
      type: PERSISTENT
      boot: true
      autoDelete: true
      initializeParams:
        sourceImage: projects/debian-cloud/global/images/family/debian-9
    networkInterfaces:
    - network: global/networks/default

Press ctrl+x  then y  then enter. The file will be saved.

Type $   pwd. It will show the path of file located.

Create a configuration file with extension .yaml

$       nano vm-config.yaml

Paste the below code

imports:
- path: path/my_vm_template.jinja
resources:
- name: my-first-virtual-machine
  type: path/to/my_vm_template.jinja

Press ctrl+x  then y  then enter. The file will be saved.

Then you can deploy the configuration file that contains the Templates.

Deploying templates directly with the command-line tool

$   gcloud deployment-manager deployments create a-single-vm   --template vm_template.jinja

The post Deployment manager : Adding Templates appeared first on Prwatech.



This post first appeared on Learn Big Data Hadoop In Bangalore, please read the originial post: here

Share the post

Deployment manager : Adding Templates

×

Subscribe to Learn Big Data Hadoop In Bangalore

Get updates delivered right to your inbox!

Thank you for your subscription

×