Skip to content

Commit a64b83a

Browse files
authored
Merge pull request #97 from tinkerbell/DailyAlice-patch-2
Updating format of hardware cli-reference
2 parents 58a1747 + 5af74f5 commit a64b83a

File tree

1 file changed

+187
-56
lines changed

1 file changed

+187
-56
lines changed

content/cli-reference/hardware.md

Lines changed: 187 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -1,93 +1,224 @@
11
+++
22
title = "Hardware"
3-
date = 2019-01-04T16:16:15+05:30
3+
date = 2020-07-01
44
draft = false
55
weight = 10
66
toc = true
77
+++
88

9-
Hardware (worker) data operations.
9+
## Hardware Operations
1010

11-
### Synopsis
11+
```
12+
delete Delete hardware data by ID.
13+
id Get hardware data by ID.
14+
ip Get hardware data by an associated IP Address.
15+
list List the hardware data in the database.
16+
mac Get hardware data by an associated MAC Address.
17+
push Push new hardware data to the database.
18+
watch Watch hardware data for changes.
19+
```
20+
21+
`tink hardware --help` - Displays the available commands and usage for `tink hardware`.
22+
23+
### tink hardware delete
24+
25+
Deletes the specified hardware data.
26+
27+
```
28+
tink hardware delete <ID> [--help] [--facility]
29+
```
30+
31+
**Arguments**
32+
33+
- `ID` - The ID of the hardware data you want to delete from the database. Use multiple IDs to delete more than one hardware data at a time.
34+
35+
**Options**
36+
37+
- `-h`, `--help` - Displays usage for `delete`.
38+
- `-f`, `--facility` - string used to build grpc and http urls
39+
40+
**Examples**
41+
42+
```
43+
tink hardware delete 0eba0bf8-3772-4b4a-ab9f-6ebe93b90a25
44+
>
45+
2020/07/01 15:01:04 Hardware data with id 0eba0bf8-3772-4b4a-ab9f-6ebe93b90a25 deleted successfully
46+
```
47+
48+
### tink hardware id
49+
50+
Returns hardware data for the specified ID or IDs as JSON objects.
51+
52+
```
53+
tink hardware id <ID> [--help] [--facility]
54+
```
55+
56+
**Arguments**
57+
58+
- `ID` - The ID of the hardware data you want to retrieve from the database. Use multiple IDs to retrieve more than one hardware data at a time.
59+
60+
**Options**
61+
62+
- `-h`, `--help` - Displays usage for `id`.
63+
- `-f`, `--facility` - string used to build grpc and http urls
64+
65+
**Examples**
66+
67+
```
68+
tink hardware id 0eba0bf8-3772-4b4a-ab9f-6ebe93b90a94
69+
>
70+
{"metadata":{"instance":{},"facility":{"facility_code":"onprem"}},"network":{"interfaces":[{"dhcp":{"mac":"08:00:27:00:00:01","arch":"x86_64","ip":{"address":"192.168.1.5","netmask":"255.255.255.248","gateway":"192.168.1.1"}},"netboot":{"allow_pxe":true,"allow_workflow":true}}]},"id":"0eba0bf8-3772-4b4a-ab9f-6ebe93b90a94"}
71+
```
72+
73+
### tink hardware ip
74+
75+
Returns hardware data for the specified IP Address or IP Addresses as JSON objects.
76+
77+
```
78+
tink hardware id <IP> [--details] [--help] [--facility]
79+
```
80+
81+
**Arguments**
82+
83+
- `IP` - The IP address of the hardware data you want to retrieve from the database. Use multiple IP addresses to retrieve more than one hardware data at a time.
84+
85+
**Options**
86+
87+
- `-d`, `--details` - Displays the entire hardware data JSON for the specified IP address.
88+
- `-h`, `--help` - Displays usage for `ip`.
89+
- `-f`, `--facility` - string used to build grpc and http urls
90+
91+
**Examples**
1292

13-
Hardware operations:
93+
```
94+
tink hardware ip --details 192.168.1.5
95+
>
96+
{"metadata":{"instance":{},"facility":{"facility_code":"onprem"}},"network":{"interfaces":[{"dhcp":{"mac":"08:00:27:00:00:01","arch":"x86_64","ip":{"address":"192.168.1.5","netmask":"255.255.255.248","gateway":"192.168.1.1"}},"netboot":{"allow_pxe":true,"allow_workflow":true}}]},"id":"0eba0bf8-3772-4b4a-ab9f-6ebe93b90a94"}
97+
```
98+
99+
### tink hardware list
100+
101+
Returns a list of all the hardware data that is currently stored in the database.
102+
103+
```
104+
tink hardware list
105+
```
106+
107+
**Options**
108+
109+
- `-h`, `--help` - Displays usage for `list`.
110+
- `-f`, `--facility` - string used to build grpc and http urls
111+
112+
**Examples**
14113

15114
```
16-
all Get all known hardware for facility
17-
id Get hardware by id
18-
ingest Trigger tinkerbell to ingest
19-
ip Get hardware by any associated ip
20-
mac Get hardware by any associated mac
21-
push Push new hardware to tinkerbell
22-
watch Register to watch an id for any changes
115+
tink hardware list
116+
>
117+
+--------------------------------------+-------------------+-------------+-----------+
118+
| ID | MAC ADDRESS | IP ADDRESS | HOSTNAME |
119+
+--------------------------------------+-------------------+-------------+-----------+
120+
| f9f56dff-098a-4c5f-a51c-19ad35de85d2 | 98:03:9b:89:d7:da | 192.168.1.4 | localhost |
121+
| f9f56dff-098a-4c5f-a51c-19ad35de85d1 | 98:03:9b:89:d7:ba | 192.168.1.5 | worker_1 |
122+
+--------------------------------------+-------------------+-------------+-----------+
23123
```
24124

25-
### Options
125+
### tink hardware mac
126+
127+
Returns hardware data for the specified MAC Address or MAC Addresses as JSON objects.
26128

27129
```
28-
-h, --help help for hardware
130+
tink hardware mac <MAC> [--details] [--help] [--facility]
29131
```
30132

31-
### Examples
133+
**Arguments**
134+
135+
- `MAC` - The MAC address of the hardware data you want to retrieve from the database. Use multiple MAC addresses to retrieve more than one hardware data at a time.
136+
137+
**Options**
32138

33-
Consider a file `data.json` that contains the following hardware data for a worker machine to be part of a workflow:
139+
- `-d`, `--details` - Displays the entire hardware data JSON for the specified MAC address.
140+
- `-h`, `--help` - Displays usage for `mac`.
141+
- `-f`, `--facility` - string used to build grpc and http urls
142+
143+
**Examples**
34144

35145
```
36-
{
37-
"id": "0eba0bf8-3772-4b4a-ab9f-6ebe93b90a94",
38-
"metadata": {
39-
"facility": {
40-
"facility_code": "ewr1",
41-
"plan_slug": "c2.medium.x86",
42-
"plan_version_slug": ""
43-
},
44-
"instance": {},
45-
"state": ""
46-
},
47-
"network": {
48-
"interfaces": [
49-
{
50-
"dhcp": {
51-
"arch": "x86_64",
52-
"ip": {
53-
"address": "192.168.1.5",
54-
"gateway": "192.168.1.1",
55-
"netmask": "255.255.255.248"
56-
},
57-
"mac": "00:00:00:00:00:00",
58-
"uefi": false
59-
},
60-
"netboot": {
61-
"allow_pxe": true,
62-
"allow_workflow": true
63-
}
64-
}
65-
]
66-
}
67-
}
146+
tink hardware mac --details 08:00:27:00:00:01
147+
>
148+
{"metadata":{"instance":{},"facility":{"facility_code":"onprem"}},"network":{"interfaces":[{"dhcp":{"mac":"08:00:27:00:00:01","arch":"x86_64","ip":{"address":"192.168.1.5","netmask":"255.255.255.248","gateway":"192.168.1.1"}},"netboot":{"allow_pxe":true,"allow_workflow":true}}]},"id":"0eba0bf8-3772-4b4a-ab9f-6ebe93b90a94"
68149
```
69150

70-
- Push the data with either of the following:
151+
### tink hardware push
152+
153+
Pushes the JSON-formatted hardware data from the specified file into the database.
71154

72155
```
73-
$ tink hardware push --file data.json
74-
$ cat data.json | tink hardware push
156+
tink hardware push --file <JSON_FILE> [--help] [--facility]
75157
```
76158

77-
- Get hardware data using ID:
159+
Or
78160

79161
```
80-
$ tink hardware id ce2e62ed-826f-4485-a39f-a82bb74338e2
162+
cat <JSON_FILE> | tink hardware push
81163
```
82164

83-
- Get hardware data using MAC address:
165+
Or
84166

85167
```
86-
$ tink hardware mac 00:00:00:00:00:00
168+
tink hardware push < ./<JSON_FILE>
87169
```
88170

89-
- Get hardware data using IP address:
171+
**Arguments**
90172

173+
- `JSON_FILE` - The file where the hardware data is defined in JSON format.
174+
175+
**Options**
176+
177+
- `--file`, `< ./<JSON_FILE>`, `cat <JSON_FILE>` - Specify the file containing the hardware data JSON. Alternatively, you can open and read the file instead.
178+
- `-h`, `--help` - Displays usage for `push`.
179+
- `-f`, `--facility` - string used to build grpc and http urls
180+
181+
**Examples**
182+
183+
```
184+
tink hardware push --file data.json
185+
>
186+
2020/07/01 20:11:24 Hardware data pushed successfully
91187
```
92-
$ tink hardware ip 192.168.1.5
188+
189+
```
190+
cat data.json | tink hardware push
191+
>
192+
2020/07/01 20:14:18 Hardware data pushed successfully
193+
```
194+
195+
```
196+
tink hardware push < ./data.json
197+
>
198+
2020/07/01 20:11:24 Hardware data pushed successfully
199+
```
200+
201+
### tink hardware watch
202+
203+
Watch the specified hardware data for changes.
204+
205+
```
206+
tink hardware watch <ID or IDs> [--help] [--facility]
207+
```
208+
209+
**Arguments**
210+
211+
- `ID` - The ID of the hardware data you want to monitor for changes. Use multiple IDs to watch more than one hardware data.
212+
213+
**Options**
214+
215+
- `-h`, `--help` - Displays usage for `watch`.
216+
- `-f`, `--facility` - string used to build grpc and http urls
217+
218+
**Examples**
219+
220+
```
221+
tink hardware watch 0eba0bf8-3772-4b4a-ab9f-6ebe93b90a94
222+
>
223+
93224
```

0 commit comments

Comments
 (0)