Last few days I was trying TryStack and I’ve created a simple script in order to automatize my test deployments, feel free to use it.
First of all at least we need to install neutron and nova clients, for example, via pip:
pip install python-novaclient pip install python-neutronclient
And then just run a script like this one:
#!/bin/bash export OS_USERNAME=<id> export OS_PASSWORD=<pwd> export OS_TENANT_NAME=<tname> export OS_AUTH_URL=http://x86.trystack.org:5000/v2.0 neutron net-create net1 neutron subnet-create net1 <x.x.x.0/24> --name subnet1 neutron router-create router1 neutron router-gateway-set router1 external neutron router-interface-add router1 subnet1 nova keypair-add --pub-key <path/id_rsa.pub> key1 nova secgroup-create sg sg nova secgroup-add-rule sg icmp -1 -1 0.0.0.0/0 nova secgroup-add-rule sg tcp 1 65535 0.0.0.0/0 nova secgroup-add-rule sg udp 1 65535 0.0.0.0/0 nova secgroup-add-rule sg tcp 22 22 0.0.0.0/0 nova boot vm1 --flavor m1.medium --image "Fedora 20 x86_64" --key-name key1 --security-groups sg nova boot vm2 --flavor m1.medium --image "Fedora 20 x86_64" --key-name key1 --security-groups sg nova boot vm3 --flavor m1.medium --image "Fedora 20 x86_64" --key-name key1 --security-groups sg neutron floatingip-create external neutron floatingip-create external neutron floatingip-create external neutron floatingip-create external nova floating-ip-list nova floating-ip-associate vm1 <fip> nova floating-ip-associate vm2 <fip> nova floating-ip-associate vm3 <fip>
Just take into account to replace your personal information and to choose your private network and finally to assign your personal floating ip to the VMS.
Also my security group is quite redundant but I wanted to play around with the API.
For further reference here’s the API URLs:
* Compute http://8.21.28.222:8774/v2
* Network http://8.21.28.4:9696/
* S3 http://8.21.28.222:8080
* Image http://8.21.28.222:9292
* Metering http://8.21.28.222:8777
* Cloudformation http://8.21.28.222:8000/v1
* Volume http://8.21.28.222:8776/v1
* EC2 http://8.21.28.222:8773/services/Cloud
* Orchestration http://8.21.28.222:8004/v1
* Object Store http://8.21.28.222:8080/v1
* Identity http://8.21.28.222:5000/v2.0