Programmatic Access and Automation: Difference between revisions

From bwCloud-OS
Jump to navigation Jump to search
Admin (talk | contribs)
Admin (talk | contribs)
Line 1: Line 1:
== Applikations Zugangsdatei erzeugen ==
== create application credential ==
Applikations Zugangsdateien/ Token ermöglichen es Zugang zum Projekt zu vergeben und zu kontrollieren. Hierfür sind entsprechende Berechtigungen als Mitglied im Projekt notwendig.
Application credential/ token allow to gain and controll access to the Project. Therefore, respective privileges as members of the project are required.


=== Token erzeugen: ===
'''Token create:'''


# Login im Dashboard. Indentität -> Applikations-Zugangsdaten
# Dashboard -> Indenty -> Application Credentials
# Applikations-Zugangsdaten erstellen
# Create Application Credentials
# Die geöffnete Form ausfüllen. Z. B.:  Name: token_test_login  Geheimnis: ********************  Ablaufdatum: 12/31/20xx
# Fill out the opened form with name,  secret and expiration date.  
# Applikations-Zugangsdaten erstellen
# Create Application Credentials
# openrc-Datei herunterladen
# Download openrc file
# Datei abspeichern. Z. B. als my_token.sh
# Save file. E. g. as <pre>my_token.sh</pre>
# Das Geheimnis gesichert abspeichern.
# Save the secret protected.
# [Optional] In my_token.sh die Zeil eexportOS_APPLICATION_CREDENTIAL_SECRET=********************ersetzten durch echo "Passphrase: "read -sr os_credential_secret_input export OS_APPLICATION_CREDENTIAL_SECRET="$os_credential_secret_input"
# [Optional]In my_token.sh replace the line <pre> export OS_APPLICATION_CREDENTIAL_SECRET=******************** </pre> by
<pre>
echo "Passphrase: "
read -sr os_credential_secret_input
export OS_APPLICATION_CREDENTIAL_SECRET="$os_credential_secret_input"
</pre>


=== Token Testen ===
=== Token Testen ===
Sourcen Sie die Zugangsdaten my_token.sh.
Source your credential file <pre> my_token.sh </pre>.


<pre>
<pre> source my_token.sh </pre>
source my_token.sh
</pre>


Führen Sie den folgenden Befehl aus. Sie sollten Ihre credential ID sehen.  
Run the following command. You should see your credential ID.


<pre>
<pre>
Line 34: Line 37:


| jq .token.application_credential  
| jq .token.application_credential  
</pre>Sollte der curl Befehl nicht verfügbar sein, installieren Sie das entsprechende Paket mit Ihrem Paketmanager.
</pre>
 
If the curl command is not available, install the corresponding package with your package manager.


== Prepare instance via Ansible ==
== Prepare instance via Ansible ==

Revision as of 11:09, 24 September 2025

create application credential

Application credential/ token allow to gain and controll 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.
  8. [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"

Token Testen

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.

Prepare 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.
Moethod 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.