Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
documentation
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Model registry
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
cloud
documentation
Merge requests
!7
Feature/cli demo
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Feature/cli demo
feature/cli-demo
into
master
Overview
0
Commits
4
Pipelines
0
Changes
1
Merged
Sven Relovský
requested to merge
feature/cli-demo
into
master
6 years ago
Overview
0
Commits
4
Pipelines
0
Changes
1
Expand
cli
0
0
Merge request reports
Compare
master
master (base)
and
latest version
latest version
c26a0e03
4 commits,
6 years ago
1 file
+
88
−
0
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
cli/README.md
+
88
−
0
Options
@@ -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