-
Notifications
You must be signed in to change notification settings - Fork 0
Openstack Usage and Examples
This short guide will outline the usage of some simple commands for openstack/microstack. This includes service usage, dashboard settings, and more.
microstack.openstack catalog list
Output Example:

microstack.openstack user list
Output Example

``microstack.openstack image list```
Example Output:

microstack.openstack network list
Example Output

microstack.openstack hypervisor list
Example Output

Themes can be changed in the login menu from the webpage.
Example:

The User password for the Openstack dashboard can be changed if know, by going to Settings > Change Password.
Example

If the Password is not known, it can be retrieved from the CLI on the host:
sudo snap get microstack config.credentials.keystone-password
Example Output

Managing templates can be done from the web dashboard, this includes managing images, and templates.
To create an image navigate to Admin > Compute > images
Here you can list and search images available to the system
Flavors are a crucial part of your workflow with openstack, allowing you to create hardware templates to allow the quick creation of new guests
To create a new flavor, from cli run the following and replacing the resources respectively with what is needed
microstack.openstack flavor create --ram 1024 --disk 10 --vcpus 1 testflavor
Example Output

List the flavors on the system:
microstack.openstack flavor list
Example output

This can also be managed through the flavors tab of the dashboard at Admin > Compute > Flavors.
Here you can and remove flavors from the system dashboard
In this section we are outlining the commands and usage for creating, and changes domains in openstack, not to be confused with domains related to AD
microstack.openstack domain create --description "DESCRIPTION" domain.local
Example output:

microstack.openstack domain list
Example:

microstack.openstack user create --domain domain.local --password username passsword
Example:

microstack.openstack role add --domain domain.local --user-domain domain.local --user username password
No output is provided form this command
Note: To allow multi domain logins on the web page, you need to append the following config file to allow the domain entry box to be used at the login screen:
Command:

To add a new role:
microstack.openstack role create _member_
Example:

To add a new project:
microstack.openstack project create --domain domain.local projectname
Example:

To List projects:
microstack.openstack project list --domain domain.local
Example:

These Same actions can be achived via the web UI, found in "Identity > Projects"

To create a domain user:
microstack.openstack user create --domain domain.local --password password username
Example:

To List Users:
microstack.openstack user list --domain domain.local
Example:

To Create a new group:
microstack.openstack group create --domain domain.local grouname
Example:

To list groups:
microstack.openstack group list --domain domain.local
Example:

To add a user to a group:
microstack.openstack group add user --group-domain domain.local --user-domain domain.local group username
To assign a group to a rile:
microstack.openstack role add --project projectname --project-domain domain.local --group groupname --group-domain domain.local group
Finishing making the domain admin account an administrator
microstack.openstack role add --project myproject --project-domain mydomain --user admin --user-domain mydomain admin
Then make some changes to the RC file
Download the new RC file from the top left user menu:
Then rename it:
mv ~/Downloads/myproject-openrc.sh ~/Downloads/admin-openrc.sh
Then Execute it with:
source ~/Downloads/admin-openrc.sh
We had to install some further packages to have the command work correctly. Run the following to fix issues with tenancy changes:
sudo apt install python3-openstackclient
Now that that has been installed you can call openstack without microstack:
List active running images:

To Create Tenancy keypairs:
openstack keypair create --private-key ./mykeypair.pem --type ssh mykeypair
Example:

To list keypairs:
openstack keypair list
Example:

Create a new network:
openstack --insecure network create networkname
Example

List Networks:
openstack --insecure network list
Example

To Create a Subnet:
openstack --insecure subnet create --network mynetwork --subnet-range 192.168.0.0/24 --allocation-pool start=192.168.0.101,end=192.168.0.200 --dns-nameserver 8.8.8.8 mysubnet
Example:

To list subnets:
openstack --insecure subnet list
Example

To Create a router:
openstack --insecure router create myrouter
Example

To list routers:
openstack --insecure router list
Example

To configure external networks as a gateway for created networks:
openstack --insecure router set --external-gateway external-network myrouter
To create a new floating ip
openstack --insecure floating ip create external
Example

To list floating Ip's
openstack --insecure floating ip list
Example

To create a security group:
openstack security group create name
Example:

To list security groups
openstack --insecure security group list
Example

To Create a security group rule
openstack security group rule create --remote-ip 0.0.0.0/0 --dst-port 22:22 --protocol tcp --ingress mysecuritygroup
Example

To list security group:
openstack --insecure group rule list name
Example

Create a new instance:
openstack server create --flavor myflavor --image ubuntu --network mynetwork --key-name mykeypair --min 2 --max 2 myinstance
Example

To associate a floating Ip with a Client:
IP=$(openstack floating ip list | tail -n 2 | head -n 1 | awk '{print $4}')
openstack server add floating ip myinstance-1 $IP
Attaching security groups
chmod 0400 ~/keypai/location/key.pem
SSH Config:
```ssh -i ~/Downloads/mykeypair.pem -o StrictHostKeyChecking=no ubuntu@$IP```
SSH Connection:

To delete an instance;
```openstack server delete myinstance-2```