Skip to content

Commit

Permalink
fix linting errors
Browse files Browse the repository at this point in the history
Signed-off-by: Mario Minners <mario.minners@plusserver.com>
  • Loading branch information
mario-minners committed Apr 11, 2024
1 parent ca0de8b commit 135ccbd
Show file tree
Hide file tree
Showing 6 changed files with 48 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ Die meisten Tools präferieren mittlerweile die clouds.yaml, diese Datei kann je
Die Dateien `clouds.yml`, `clouds-public.yml` und `secure.yml` werden verwendet, um die Anmeldedaten und Authentifizierungsendpunkte einer oder mehrerer OpenStack-Clouds (oder pluscloud open Umgebungen) zu sammeln, mit denen Sie sich verbinden möchten.

Die meisten Tools erwarten diese Dateien in bestimmten Verzeichnisen

1. Aktuelles Arbeitsverzeichnis
2. ${HOME}/.config/openstack/
3. /etc/openstack/
Expand All @@ -61,9 +62,9 @@ Die Verwendung von `clouds.yml` und `clouds-public.yml` ermöglicht es Ihnen, me
#### RC File

Eine weitere Möglichkeit besteht darin, eine OpenRC-Umgebungsdatei von der Horizon-Weboberfläche herunterzuladen. Wenn Sie in Horizon angemeldet sind, klicken Sie auf "`<Ihr Anmeldename>`" in der oberen rechten Ecke und wählen Sie "OpenStack RC File" aus dem Dropdown-Menü und laden es herunter.
Danach setzen Sie die in der Datei enthaltenen Umgebungsvariablen wie folgt:
Danach setzen Sie die in der Datei enthaltenen Umgebungsvariablen wie folgt:

```
```bash
source ./<Ihre openstack rc Datei>-openrc.sh
Bitte geben Sie Ihr OpenStack-Passwort für das Projekt <IhrProjekt> als Benutzer <Ihr Anmeldename> ein
```
Expand All @@ -82,7 +83,6 @@ Die dritte Möglichkeit ist die Verwendung eines Docker-Containers, der alle ben

Für Informationen zur Nutzung des OpenStackClients verweisen wir auf die [upstream documentation](https://docs.openstack.org/python-openstackclient/latest/index.html).


### Terraform Provider und Packer-Builder

Der Terraform Provider für OpenStack ist auf der Terraform Registry Website unter <https://registry.terraform.io/providers/terraform-provider-openstack/openstack/latest/docs> zu finden.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ description: >
Tutorial zur Nutzung von Ansible mit der pluscloud open
---

## Coming soon
## Coming soon
Original file line number Diff line number Diff line change
Expand Up @@ -40,16 +40,16 @@ $ openstack ec2 credentials create
+------------+-----------------------------------------------------------------------------------------------------------------------------------------------------+
```

Ihre Anmeldedaten sehen natürlich anders aus (die oben gezeigten sind verfremdet). Für den S3-Zugang sind nur die Werte "access" und "secret" relevant.
Ihre Anmeldedaten sehen natürlich anders aus (die oben gezeigten sind verfremdet). Für den S3-Zugang sind nur die Werte "access" und "secret" relevant.

### Erstellen eines Buckets

Wenn Sie Ihre S3-Zugangsdaten bereit haben, müssen Sie einen Speicherort für Ihre Daten erstellen. In der S3-Sprache wird dieser Ort als "Bucket" bezeichnet. Sie können einen Bucket entweder über die Web-UI (Horizon) oder über die Befehlszeile erstellen.

#### Horizon/UI

Wenn Sie in der Web-UI (Horizon) eingeloggt sind, können Sie im linken Menü zu "Object Store" navigieren und dann auf "Containers" (so werden die Buckets in Horizon genannt) klicken: ![Screenshot des Container Menüs in Horizon](./container2.png).
Klicken Sie auf die Schaltfläche "+Container" und geben Sie einen Namen für Ihren neuen Container ein. Wählen Sie eine Speicherrichtlinie und legen Sie fest, ob Ihr neuer Bucket öffentlich oder nur privat zugänglich sein soll (in den meisten Fällen privat). Klicken Sie auf "Erstellen", um den neuen Bucket zu erstellen.
Wenn Sie in der Web-UI (Horizon) eingeloggt sind, können Sie im linken Menü zu "Object Store" navigieren und dann auf "Containers" (so werden die Buckets in Horizon genannt) klicken: ![Screenshot des Container Menüs in Horizon](./container2.png).
Klicken Sie auf die Schaltfläche "+Container" und geben Sie einen Namen für Ihren neuen Container ein. Wählen Sie eine Speicherrichtlinie und legen Sie fest, ob Ihr neuer Bucket öffentlich oder nur privat zugänglich sein soll (in den meisten Fällen privat). Klicken Sie auf "Erstellen", um den neuen Bucket zu erstellen.

![Screenshot des Container Erstellungsdialogs in Horizon](./container1.png)

Expand All @@ -60,7 +60,8 @@ Der Bucket sollte sofort in der Container-Liste erscheinen:
#### Openstack CLI

```bash
$ openstack container create <bucketname>
$ → openstack container create <bucketname>
container <bucketname> created
```

#### AWS CLI
Expand All @@ -79,7 +80,7 @@ Installing collected packages: urllib3, jmespath, six, python-dateutil, botocore
Successfully installed PyYAML-5.4.1 awscli-1.27.93 botocore-1.29.93 colorama-0.4.4 docutils-0.16 jmespath-1.0.1 pyasn1-0.4.8 python-dateutil-2.8.2 rsa-4.7.2 s3transfer-0.6.0 six-1.16.0 urllib3-1.26.15
````

Mit dieser Konfiguration können Sie nun Ihren Bucket über die CLI erstellen:
Mit dieser Konfiguration können Sie nun Ihren Bucket über die CLI erstellen:

```bash
(awscli) $ → aws configure --profile=prod1
Expand Down Expand Up @@ -111,11 +112,13 @@ Hashicorp empfiehlt, die Versionierung für den Bucket zu aktivieren, um version

Als erstes exportieren Sie nun Ihren Zugangsschlüssel und Ihren geheimen Schlüssel als Umgebungsvariablen (AWS_ACCESS_KEY_ID bzw. AWS_SECRET_ACCESS_KEY), um zu verhindern, dass diese auf Ihrer lokalen Festplatte gespeichert werden.

export AWS_ACCESS_KEY_ID='5aen4quuuQu8ci7aoceeyaek8oodohgh'
export AWS_SECRET_ACCESS_KEY='iek1aechaequa8pheitahNgeizai3eig'
```bash
export AWS_ACCESS_KEY_ID='5aen4quuuQu8ci7aoceeyaek8oodohgh'
export AWS_SECRET_ACCESS_KEY='iek1aechaequa8pheitahNgeizai3eig'
```

Da sich nun ein Bucket im Object Storage befindet und die Zugangsdaten von Terraform genutzt werden können, kann Terraform so konfiguriert werden, dass es diesen als Backend für den Terraform-Status verwendet.
Bitte fügen Sie diesen Teil der Backend-Konfiguration in Ihren terraform-Code ein:
Bitte fügen Sie diesen Teil der Backend-Konfiguration in Ihren terraform-Code ein:

```go
terraform {
Expand Down Expand Up @@ -161,12 +164,15 @@ terraform {

In ihrem Arbeitsverzeichnis legen sie nun ein Unterverzeichnis an (hier ``env`` genannt) und speichern darin unterschiedliche Konfigurationen des Backends in unterschiedlichen Dateien.

env
├── backend_s3_dev.tfbackend
├── backend_s3_stage.tfbackend
└── backend_s3_prod.tfbackend
```bash
env
├── backend_s3_dev.tfbackend
├── backend_s3_stage.tfbackend
└── backend_s3_prod.tfbackend
```

backend_s3_dev.tfbackend:

```go
key = "dev/terraform.tfstate"
bucket = "mytfstate"
Expand All @@ -177,7 +183,9 @@ skip_credentials_validation = true
skip_metadata_api_check = true
force_path_style = true
```

backend_s3_stage.tfbackend:

```go
key = "stage/terraform.tfstate"
bucket = "mytfstate"
Expand Down Expand Up @@ -217,4 +225,4 @@ use this backend unless the backend configuration changes.
...
$ tform →
```
```
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ Most tools now prefer the clouds.yaml file, which can be split according to pref
Authentication for the OpenStackClient is configured via files in YAML format. `clouds.yml`, `clouds-public.yml` and `secure.yml` are used to collect the credentials and authentication endpoints of one ore more OpenStack clouds (or pluscloud open Regions) you want to connect to.

Most tools expect these files in certain directories

1. Current working directory
2. ${HOME}/.config/openstack/
3. /etc/openstack/
Expand All @@ -63,7 +64,7 @@ Using `clouds.yml` and `clouds-public.yml`, you can specify more than one cloud
Another option is to download an OpenRC environment file from the Horizon web interface. While logged into Horizon you click on "`<your login name>`" in the upper right corner and choose "OpenStack RC File" from the dropdown menu.
Then set the environment variables contained in the file as follows:

```
```bash
source ./<Ihre openstack rc Datei>-openrc.sh
Bitte geben Sie Ihr OpenStack-Passwort für das Projekt <IhrProjekt> als Benutzer <Ihr Anmeldename> ein
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ description: >
Tutorial on using Ansible with the pluscloud open
---

## Coming soon
## Coming soon
Original file line number Diff line number Diff line change
Expand Up @@ -40,16 +40,16 @@ $ openstack ec2 credentials create
+------------+-----------------------------------------------------------------------------------------------------------------------------------------------------+
```

Your login details will of course look different (the ones shown above are distorted). Only the values "access" and "secret" are relevant for S3 access.
Your login details will of course look different (the ones shown above are distorted). Only the values "access" and "secret" are relevant for S3 access.

### Creating a bucket

Once you have your S3 access data ready, you need to create a storage location for your data. In S3 language, this location is called a "bucket". You can create a bucket either via the web UI (Horizon) or via the command line.

#### Horizon/UI

If you are logged in to the web UI (Horizon), you can navigate to "Object Store" in the left menu and then click on "Containers" (this is what the buckets are called in Horizon): ![Screenshot of the container menu in Horizon](./container2.png).
Click on the "+Container" button and enter a name for your new container. Select a storage policy and specify whether your new bucket should be public or only privately accessible (in most cases private). Click on "Create" to create the new bucket.
If you are logged in to the web UI (Horizon), you can navigate to "Object Store" in the left menu and then click on "Containers" (this is what the buckets are called in Horizon): ![Screenshot of the container menu in Horizon](./container2.png).
Click on the "+Container" button and enter a name for your new container. Select a storage policy and specify whether your new bucket should be public or only privately accessible (in most cases private). Click on "Create" to create the new bucket.

![Screenshot of the container creation dialog in Horizon](./container1.png)

Expand All @@ -60,7 +60,8 @@ The bucket should immediately appear in the container list:
#### Openstack CLI

```bash
$ openstack container create <bucketname>
$ → openstack container create <bucketname>
container <bucketname> created
```

#### AWS CLI
Expand Down Expand Up @@ -111,11 +112,13 @@ Hashicorp recommends enabling versioning for the bucket to create versioned copi

First, export your access key and your secret key as environment variables (AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY) to prevent them from being saved on your local hard disk.

export AWS_ACCESS_KEY_ID='5aen4quuuQu8ci7aoceeyaek8oodohgh'
export AWS_SECRET_ACCESS_KEY='iek1aechaequa8pheitahNgeizai3eig'
```bash
export AWS_ACCESS_KEY_ID='5aen4quuuQu8ci7aoceeyaek8oodohgh'
export AWS_SECRET_ACCESS_KEY='iek1aechaequa8pheitahNgeizai3eig'
```

Since there is now a bucket in Object Storage and the access data can be used by Terraform, Terraform can be configured to use it as a backend for the Terraform status.
Please add this part of the backend configuration to your terraform code:
Please add this part of the backend configuration to your terraform code:

```go
terraform {
Expand Down Expand Up @@ -161,12 +164,15 @@ terraform {

Now create a subdirectory in your working directory (called ``env`` here) and save different configurations of the backend in different files.

env
├── backend_s3_dev.tfbackend
├── backend_s3_stage.tfbackend
└── backend_s3_prod.tfbackend
```bash
env
├── backend_s3_dev.tfbackend
├── backend_s3_stage.tfbackend
└── backend_s3_prod.tfbackend
```

backend_s3_dev.tfbackend:

```go
key = "dev/terraform.tfstate"
bucket = "mytfstate"
Expand All @@ -177,7 +183,9 @@ skip_credentials_validation = true
skip_metadata_api_check = true
force_path_style = true
```

backend_s3_stage.tfbackend:

```go
key = "stage/terraform.tfstate"
bucket = "mytfstate"
Expand Down Expand Up @@ -217,4 +225,4 @@ use this backend unless the backend configuration changes.

...
$ tform →
```
```

0 comments on commit 135ccbd

Please sign in to comment.