Programmatic Access and Automation: Difference between revisions

From bwCloud-OS
Jump to navigation Jump to search
No edit summary
No edit summary
Line 8: Line 8:
__TOC__
__TOC__


= How can I create an application credential? =
= Application Credentials =
<span id="Application-Credential"></span>


== Create Application Credential ==
== How can I create an application credential? ==
Application credential/ token allow to gain and control access to the Project. Therefore, respective privileges as members of the project are required.
Application credential/ token allow to gain and control access to the Project. Therefore, respective privileges as members of the project are required.


Line 24: Line 23:
# Save the secret protected. <br>  
# Save the secret protected. <br>  


<br>'''Optional:'''  
'''Optional:'''  
In my_token.sh replace the line <code> export OS_APPLICATION_CREDENTIAL_SECRET=******************** </code> by  
In my_token.sh replace the line <code> export OS_APPLICATION_CREDENTIAL_SECRET=******************** </code> by  
<pre>
<pre>
Line 32: Line 31:
</pre>
</pre>


== Test Token ==
=== Test Token ===
Source your credential file ''my_token.sh''  
Source your credential file ''my_token.sh''  


Line 55: Line 54:
If the curl command is not available, install the corresponding package with your package manager.
If the curl command is not available, install the corresponding package with your package manager.


= OpenStack Client =


 
== How can I connect to the bwCloud-OS via CLI/OpenStack client? ==
= How can I connect to the bwCloud-OS via CLI/OpenStack client? =  
<span id="OpenStack-Client"></span>
<span id="OpenStack-Client"></span>


Line 63: Line 62:


There are two ways to do that:
There are two ways to do that:
== Via Tokens (recommended) ==
 
=== Via Tokens (recommended) ===
# Log in to the dashboard.   
# Log in to the dashboard.   
# Create a Token as described here. Save this file on your device (for example as <code>my_creds.sh</code>).   
# Create a Token as described here. Save this file on your device (for example as <code>my_creds.sh</code>).   
Line 73: Line 73:
</pre>
</pre>


== Via Login-Password ==
=== Via Login-Password ===
# Log in to the dashboard.   
# Log in to the dashboard.   
# In the upper right corner, you will find the **OpenStack RC File** option, which provides you with a file containing your bwCloud credentials / access parameters. Save this file on your device (for example as <code>my_creds.sh</code>).   
# In the upper right corner, you will find the **OpenStack RC File** option, which provides you with a file containing your bwCloud credentials / access parameters. Save this file on your device (for example as <code>my_creds.sh</code>).   
Line 85: Line 85:
You should now see all your servers.
You should now see all your servers.


= Prepare an Instance via Ansible =
= Automation =
 
== Prepare an Instance via Ansible ==
<span id="Ansible"></span>
<span id="Ansible"></span>



Revision as of 15:50, 19 October 2025

In a Nutshell
  • Experienced users can create Application Credentials (tokens) to enable CLI or programmatic access.
  • Automation tools like Ansible or Terraform can be used to streamline instance deployment and configuration.


Application Credentials

How can I create an application credential?

Application credential/ token allow to gain and control access to the Project. Therefore, respective privileges as members of the project are required.

Token create:

  1. Dashboard -> Indenty -> Application Credentials
  2. Create Application Credentials
  3. Fill out the opened form with name, secret and expiration date.
  4. Create Application Credentials
  5. Download openrc file
  6. Save file. E. g. as my_token.sh
  7. Save the secret protected.

Optional: In my_token.sh replace the line export OS_APPLICATION_CREDENTIAL_SECRET=******************** by

echo "Passphrase: "
read  -sr os_credential_secret_input
export OS_APPLICATION_CREDENTIAL_SECRET="$os_credential_secret_input"

Test Token

Source your credential file my_token.sh

 source my_token.sh 

Run the following command. You should see your credential ID.

curl \

-s \

-H "Content-Type: application/json" \

-d '{ "auth": { "identity": { "methods": ["application_credential"], "application_credential": { "id": "'${OS_APPLICATION_CREDENTIAL_ID}'", "secret": "'${OS_APPLICATION_CREDENTIAL_SECRET}'" }}}}' \

"${OS_AUTH_URL}/auth/tokens" \

| jq .token.application_credential 

If the curl command is not available, install the corresponding package with your package manager.

OpenStack Client

How can I connect to the bwCloud-OS via CLI/OpenStack client?

The following describes how to connect using the python-openstackclient.

There are two ways to do that:

Via Tokens (recommended)

  1. Log in to the dashboard.
  2. Create a Token as described here. Save this file on your device (for example as my_creds.sh).
  3. Now run the following commands in a terminal:
# source ./my_creds.sh
# openstack server list

Via Login-Password

  1. Log in to the dashboard.
  2. In the upper right corner, you will find the **OpenStack RC File** option, which provides you with a file containing your bwCloud credentials / access parameters. Save this file on your device (for example as my_creds.sh).
  3. Now run the following commands in a terminal:
# source ./my_creds.sh
# openstack server list

You should now see all your servers.

Automation

Prepare an Instance via Ansible

To control and customize your default instance, you can use automated methods.

  • Create an access token/application credential as defined below.
  • Tried and tested methods for automation are listed below. Use the Ansible template specified there. Follow the steps described there.
Method Usage
Terraform This tool can be used to create an instance or a defined infrastructure.
Ansible Create roles or tasks for all customizations that you make in an instance. For an easier start, you can use our template.