8
8
$ maas-cli <profile> <command> [parameters]
10
10
The available commands are dependent on the API you are connecting to and the
11
profile you use. The currently available options are explained below.
11
profile you use. The currently available options are explained below.
17
16
As well as the web interface, many tasks can be performed by accessing
18
17
the MAAS API directly through the maas-cli command. This section
19
18
details how to login with this tool and perform some common
30
29
Login to the web interface on your MAAS. Click on the username in the
31
30
top right corner and select 'Preferences' from the menu which appears.
32
A new page will load...
33
34
The very first item is a list of MAAS keys. One will have already been
34
35
generated when the system was installed. It's easiest to just select
35
36
and copy the key (it's quite long!) and then paste it into the
38
39
$ maas-cli login <profile-name> <hostname> <key>
40
The profile created is an easy way of associating your credentials with any
41
subsequent call to the API. So an example login might look like this::
43
$ maas-cli login maas http://10.98.0.13/MAAS/api/1.0 AWSCRMzqMNy:jjk...5e1FenoP82Qm5te2
45
which creates the profile 'maas' and registers it with the given key at the
46
specified API endpoint.
47
If you omit the credentials, they will be prompted for in the console. It is
48
also possible to use a hyphen, '-' in place of the credentials. In this case a
49
single line will be read from stdin, stripped of any whitespace and used as the
50
credentials, which can be useful if you are devolping scripts for specific
52
If an empty string is passed instead of the credentials, the profile will be
53
logged in anonymously (and consequently some of the API calls will not be
41
The profile created is an easy way of associating your credentials
42
with any subsequent call to the API. So an example login might look
45
$ maas-cli login maas http://10.98.0.13/MAAS/api/1.0
46
AWSCRMzqMNy:jjk...5e1FenoP82Qm5te2
48
which creates the profile 'maas' and registers it with the given key
49
at the specified API endpoint. If you omit the credentials, they will
50
be prompted for in the console. It is also possible to use a hyphen,
51
'-' in place of the credentials. In this case a single line will be
52
read from stdin, stripped of any whitespace and used as the
53
credentials, which can be useful if you are devolping scripts for
54
specific tasks. If an empty string is passed instead of the
55
credentials, the profile will be logged in anonymously (and
56
consequently some of the API calls will not be available)
60
62
The ``maas-cli`` command exposes the whole API, so you can do anything
61
63
you actually *can* do with MAAS using this command. Unsurprisingly,
62
this leaves us with a vast number of options.
64
this leaves us with a vast number of options, but before we delve into
65
detail on the specifics, here is a sort of 'cheat-sheet' for common
66
tasks you might want to do using ``maas-cli``.
68
* :ref:`Configure DHCP and DNS services <cli-dhcp>`
70
* :ref:`Commission all enlisted nodes <cli-commission>`
72
* :ref:`Setting IPMI power parameters for a node <cli-power>`
64
74
The main maas-cli commands are:
147
165
Releases the node given by *<system_id>*
149
167
:samp:`start <system_id>`
151
169
Powers up the node identified by *<system_id>* (where MAAS has
152
170
information for power management for this node).
154
172
:samp:`stop <system_id>`
156
174
Powers off the node identified by *<system_id>* (where MAAS has
157
175
information for power management for this node).
159
177
:samp:`delete <system_id>`
161
179
Removes the given node from the MAAS database.
163
181
:samp:`read <system_id>`
165
183
Returns all the current known information about the node specified
168
186
:samp:`update <system_id> [parameters...]`
170
188
Used to change or set specific values for the node. The valid
171
189
parameters are listed below::
174
192
The new hostname for this node.
177
195
Sets the architecture type, where <value>
178
196
is a string containing a valid architecture type,
179
197
e.g. "i386/generic"
181
distro_series=<value>
182
Sets the series of Ubuntu to use.
185
Sets the type of power management used on the node, e.g. "ipmi" or
188
power_parameters_{param1}... =<value>
189
Set the given power parameters. Note that the valid options for these
200
Apply the given dotted decimal value as the broadcast IP address
203
power_parameters_{param1}... =<value>
204
Set the given power parameters. Note that the valid options for these
190
205
depend on the power type chosen.
192
power_parameters_skip_check 'true' | 'false'
193
Whether to sanity check the supplied parameters against this node's
207
power_parameters_skip_check 'true' | 'false'
208
Whether to sanity check the supplied parameters against this node's
194
209
declared power type. The default is 'false'.
200
214
Example: Setting the power parameters for an ipmi enabled node::
306
318
Disables the SSL certificate check.
308
320
:samp:`register uuid=<value> name=<value> interfaces=<json_string>`
310
322
Registers a new node group with the given name and uuid. The
311
323
interfaces parameter must be supplied in the form of a JSON string
312
324
comprising the key/value data for the interface to be used, for
342
353
node-group-interface
343
354
^^^^^^^^^^^^^^^^^^^^
344
For managing the interfaces. See also
345
"node_group_interfaces"
355
For managing the interfaces. See also :ref:`node-group-interfaces`
347
Usage: maas-cli *<profile>* node-group-interface [-d --debug] [-h
357
Usage: maas-cli *<profile>* node-group-interfaces [-d --debug] [-h
348
358
--help] [-k --insecure] read | update | delete [parameters...]
350
360
..program:: maas-cli node-group-interface
352
362
:samp:`read <uuid> <interface>`
354
364
Returns the current settings for the given UUID and interface
356
366
:samp:`update [parameters]`
358
368
Changes the settings for the interface according to the given
361
371
management= 0 | 1 | 2
362
The service to be managed on the interface ( 0= none, 1=DHCP, 2=DHCP
372
The service to be managed on the interface ( 0= none, 1=DHCP, 2=DHCP
365
375
subnet_mask=<value>
366
376
Apply the given dotted decimal value as the subnet mask.
368
378
broadcast_ip=<value>
369
Apply the given dotted decimal value as the broadcast IP address for
379
Apply the given dotted decimal value as the broadcast IP address for
372
382
router_ip=<value>
373
Apply the given dotted decimal value as the default router address
383
Apply the given dotted decimal value as the default router address
376
386
ip_range_low=<value>
377
387
The lowest value of IP address to allocate via DHCP
379
389
ip_range_high=<value>
380
The highest value of IP address to allocate via DHCP
390
The highest value of IP address to allocate via DHCP
382
392
:samp:`delete <uuid> <interface>`
384
394
Removes the entry for the given UUID and interface.
388
397
Configuring DHCP and DNS.
390
To enable MAAS to manage DHCP and DNS, it needs to be supplied with the relevant
399
To enable MAAS to manage DHCP and DNS, it needs to be supplied with the relevant
391
400
interface information. To do this we need to first determine the UUID of the
392
401
node group affected::
394
403
$ uuid=$(maas-cli <profile> node-groups list | grep uuid | cut -d\" -f4)
396
405
Once we have the UUID we can use this to update the node-group-interface for
397
406
that nodegroup, and pass it the relevant interface details::
403
412
broadcast_ip=192.168.123.255 \
404
413
router_ip=192.168.123.1 \
406
Replacing the example values with those required for this network. The only
407
non-obvious parameter is 'management' which takes the values 0 (no management), 1
408
(manage DHCP) and 2 (manage DHCP and DNS).
415
Replacing the example values with those required for this network. The
416
only non-obvious parameter is 'management' which takes the values 0
417
(no management), 1 (manage DHCP) and 2 (manage DHCP and DNS).
411
420
node-group-interfaces
436
445
Lists the current stored configurations for the given identifier
437
446
<label> in a key:value format which should be easy to decipher.
440
448
:samp:`new <label> ip=<value> interface=<if_device> [parameters...]`
442
450
Creates a new interface group. The required parameters are the IP
443
451
address and the network interface this appies to (e.g. eth0). In
444
452
order to do anything useful, further parameters are required::
446
management= 0 | 1 | 2
454
management= 0 | 1 | 2
447
455
The service to be managed on the interface
448
456
( 0= none, 1=DHCP, 2=DHCP and DNS).
450
458
subnet_mask=<value>
451
459
Apply the given dotted decimal value as the subnet mask.
454
462
Apply the given dotted decimal value as the
455
463
broadcast IP address for this subnet.
458
466
Apply the given dotted decimal value as the
459
467
default router address for this subnet.
465
473
The highest value of IP address to allocate via DHCP
473
479
Usage: maas-cli <profile> tag read | update-nodes | rebuild | update |
476
482
.. program:: maas-cli tag
478
484
:samp:`read <tag_name>`
480
486
Returns information on the tag specified by <name>
482
:samp:`update-nodes <tag_name> [add=<system_id>] [remove=<system_id>] [nodegroup=<system_id>]`
488
:samp:`update-nodes <tag_name> [add=<system_id>] [remove=<system_id>]
489
[nodegroup=<system_id>]`
484
491
Applies or removes the given tag from a list of nodes specified by
485
492
either or both of add="<system_id>" and remove="<system_id>". The
492
Triggers a rebuild of the tag to node mapping.
494
:samp:`update <tag_name> [name=<value>] | [comment=<value>]|[definition=<value>]`
499
Triggers a rebuild of the tag to node mapping.
501
:samp:`update <tag_name> [name=<value>] | [comment=<value>]|
502
[definition=<value>]`
496
504
Updates the tag identified by tag_name. Any or all of name,comment
497
505
and definition may be supplied as parameters. If no parameters are
498
506
supplied, this command returns the current values.
506
514
Deletes the given tag.
510
Tags are a really useful way of identifying nodes with particular
520
Tags are a really useful way of identifying nodes with particular
525
For more information on how to use them effectively, please see
513
528
Usage: maas-cli <profile> tag [-d --debug] [-h --help] [-k
514
529
--insecure] list | new
518
533
:samp:`-d, --debug`
520
535
Displays debug information listing the API responses.
522
537
:samp:`-h, --help`
524
539
Display usage information.
526
:samp:`-k, --insecure`
541
:samp:`-k, --insecure`
528
543
Disables the SSL certificate check.
532
547
Returns a JSON object listing all the current tags known by the MAAS server
534
549
:samp:`create name=<value> definition=<value> [comment=<value>]`
536
551
Creates a new tag with the given name and definition. A comment is
537
552
optional. Names must be unique, obviously - an error will be
538
returned if the given name already exists. The definition is in the form of
539
an XPath expression which parses the XML returned by running ``lshw`` on the
553
returned if the given name already exists. The definition is in the
554
form of an XPath expression which parses the XML returned by
555
running ``lshw`` on the node.
543
558
Adding a tag to all nodes which have an Intel GPU::
545
560
$ maas-cli maas tags new name='intel-gpu' \
546
561
comment='Machines which have an Intel display driver' \
547
562
definition='contains(//node[@id="display"]/vendor, "Intel")
552
568
Because the ``maas-cli`` command exposes all of the API, it also lists
553
569
some command options which are not really intended for end users, such
554
570
as the "file" and "boot-images" options.
556
572
Further Documentation
557
573
^^^^^^^^^^^^^^^^^^^^^
558
575
For more documentation of MAAS, please see https://maas.ubuntu.com/docs