How to create a VDC

For creating a virtual datacenter (VDC) use the vdc actor template, available here: https://github.com/Jumpscale/ays_jumpscale8/tree/master/templates/ovc/vdc

Here's an example blueprint for creating a VDC:

g8client__cl:
  url: 'uk-g8-1.demo.greenitglobe.com'
  login: '***'
  password: '***'
  account: '***'

vdc__myvdc:
  g8client: 'cl'
  account: '***'
  location: 'uk-g8-1'

actions:
  - action: install

Below we discuss creating a VDC step by step using curl commands:

Get an OAuth token with Client Credentials Flow

curl -d "grant_type=client_credentials&client_id={CLIENT_ID}&client_secret={CLIENT_SECRET}" /
     https://itsyou.online/v1/oauth/access_token

Get a JWT to talk to the Cockpit

curl -H "Authorization: token OAUTH-TOKEN" /
     https://itsyou.online/v1/oauth/jwt?aud=client_id

Create a new repository

curl -H "Authorization: bearer JWT"  /
     -H "Content-Type: application/json" /
     -d '{"name":"test-repo"}' /
     https://{address}:5000/ays/repository

Create blueprint for a g8client service instance

curl -H "Authorization: bearer JWT"  /
     -H "Content-Type: application/json" /
     -d '{"name":"cl.yaml","content":"g8client__cl:\n  g8.url: uk-g8-1.demo.greenitglobe.com\n  g8.login: ***\n  g8.password: ***\n  g8.account:***"}'
     https://{address}:5000/ays/repository/

Execute the g8client blueprint

curl -H "Authorization: bearer JWT"  /  
     https://{address}:5000/ays/repository/{repository-name}/blueprint/cl.yaml

Create blueprint for a user

curl -H "Authorization: bearer JWT"  /
     -H "Content-Type: application/json" /
     -d '{"name":"user1.yaml","content":"ovc_user__user1:\n  g8.client.name: 'cl'\n  username: 'mike'\n  email: '[email protected]'\n  provider: 'itsyouonline'"}'
     https://{address}:5000/ays/repository/

Execute the user blueprint

curl -H "Authorization: bearer JWT"  /  
     https://{address}:5000/ays/repository/{repository-name}/blueprint/user1.yaml

Create blueprint for new VDC

curl -H "Authorization: bearer JWT"  /
     -H "Content-Type: application/json" /
     -d '{"name":"myvdc.yaml","content":"vdc__myvdc:\n  g8client: 'cl'\n  location: uk-g8-1"}'
     https://{address}:5000/ays/repository/

Execute the VDC blueprint

curl -H "Authorization: bearer JWT"  /  
     https:/{address}:5000/ays/repository/{repository-name}/blueprint/myvdc.yaml

Start a run to actually deploy the VDC

curl -X POST
     -H "Authorization: bearer JWT" /
     http://{address}:5000/ays/repository/{repository-name}/aysrun | python -m json.tool

results matching ""

    No results matching ""