|
|
c14d2e |
# SOP to create Duffy tenant
|
|
|
c14d2e |
This SOP covers the process of how to create a duffy tenant
|
|
|
c14d2e |
|
|
|
c14d2e |
## Steps
|
|
|
c14d2e |
1. Connect to duffy.ci.centos.org
|
|
|
c14d2e |
```shell
|
|
|
c14d2e |
ssh duffy.ci.centos.org
|
|
|
c14d2e |
```
|
|
|
c14d2e |
|
|
|
c14d2e |
2. Change to duffy user
|
|
|
c14d2e |
```shell
|
|
|
c14d2e |
sudo su - duffy
|
|
|
c14d2e |
```
|
|
|
c14d2e |
|
|
|
c14d2e |
3. Create tenant with the command below and save api key somewhere safe, it outputs the key as `<tenant name>: <API key>`
|
|
|
c14d2e |
```shell
|
|
|
c14d2e |
duffy admin create-tenant <tenant name> <ssh pub-key>
|
|
|
c14d2e |
```
|
|
|
c14d2e |
|
|
|
c14d2e |
4. Connect to the host that will have duffy client
|
|
|
c14d2e |
```shell
|
|
|
c14d2e |
ssh <host user>@<target host>
|
|
|
c14d2e |
```
|
|
|
c14d2e |
|
|
|
c14d2e |
5. Install duffy client using `pip`
|
|
|
c14d2e |
```shell
|
|
|
c14d2e |
pip3.8 install --user duffy[client]
|
|
|
c14d2e |
```
|
|
|
c14d2e |
|
|
|
c14d2e |
6. In the home path of the user, create `.config` directory if it doesn’t exist and create `.config/duffy` with the following content
|
|
|
c14d2e |
```
|
|
|
c14d2e |
client:
|
|
|
c14d2e |
url: https://duffy.ci.centos.org/api/v1
|
|
|
c14d2e |
auth:
|
|
|
c14d2e |
name: <tenant name>
|
|
|
c14d2e |
key: <API key>
|
|
|
c14d2e |
```
|
|
|
c14d2e |
|
|
|
c14d2e |
7. To create a session, the name of the pool is required. Check the pool available executing the command **_(Optional)_**
|
|
|
c14d2e |
```shell
|
|
|
c14d2e |
duffy client list-pools
|
|
|
c14d2e |
```
|
|
|
c14d2e |
|
|
|
c14d2e |
8. Request a session
|
|
|
c14d2e |
```shell
|
|
|
c14d2e |
duffy client request-session pool=<name of the pool>,quantity=<number of sessions wanted>
|
|
|
c14d2e |
```
|
|
|
c14d2e |
|
|
|
c14d2e |
By default this command outputs a _json_, but it's possible to change the format to _yaml_ or _flat_ using `--format`. Under "node" key it's possible to find the hostname to be used. Log in to it as `root` user, using `ssh`.
|
|
|
c14d2e |
|
|
|
c14d2e |
```json
|
|
|
c14d2e |
{
|
|
|
c14d2e |
...output ommited...
|
|
|
c14d2e |
|
|
|
c14d2e |
"nodes": [
|
|
|
c14d2e |
{
|
|
|
c14d2e |
"hostname": "<hostname>.ci.centos.org",
|
|
|
c14d2e |
"ipaddr": "<ip address>",
|
|
|
c14d2e |
|
|
|
c14d2e |
...output ommited...
|
|
|
c14d2e |
}
|
|
|
c14d2e |
```
|
|
|
c14d2e |
|
|
|
c14d2e |
9. When needed to retire the session, connect to your duffy client host and execute the command
|
|
|
c14d2e |
```shell
|
|
|
c14d2e |
duffy client retire-session <session id>
|
|
|
c14d2e |
```
|
|
|
c14d2e |
|
|
|
c14d2e |
It's possible to check the session id either when the session is requested, in the output under "session" key, or using the following command:
|
|
|
c14d2e |
```shell
|
|
|
c14d2e |
duffy client list-sessions
|
|
|
c14d2e |
```
|