An open API service indexing awesome lists of open source software.

https://github.com/mchlumsky/mracek

Command line tool to manage your OpenStack configuration files
https://github.com/mchlumsky/mracek

cli golang openstack

Last synced: 3 months ago
JSON representation

Command line tool to manage your OpenStack configuration files

Awesome Lists containing this project

README

          

# mracek

[![Release](https://img.shields.io/github/release/mchlumsky/mracek.svg)](https://github.com/mchlumsky/mracek/releases/latest)
[![codecov](https://codecov.io/gh/mchlumsky/mracek/branch/main/graph/badge.svg?token=YHCWIP3V43)](https://codecov.io/gh/mchlumsky/mracek)
[![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg)](/LICENSE.md)
[![Build status](https://img.shields.io/github/actions/workflow/status/mchlumsky/mracek/build.yml?branch=main)](https://github.com/mchlumsky/mracek/actions?workflow=build)
[![Powered By: GoReleaser](https://img.shields.io/badge/powered%20by-goreleaser-green.svg)](https://github.com/goreleaser)
[![BuyMeACoffee](https://raw.githubusercontent.com/pachadotdev/buymeacoffee-badges/main/bmc-donate-yellow.svg)](https://www.buymeacoffee.com/martinchlumsky)

mracek is a CLI tool to manage your OpenStack [configuration files](https://docs.openstack.org/os-client-config/latest/user/configuration.html#config-files).

mracek is inspired by [kubectx/kubens](https://github.com/ahmetb/kubectx).

## Features

* Create/delete/modify/copy clouds and profiles in your `$HOME/.config/openstack` configuration.
* Switch to a desired openstack cloud simply with `mracek `.
* mracek supports auto-completion under bash, fish and zsh shells.
* mracek is opinionated about where it puts secrets (passwords, application credential secrets) and always puts them in secrets.yaml
* The directory where the openstack config files are stored is configurable (defaults to `$HOME/.config/openstack/`). See configuration section below.
* By setting the shell variable `OS_CLOUD`, mracek is compatible with [starship](https://starship.rs/).

## Demo

### Smoke tests

## Examples
```shell
# Create a cloud
$ mracek create-cloud --username user1 --password very_secure --verify --auth-url https://cloud1.example.com:5000/v3 --project-name project1 --domain-name domain1 --region-name region1 cloud1

# Show cloud details
$ mracek show-cloud cloud1
---
auth:
auth_url: https://cloud1.example.com:5000/v3
username: user1
password:
project_name: project1
domain_name: domain1
region_name: region1
verify: true

# Create a profile (a profile is a cloud stored in clouds-public.yaml)
$ mracek create-profile --username user1 --password very_secure --verify --auth-url https://cloud1.example.com:5000/v3 --project-name project1 --domain-name domain1 --region-name region1 profile1

# Show profile details
$ mracek show-profile profile1
---
auth:
auth_url: https://cloud1.example.com:5000/v3
username: user1
password:
project_name: project1
domain_name: domain1
region_name: region1
verify: true

# List profiles
$ mracek list-profiles
profile1

# Use a cloud (exports the OS_CLOUD environment variable and launches a sub-shell)
$ mracek cloud1
Switching to cloud cloud1
$ env|grep ^OS_
OS_CLOUD=cloud1

# Delete a cloud
$ mracek delete-cloud cloud1

# Delete a profile
$ mracek delete-profile profile1

# Set cloud details
$ mracek set-cloud --project-name project1 cloud1

# Set profile details
$ mracek set-profile --project-name project1 profile1

# Copy cloud while changing the project name
$ mracek copy-cloud --project-name new-project source-cloud destination-cloud

# Smoke tests are basic tests, basically mracek just lists resources from several services (servers for nova, networks for neutron, etc...)
# Run smoke tests against a specific cloud
$ mracek smoke-tests some-cloud

# Run smoke tests against all regions in parallel
$ mracek smoke-tests
```

## Installation

### YUM/DNF repository (Fedora, CentOS, etc...)

To enable, add the following file /etc/yum.repos.d/mchlumsky.repo:

```
[mchlumsky]
name=mchlumsky repository (mracek, etc...)
baseurl=https://yum.fury.io/mchlumsky/
enabled=1
gpgcheck=0
```

and

```shell
dnf install mracek
# or
yum install mracek
```
### APT/DEB repository (Debian, Ubuntu, etc...)

To enable, add the following file /etc/apt/sources.list.d/mchlumsky.list:

```
deb [trusted=yes] https://apt.fury.io/mchlumsky/ /
```

and

```shell
apt update
apt install mracek
```

### Zypper repository (OpenSUSE)

To enable, run the following command:

```shell
zypper addrepo --no-gpgcheck https://yum.fury.io/mchlumsky/ mchlumsky
zypper install mracek
```

### Binary Releases

Download and install a prebuilt release from [here](https://github.com/mchlumsky/mracek/releases)

### From source

Install from source:

```shell
go install github.com/mchlumsky/mracek@latest
```

## Configuration

mracek supports configuration through the configuration file `$HOME/.mracek.yaml` by default and can be changed with the `--config` command line flag.

Example:
```yaml
---
# Can be overridden by environment variable MRACEK_OS_CONFIG_DIR
os-config-dir: /path/to/openstack/config

# Can be overridden by environment variable MRACEK_SHELL
shell: /usr/bin/zsh

# Only export the OS_CLOUD variable when calling `mracek `
os-cloud-only: true
```

## Acknowledgements

Special thanks to JetBrains for the Open Source development license.