OpenStack Client: Difference between revisions

Jump to navigation Jump to search
No edit summary
 
(8 intermediate revisions by 2 users not shown)
Line 4: Line 4:
<tabs>
<tabs>
<tab name="Fedora/RedHat Linux">
<tab name="Fedora/RedHat Linux">
You can install the client form you package manager  
You can install the client from you package manager, but the pip install is probably more up to date!
{{Code
{{Code
   |lang="bash"
   |lang="bash"
   |contents=
   |contents=
sudo dnf install python-openstackclient-doc.noarch
sudo dnf install python-openstackclient.noarch
# test the installation
# test the installation
openstack --version
openstack --version
Line 26: Line 26:


<tab name="pip">
<tab name="pip">
This will get you the latest version of the client
This will get you the latest version of the client. You might wish to use a python version/environment manager like pyenv.
{{Code
{{Code
   |lang="bash"
   |lang="bash"
Line 59: Line 59:




===Installing Missing Plugins with pip===
===Installing Missing Plugins===


Depending on the procedure that was used to install the OpenStask client, some plugin could be missing. They can be added with pip, for example the <code>share</code> subcommand is part of the Manilla plugin:
Depending on the procedure that was used to install the OpenStask client, some plugin could be missing. They can be added with pip, for example the <code>share</code> subcommand is part of the Manilla plugin:
Line 68: Line 68:
A list of the main plugins is available in [https://docs.openstack.org/python-openstackclient/latest/cli/plugin-commands/index.html openstack documentation client page].
A list of the main plugins is available in [https://docs.openstack.org/python-openstackclient/latest/cli/plugin-commands/index.html openstack documentation client page].


==Get the client rc file==
==Configure the client==
 
Once the client is installed you need to configure it so it can connect to Juno. The credentials are first found on[https://juno.calculquebec.ca/ Juno's Horizon web page].
 
===Use Application Credential===
While you can use your username and password to configure your OpenStack client (see the Get the client rc file below), it is recommended to use application credential to connect to the platform.
 
On the Juno's web page left side menu, '''click Identity >> Application Credentials'''''Italic text'', then click '''Create Application Credentials'''''Italic text''. This pops up a Creation window. You need to set a Name for the credential, all other entries are optional but we also recommend setting an expiration date for the credential. Note that the credentials are always linked to a ''user'' and cannot be a ''project'' credential without any owner.
 
Once you are happy with the Name, click '''Create Application Credential'''''Italic text''. This pups up a window with the credential ID and its secret. You can copy that information, but downloading the <code>clouds.yaml</code> file is more convenient.
 
That file will need some minimal modification to be usable.
 
<div class="filename">'''File :''' clouds.yaml </div>
<syntaxhighlight lang="yaml" file="clouds.yaml">
clouds:
  OpenStack:
    auth:     
      auth_url: https://juno.calculquebec.ca:5000
     
      application_credential_id: <application id>
      application_credential_secret: <application secret>
    region_name: "RegionOne"
    interface: "public"
    identity_api_version: 3
    auth_type: "v3applicationcredential"
</syntaxhighlight>
 
You need to replace the <code>OpenStack</code> key with a unique name <code><cred reference></code>; it could be the project name or the credential name, you pick.
 
The first time you create the credentials, you will need to copy the full file here:
 
<syntaxhighlight lang="bash">
mkdir ~/.config/openstack/
cp clouds.yaml  ~/.config/openstack/
</syntaxhighlight>
 
 
But if you already have credentials in place, only change the <code>OpenStack</code> key with <code><cred reference></code> and copy that whole block in your  <code>~/.config/openstack/cloud.yaml</code> file.
 
 
 
Then the credentials can be used by setting the <code>OS_CLOUD</code> env var in your session or by using the <code>--os-cloud</code> client flag. For example to list all the networks in your project:
 
<syntaxhighlight lang="bash">
export OS_CLOUD=<cred reference>
openstack network list
# or
openstack --os-cloud <cred reference> network list
</syntaxhighlight>
 
 
===Use your Username and Password===


Once the client is install you need to set login credentials. You can get these credentials by connecting to the [https://juno.calculquebec.ca/ Juno web page]. Select the right project to store your data and download the RC file:


[[File:Get openstack rc file.gif|caption|frame|none| the RC file from the Juno website]]
[[File:Get openstack rc file.gif|caption|frame|none| the RC file from the Juno website]]


Lets say that we have saved the files here <code> $HOME/id/myproject-openrc.sh.</code>
Let’s say that we have saved the files here <code> $HOME/id/myproject-openrc.sh.</code>
 
== Test the connection ==


We will test the connection by listing all the images made available on the platform that can be used out of the box to start VMs.  
You can test the connection by listing all the images made available on the platform that can be used out of the box to start VMs.  


<syntaxhighlight lang="bash" line>
<syntaxhighlight lang="bash" line>
$ source  $HOME/id/myproject-openrc.sh
$ source  $HOME/id/myproject-openrc.sh
Please enter your OpenStack Password for project po-test as user poq:  
Please enter your OpenStack Password for project <my-project> as user <my user name>:  
# Use the same password that you used to connect to the [https://juno.calculquebec.ca/ Juno web page].
# Use the same password that you used to connect to the [https://juno.calculquebec.ca/ Juno web page].
# you can now create the credentials
# you can now create the credentials
5

edits

Navigation menu