Skip to content

Commit 7ce7649

Browse files
author
Anthony House
committed
Correct docs
Signed-off-by: Anthony House <anthony.house@networktocode.com>
1 parent db95017 commit 7ce7649

File tree

1 file changed

+123
-121
lines changed

1 file changed

+123
-121
lines changed

docs/inventory.md

Lines changed: 123 additions & 121 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
The inventory file that the poller uses describes a set of sources used to gather the list of devices, credentials to authenticate in the devices, default settings and eventually puts all together defining namespaces. An extensive explanation of each secation is provided on this page.
44

55
!!! warning
6-
Starting with version 0.16.0 the old options `-D` and `-a` and the old inventory format are no longer supported.
7-
See the section [Migrating to the new format](#migrating-to-new-format).
6+
Starting with version 0.16.0 the old options `-D` and `-a` and the old inventory format are no longer supported.
7+
See the section [Migrating to the new format](#migrating-to-new-format).
88

99
The new inventory is structured in 4 major pieces, explained in its own section:
1010

@@ -17,68 +17,68 @@ Here is an example of an inventory file with a bunch of different options, but n
1717

1818
```yaml
1919
sources:
20-
- name: netbox-instance-123
21-
token: af8717c89ec0ff420c19d89e6c20646ad55dd54e
22-
url: http://127.0.0.1:8000
23-
tag:
24-
- suzieq-demo
25-
type: netbox
26-
period: 3600
20+
- name: netbox-instance-123
21+
token: af8717c89ec0ff420c19d89e6c20646ad55dd54e
22+
url: http://127.0.0.1:8000
23+
tag:
24+
- suzieq-demo
25+
type: netbox
26+
period: 3600
2727

28-
- name: dc-02-suzieq-native
29-
hosts:
30-
- url: ssh://vagrant@10.0.0.1:22 keyfile=/path/to/private_key
31-
- url: https://vagrant@10.0.0.2:22 devtype=eos
28+
- name: dc-02-suzieq-native
29+
hosts:
30+
- url: ssh://vagrant@10.0.0.1:22 keyfile=/path/to/private_key
31+
- url: https://vagrant@10.0.0.2:22 devtype=eos
3232

33-
- name: ansible-01
34-
type: ansible
35-
path: /path/to/ansible/list
33+
- name: ansible-01
34+
type: ansible
35+
path: /path/to/ansible/list
3636

3737
devices:
38-
- name: devices-without-jump-hosts
39-
ignore-known-hosts: true
38+
- name: devices-without-jump-hosts
39+
ignore-known-hosts: true
4040

41-
- name: devices-with-jump-hosts
42-
transport: ssh
43-
jump-host: username@127.0.0.1
44-
jump-host-key-file: /path/to/jump/key
45-
ignore-known-hosts: true
46-
port: 22
41+
- name: devices-with-jump-hosts
42+
transport: ssh
43+
jump-host: username@127.0.0.1
44+
jump-host-key-file: /path/to/jump/key
45+
ignore-known-hosts: true
46+
port: 22
4747

48-
- name: devices-using-rest
49-
transport: https
50-
devtype: eos
48+
- name: devices-using-rest
49+
transport: https
50+
devtype: eos
5151

5252
auths:
53-
- name: credentials-from-file-0
54-
type: cred-file
55-
path: /path/to/device/credentials.yaml
53+
- name: credentials-from-file-0
54+
type: cred-file
55+
path: /path/to/device/credentials.yaml
5656

57-
- name: suzieq-user-01
58-
username: suzieq
59-
password: plain:pass
57+
- name: suzieq-user-01
58+
username: suzieq
59+
password: plain:pass
6060

61-
- name: suzieq-user-02
62-
username: suzieq
63-
password: env:PASSWORD_ENV_VAR
61+
- name: suzieq-user-02
62+
username: suzieq
63+
password: env:PASSWORD_ENV_VAR
6464

65-
- name: suzieq-user-03
66-
username: suzieq
67-
password: ask
65+
- name: suzieq-user-03
66+
username: suzieq
67+
password: ask
6868

69-
- name: suzieq-user-04
70-
key-passphrase: ask
71-
keyfile: path/to/key
69+
- name: suzieq-user-04
70+
key-passphrase: ask
71+
keyfile: path/to/key
7272

7373
namespaces:
74-
- name: testing
75-
source: netbox-instance-123
76-
device: devices-with-jump-hosts
77-
auth: credentials-from-file-0
74+
- name: testing
75+
source: netbox-instance-123
76+
device: devices-with-jump-hosts
77+
auth: credentials-from-file-0
7878
```
7979
8080
!!! warning
81-
Some observations on the YAML file above:
81+
Some observations on the YAML file above:
8282
8383
- **This is just an example** that covers all the possible combinations, **not an real life inventory**
8484
- **Do not specify device type unless you're using REST**. SuzieQ automatically determines device type with SSH
@@ -102,7 +102,7 @@ Currently this method is used to specify passwords, passphrases and tokens.
102102
The device sources currently supported are:
103103

104104
- Host list (the same used with the old option `-D` in SuzieQ 0.15.x or lower)
105-
- Ansible inventory, specifing a path to a file that has to be the output of `ansible-inventory --list` command
105+
- Ansible inventory, specifing a path to a file that has to be the output of ```ansible-inventory --list``` command
106106
- Netbox
107107
- Nautobot
108108

@@ -116,13 +116,14 @@ Whenever a source has many fields in common with another, you don't have to rewr
116116
token: your-api-token-here
117117
url: http://127.0.0.1:8000
118118
tag:
119-
- suzieq-demo
119+
- suzieq-demo
120120
period: 3600
121121
122-
- name: netbox-copy # This source will use the same set of parameters of 'netbox-orig'
123-
copy: netbox-orig # and only overrides the 'tag' field.
122+
- name: netbox-copy # This source will use the same set of parameters of 'netbox-orig'
123+
copy: netbox-orig # and only overrides the 'tag' field.
124124
tag:
125-
- suzieq-copy
125+
- suzieq-copy
126+
126127
```
127128

128129
### <a name='source-host-list'></a>Host list
@@ -146,7 +147,7 @@ There's a template in the docs directory called `hosts-template.yml`. You can co
146147

147148
### <a name='source-ansible'></a>Ansible
148149

149-
If you are using Ansible to configure the devices, it is possible to set the output of the `ansible-inventory --list` command as an input source.
150+
If you are using Ansible to configure the devices, it is possible to set the output of the ```ansible-inventory --list``` command as an input source.
150151
Once you created a json file containing the result of the command, with:
151152

152153
```shell
@@ -161,9 +162,9 @@ Now you can set the path of the ansible inventory in the source:
161162
path: /path/to/ansible.json
162163
```
163164

164-
Since Ansible devices cannot really be split up, the device and auth sections apply to **all** the devices in the Ansible inventory file. This is a limitaion of the Ansible source input. We always assume ssh as the transport unless otherwise specified in the device section of the SuzieQ inventory file.
165+
Since Ansible devices cannot really be split up, the device and auth sections apply to **all** the devices in the Ansible inventory file. This is a limitaion of the Ansible source input. We always assume ssh as the transport unless otherwise specified in the device section of the SuzieQ inventory file.
165166
!!! info
166-
From 0.21.0, with Ansible inventories, the device type and transport are taken from the specification in the device section of the suzieq inventory file. You must specify the transport as rest if you want to use rest as the transport for EOS devices. By default, we assume ssh as the transport. For PANOS also, you must specify the device type and transport. Before version 0.21.0, Ansible inventory assumed REST as the transport for EOS, even if the user specified the transport as SSH in the device section.
167+
From 0.21.0, with Ansible inventories, the device type and transport are taken from the specification in the device section of the suzieq inventory file. You must specify the transport as rest if you want to use rest as the transport for EOS devices. By default, we assume ssh as the transport. For PANOS also, you must specify the device type and transport. Before version 0.21.0, Ansible inventory assumed REST as the transport for EOS, even if the user specified the transport as SSH in the device section.
167168

168169
### <a name='source-netbox'></a>Netbox
169170

@@ -175,9 +176,9 @@ The token is considered a [sensitive data](#sensitive-data), so it can be specif
175176
Since Netbox is a _dynamic source_, the data are periodically pulled, the period can be set to any desired number in seconds (default is 3600).
176177

177178
!!!Info
178-
Each netbox source contains a parameter called `ssl-verify`.
179-
This parameter is used to specify whether perform ssl certificate verify or not. By default `ssl-verify` is set to _true_ if the url contains an https host.
180-
If the user manually sets `ssl-verify: true` with an http netbox server, an error will be notified.
179+
Each netbox source contains a parameter called `ssl-verify`.
180+
This parameter is used to specify whether perform ssl certificate verify or not. By default `ssl-verify` is set to _true_ if the url contains an https host.
181+
If the user manually sets `ssl-verify: true` with an http netbox server, an error will be notified.
181182

182183
Here is an example of the configuration of a netbox type source:
183184

@@ -186,10 +187,10 @@ Here is an example of the configuration of a netbox type source:
186187
type: netbox
187188
token: your-api-token-here
188189
url: https://127.0.0.1:8000
189-
tag: # if not present, default is "suzieq"
190-
- suzieq-demo
191-
period: 3600 # How frequently Netbox should be polled
192-
ssl-verify: false # Netbox certificate validation will be skipped
190+
tag: # if not present, default is "suzieq"
191+
- suzieq-demo
192+
period: 3600 # How frequently Netbox should be polled
193+
ssl-verify: false # Netbox certificate validation will be skipped
193194
```
194195

195196
#### Selecting devices from Netbox
@@ -204,15 +205,15 @@ A device is polled by SuzieQ if it matches at least one of the defined rules.
204205
token: your-api-token-here
205206
url: https://127.0.0.1:8000
206207
tag:
207-
- alpha
208-
- bravo, charlie
208+
- alpha
209+
- bravo, charlie
209210
```
210211

211212
For example, the source above tells SuzieQ to select from Netbox all the devices having the `alpha` OR `bravo & charlie` tags.
212213

213214
!!!Warning
214-
SuzieQ versions older than 0.19 supported one single tag.
215-
The old syntax, following the pattern `tag: netbox-tag`, is deprecated and it might be removed in the future releases.
215+
SuzieQ versions older than 0.19 supported one single tag.
216+
The old syntax, following the pattern `tag: netbox-tag`, is deprecated and it might be removed in the future releases.
216217

217218
#### Map Netbox sitenames to namespaces
218219

@@ -223,38 +224,39 @@ Here is an example:
223224

224225
```yaml
225226
sources:
226-
- name: netbox-dc-01
227-
type: netbox
228-
token: your-api-token-here
229-
url: http://127.0.0.1:8000
230-
tag:
231-
- tag1
232-
- tag2, tag3
233-
234-
- name: netbox-dc-02
235-
type: netbox
236-
token: your-api-token-here
237-
url: http://127.0.0.1:9000
238-
tag:
239-
- suzieq
227+
- name: netbox-dc-01
228+
type: netbox
229+
token: your-api-token-here
230+
url: http://127.0.0.1:8000
231+
tag:
232+
- tag1
233+
- tag2, tag3
234+
235+
- name: netbox-dc-02
236+
type: netbox
237+
token: your-api-token-here
238+
url: http://127.0.0.1:9000
239+
tag:
240+
- suzieq
240241
241242
auths:
242-
- name: auth-st
243-
username: user
244-
password: my-password
243+
- name: auth-st
244+
username: user
245+
password: my-password
245246
246247
namespaces:
247-
- name: netbox-sitename # devices namespaces equal to their site names
248-
source: netbox-dc-01
249-
auth: auth-st
248+
- name: netbox-sitename # devices namespaces equal to their site names
249+
source: netbox-dc-01
250+
auth: auth-st
251+
252+
- name: namespace01 # devices namespaces equal to 'namespace01'
253+
source: netbox-dc-02
254+
auth: auth-st
250255
251-
- name: namespace01 # devices namespaces equal to 'namespace01'
252-
source: netbox-dc-02
253-
auth: auth-st
254256
```
255257

256258
!!! warning
257-
Credentials are not pulled from netbox, you will need to define an authentication source under the [auths](#auths) get the nodes' credentials.
259+
Credentials are not pulled from netbox, you will need to define an authentication source under the [auths](#auths) get the nodes' credentials.
258260

259261
### <a name='source-nautobot'></a>Nautobot
260262

@@ -331,7 +333,7 @@ Moreover if all the devices inside a namespace run the same NOS, it is possible
331333
```
332334

333335
!!! information
334-
The fields specified in the `device` section are treated as default values, which are provided if the node does not have one. Fields such as `devtype` or `transport` could be already provided by the source, in this case device will not override them.
336+
The fields specified in the `device` section are treated as default values, which are provided if the node does not have one. Fields such as `devtype` or `transport` could be already provided by the source, in this case device will not override them.
335337

336338
### Limiting commands and authentication attempts
337339

@@ -387,19 +389,19 @@ The credential file should look like this:
387389
```yaml
388390
- namespace: testing
389391
devices:
390-
- hostname: leaf01
391-
password: my-password
392-
username: vagrant
393-
- hostname: leaf02
394-
keyfile: /path/to/private/key
395-
username: vagrant
396-
- hostname: leaf03
397-
keyfile: /path/to/private/key
398-
username: vagrant
399-
key-passphrase: my-passphrase
400-
- address: 10.0.0.1
401-
username: vagrant
402-
password: my-password
392+
- hostname: leaf01
393+
password: my-password
394+
username: vagrant
395+
- hostname: leaf02
396+
keyfile: /path/to/private/key
397+
username: vagrant
398+
- hostname: leaf03
399+
keyfile: /path/to/private/key
400+
username: vagrant
401+
key-passphrase: my-passphrase
402+
- address: 10.0.0.1
403+
username: vagrant
404+
password: my-password
403405
```
404406

405407
## <a name='namespaces'></a>Namespaces
@@ -409,10 +411,10 @@ For example the following namespace will be defined by the source named `netbox-
409411

410412
```yaml
411413
namespaces:
412-
- name: example
413-
source: netbox-1
414-
device: ssh-jump-devs
415-
auth: dc-01-credentials
414+
- name: example
415+
source: netbox-1
416+
device: ssh-jump-devs
417+
auth: dc-01-credentials
416418
```
417419

418420
In case you are using the SuzieQ native or ansible source types, `auth` field is optional since the settings can be defined per-device in the source.
@@ -495,21 +497,21 @@ The new inventory format consists of four sections (sources, auths, devices, nam
495497
Here is how the new format will look like:
496498

497499
!!! important
498-
Sections [auths](#auths) and [devices](#devices) are optional. See the full documentation to know how to use them.
500+
Sections [auths](#auths) and [devices](#devices) are optional. See the full documentation to know how to use them.
499501

500502
```yaml
501503
sources:
502-
- name: eos-source # namespace is defined below, this is only a name to be used as reference
503-
hosts:
504-
- url: https://vagrant@192.168.123.252 devtype=eos
505-
- url: ssh://vagrant@192.168.123.232 keyfile=/home/netenglabs/cloud-native-data-center-networking/topologies/dual-attach/.vagrant/machines/internet/libvirt/private_key
506-
- url: https://vagrant@192.168.123.164 devtype=eos
507-
- url: ssh://192.168.123.70 username=admin password=admin
508-
- url: ssh://vagrant@192.168.123.230 keyfile=/home/netenglabs/cloud-native-data-center-networking/topologies/dual-attach/.vagrant/machines/server101/libvirt/private_key
509-
- url: ssh://vagrant@192.168.123.54:2023 keyfile=/home/netenglabs/cloud-native-data-center-networking/topologies/dual-attach/.vagrant/machines/server104/libvirt/private_key
510-
- url: https://vagrant@192.168.123.123 password=vagrant
504+
- name: eos-source # namespace is defined below, this is only a name to be used as reference
505+
hosts:
506+
- url: https://vagrant@192.168.123.252 devtype=eos
507+
- url: ssh://vagrant@192.168.123.232 keyfile=/home/netenglabs/cloud-native-data-center-networking/topologies/dual-attach/.vagrant/machines/internet/libvirt/private_key
508+
- url: https://vagrant@192.168.123.164 devtype=eos
509+
- url: ssh://192.168.123.70 username=admin password=admin
510+
- url: ssh://vagrant@192.168.123.230 keyfile=/home/netenglabs/cloud-native-data-center-networking/topologies/dual-attach/.vagrant/machines/server101/libvirt/private_key
511+
- url: ssh://vagrant@192.168.123.54:2023 keyfile=/home/netenglabs/cloud-native-data-center-networking/topologies/dual-attach/.vagrant/machines/server104/libvirt/private_key
512+
- url: https://vagrant@192.168.123.123 password=vagrant
511513
512514
namespaces:
513-
- name: eos
514-
source: eos-source
515-
```
515+
- name: eos
516+
source: eos-source
517+
```

0 commit comments

Comments
 (0)