~andreserl/maas/lp1665143

« back to all changes in this revision

Viewing changes to docs/dhcpsnippets.rst

Merged specify_scripts_commissioning into test_api.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
.. -*- mode: rst -*-
2
 
 
3
 
.. _dhcpsnippets:
4
 
 
5
 
=========================
6
 
DHCP Snippets
7
 
=========================
8
 
 
9
 
.. note::
10
 
 
11
 
  This feature is available in MAAS versions 2.0 and above. Modifications made
12
 
  directly to dhcpd.conf.template or dhcpd6.conf.template are no longer
13
 
  supported.
14
 
 
15
 
MAAS allows customizing dhcpd.conf and dhcpd6.conf through the use of DHCP
16
 
snippets. DHCP snippets are user defined dhcpd.conf configuration options which
17
 
are inserted into /var/lib/maas/dhcpd.conf and /var/lib/maas/dhcpd6.conf by
18
 
MAAS. Custom dhcpd.conf configuration options can be inserted either globally,
19
 
on a subnet, or on a node. For information about dhcpd.conf options refer to
20
 
the dhcpd.conf man or info page.
21
 
 
22
 
Creating a DHCP Snippet
23
 
-----------------------
24
 
 
25
 
Administrators can create DHCP Snippets over the API using the following command:::
26
 
 
27
 
  $ maas <profile> dhcpsnippets create name=<DHCP Snippet Name> value=<valid DHCP configuration options>
28
 
 
29
 
The name of the DHCP snippet will be added to /var/lib/maas/dhcpd.conf and
30
 
/var/lib/maas/dhcpd6.conf as a comment above the value. Optionally a
31
 
description can also be specified as such::
32
 
 
33
 
  $ maas <profile> dhcpsnippets create name=<DHCP Snippet Name> value=<valid DHCP configuration options> description=<DHCP Snippet description>
34
 
 
35
 
Global DHCP Snippets
36
 
^^^^^^^^^^^^^^^^^^^^
37
 
 
38
 
If no subnet or node is specified, the DHCP Snippet will be considered global.
39
 
A global DHCP Snippet is a configuration option which is applied to all VLANS,
40
 
subnets, and nodes. The global_snippet flag can also be used to force a DHCP
41
 
Snippet to be global::
42
 
 
43
 
  $ maas <profile> dhcpsnippets create name=<DHCP Snippet Name> value=<valid DHCP configuration options> global_snippet=true
44
 
 
45
 
Subnet DHCP Snippets
46
 
^^^^^^^^^^^^^^^^^^^^
47
 
 
48
 
DHCP Snippets can be applied only to a specific subnet as follows::
49
 
 
50
 
  $ maas <profile> dhcpsnippets create name=<DHCP Snippet Name> value=<valid DHCP configuration options> subnet=<subnet id or cidr>
51
 
 
52
 
Node DHCP Snippets
53
 
^^^^^^^^^^^^^^^^^^
54
 
 
55
 
DHCP Snippets can be applied only to a specific node. When a node is specified,
56
 
each snippet will be added to the host entry for each interface. A node can be
57
 
specified as follows::
58
 
 
59
 
  $ maas <profile> dhcpsnippets create name=<DHCP Snippet Name> value=<valid DHCP configuration options> node=<system_id or hostname>
60
 
 
61
 
DHCP Snippet Enablement
62
 
^^^^^^^^^^^^^^^^^^^^^^^
63
 
 
64
 
DHCP Snippets can be turned off by using the enabled flag option as follows::
65
 
 
66
 
  $ maas <profile> dhcpsnippets create name=<DHCP Snippet Name> value=<valid DHCP configuration options> enabled=false
67
 
 
68
 
Listing DHCP Snippets
69
 
---------------------
70
 
 
71
 
To list all DHCP Snippets use the following command::
72
 
 
73
 
  $ maas <profile> dhcpsnippets read
74
 
 
75
 
To list a particular DHCP Snippet use the following command.::
76
 
 
77
 
  $ maas <profile> dhcpsnippet read <DHCP Snippet id or name>
78
 
 
79
 
Updating a DHCP Snippet
80
 
-----------------------
81
 
 
82
 
Administrators can update the DHCP Snippet attributes using the following
83
 
command::
84
 
 
85
 
  $ maas <profile> dhcpsnippet update <DHCP Snippet id or name> <options>
86
 
 
87
 
DHCP Snippet Value History
88
 
--------------------------
89
 
 
90
 
MAAS stores the complete history of changes made to the DHCP Snippet's
91
 
value. MAAS only uses the latest revision of the value when writing
92
 
dhcpd.conf.
93
 
 
94
 
Reverting a Value
95
 
^^^^^^^^^^^^^^^^^
96
 
 
97
 
.. warning::
98
 
  Reverting a value will result in all later versions being deleted!
99
 
 
100
 
The revert operation allows the user to revert to a previous value. When
101
 
specifying what to revert to the user can either provide the value id or a
102
 
negative number representing how many revivisions to go back::
103
 
 
104
 
  $ maas <profile> dhcpsnippet revert <DHCP Snippet id or name> to=<value id or negative number>
105
 
 
106
 
Deleting a DHCP Snippet
107
 
-----------------------
108
 
 
109
 
Administrators can delete a DHCP Snippet using the following command::
110
 
 
111
 
  $ maas <profile> dhcpsnippet delete <DHCP Snippet id or name>