Skip to content
Snippets Groups Projects

Feature/cli demo

Merged Sven Relovský requested to merge feature/cli-demo into master
1 file
+ 88
0
Compare changes
  • Side-by-side
  • Inline
+ 88
0
@@ -40,5 +40,93 @@ it is a form of token-based authentication providing easy and secure access with
2. Follow the official [Launch instances](https://docs.openstack.org/nova/rocky/user/launch-instances.html) guide.
---
## Creating a key-pair
1. Assuming your ssh public key is stored in `~/.ssh/id_rsa.pub`
```
openstack keypair create --public-key ~/.ssh/id_rsa.pub my-key1
```
## Create security group
1. Create:
```
openstack security group create my-security-group
```
2. Add rules to your security group:
```
openstack security group rule create --description "Permit SSH" --remote-ip 0.0.0.0/0 --protocol tcp --dst-port 22 --ingress my-security-group
openstack security group rule create --description "Permit ICMP (any)" --remote-ip 0.0.0.0/0 --protocol icmp --icmp-type -1 --ingress my-security-group
```
3. Verify:
```
openstack security group show my-security-group
```
## Create network
1. Create network + subnet (from auto-allocated pool)
```
openstack network create my-net1
openstack subnet create --network my-net1 --subnet-pool private-192-168 my-sub1
```
2. Create router:
```
openstack router create my-router1
```
Current router have no ports, which makes it pretty useless, we need to create at least 2 interfaces (external and internal)
3. Set external network for router (let us say public-muni-147-251-124), and the external port will be created automatically:
```
openstack router set --external-gateway public-muni-147-251-124 my-router1
```
4. Check which IP address is set as gateway for our subnet (default: first address of the subnet):
```
GW_IP=$(openstack subnet show my-sub1 -c gateway_ip -f value)
```
5. Create internal port for router (gateway for the network my-net1):
```
openstack port create --network my-net1 --disable-port-security --fixed-ip ip-address=$GW_IP my-net1-port1-gw
```
6. Add port to the router:
```
openstack router add port my-router1 my-net1-port1-gw
```
## Create volume
<div style="border-width:0;border-left:5px solid #b8d6f4;background-color:rgba(228,240,251,0.3);margin:20px 0;padding:10px 20px;font-size:15px;">
<strong>WARNING:</strong><br/>
Skipping this section can lead to unreversible loss of data
</div>
Volumes are create automatically when creating an instance in GUI, but we need to create them manually in case of CLI
1. Create bootable volume from image(e.g. centos):
```
openstack volume create --image "centos-7-1809-x86_64" --size 40 my_vol1
```
## Create server
1. Create instance:
```
openstack server create --flavor "standard.small" --volume my_vol1 \
--key-name my-key1 --security-group my-security-group --network my-net1 my-server1
```
## Assign floating ip address
1. Create and assign floating IP address:
```
FLOAT_IP=$(openstack floating ip create --description my-float1 -c floating_ip_address -f value public-muni-147-251-124)
openstack server add floating ip my-server1 $FLOAT_IP
```
## Full Reference
See [OpenStack CLI Documentation](https://docs.openstack.org/python-openstackclient/rocky/).
Loading