Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/nl2go/hrobot-cli
A command-line interface for Hetzner Robot https://robot.your-server.de/
https://github.com/nl2go/hrobot-cli
go golang hetzner hetzner-robot-api
Last synced: about 1 month ago
JSON representation
A command-line interface for Hetzner Robot https://robot.your-server.de/
- Host: GitHub
- URL: https://github.com/nl2go/hrobot-cli
- Owner: nl2go
- License: mit
- Created: 2019-11-18T08:09:39.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2021-04-13T16:37:42.000Z (over 3 years ago)
- Last Synced: 2024-06-19T18:08:47.143Z (6 months ago)
- Topics: go, golang, hetzner, hetzner-robot-api
- Language: Go
- Size: 83 KB
- Stars: 9
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# hrobot-cli: Command-line interface for Hetzner Robot Webservice
![Build](https://gitlab.com/newsletter2go/hrobot-cli/badges/master/pipeline.svg) ![Coverage](https://gitlab.com/newsletter2go/hrobot-cli/badges/master/coverage.svg)
`hrobot-cli` is a command-line interface for interacting with the [Hetzner Robot API](https://robot.your-server.de/doc/webservice/en.html).
## Set environment variables for robot webservice credentials
`hrobot-cli` use environment variables for authenticating with the Hetzner Robot. It is
recommended to use an env file similar to `sample.env` which can be used in the local environment as
well as with the docker container. The expected variables are
* HROBOTCLI_USER
* HROBOTCLI_PASSWORD## Build manually and run on local machine
If you have Go installed, you can build `hrobot-cli` with:
go build
and run it with:
export $(cat sample.env | xargs) # or set the expected environemnt variables in any other way
./hrobot-cli## Build and run in docker
The project contains a Dockerfile which will build a container with the binary by running:
docker build --rm -f "Dockerfile" -t hrobot-cli:latest .
Afterwards you can run it with:
docker run -it --env-file=sample.env hrobot-cli:latest
## Run latest version in docker using pre-built docker image
Run latest version from docker registry:
docker run -it --env-file=sample.env registry.github.com/nl2go/hrobot-cli:v0-1-1
## Update hrobot-go mocks
This project uses `gomock`. When the hrobot-go library is upgraded to a new version, the mocks used
for the tests need to be updated. This can be done by running the following command:mockgen -package mock github.com/nl2go/hrobot-go RobotClient > test/mock/mock_robot_client.go
## Features & overview
Currently implemented commands are:
```
CLI application for the Hetzner Robot API - version 0.1.1Usage:
hrobot-cli [command]Available Commands:
help Help about any command
ip:list Print list of IP's
key:list Print list of ssh keys
rdns:get Print single reverse DNS entry
rdns:list Print list of reverse DNS entries
server:ansible-inv Generates ansible inventory from server list
server:get Print single server
server:list Print list of servers
server:rescue Activate rescue mode for single server
server:reset Reset single server (hardware reset)
server:reverse Revert single server order
server:set-name Sets name for selected servers
version Print the version number of hrobot-cliFlags:
-h, --help help for hrobot-cliUse "hrobot-cli [command] --help" for more information about a command.
```For commands that are applied to a single server it is possible to select the server interactively
by searching through the server list. For other commands (like server renaming) multiple items can
be selected for executing the respective command.