~smoser/ubuntu/xenial/curtin/pkg

« back to all changes in this revision

Viewing changes to doc/topics/config.rst

  • Committer: Ryan Harper
  • Date: 2016-10-03 18:43:46 UTC
  • mfrom: (1.2.2)
  • Revision ID: ryan.harper@canonical.com-20161003184346-pvdgp51jhexx3zox
* New upstream snapshot.
  - unittest,tox.ini: catch and fix issue with trusty-level mock of open 
  - block/mdadm: add option to ignore mdadm_assemble errors  (LP: #1618429)
  - curtin/doc: overhaul curtin documentation for readthedocs.org  (LP: #1351085)
  - curtin.util: re-add support for RunInChroot  (LP: #1617375)
  - curtin/net: overhaul of eni rendering to handle mixed ipv4/ipv6 configs 
  - curtin.block: refactor clear_holders logic into block.clear_holders and cli cmd 
  - curtin.apply_net should exit non-zero upon exception.  (LP: #1615780)
  - apt: fix bug in disable_suites if sources.list line is blank. 
  - vmtests: disable Wily in vmtests 
  - Fix the unittests for test_apt_source. 
  - get CURTIN_VMTEST_PARALLEL shown correctly in jenkins-runner output 
  - fix vmtest check_file_strippedline to strip lines before comparing 
  - fix whitespace damage in tests/vmtests/__init__.py 
  - fix dpkg-reconfigure when debconf_selections was provided.  (LP: #1609614)
  - fix apt tests on non-intel arch 
  - Add apt features to curtin.  (LP: #1574113)
  - vmtest: easier use of parallel and controlling timeouts 
  - mkfs.vfat: add force flag for formating whole disks  (LP: #1597923)
  - block.mkfs: fix sectorsize flag  (LP: #1597522)
  - block_meta: cleanup use of sys_block_path and handle cciss knames  (LP: #1562249)
  - block.get_blockdev_sector_size: handle _lsblock multi result return  (LP: #1598310)
  - util: add target (chroot) support to subp, add target_path helper. 
  - block_meta: fallback to parted if blkid does not produce output  (LP: #1524031)
  - commands.block_wipe:  correct default wipe mode to 'superblock' 
  - tox.ini: run coverage normally rather than separately 
  - move uefi boot knowledge from launch and vmtest to xkvm 

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
====================
 
2
Curtin Configuration
 
3
====================
 
4
 
 
5
Curtin exposes a number of configuration options for controlling Curtin
 
6
behavior during installation.
 
7
 
 
8
 
 
9
Configuration options
 
10
---------------------
 
11
Curtin's top level config keys are as follows:
 
12
 
 
13
 
 
14
- apt_mirrors (``apt_mirrors``)
 
15
- apt_proxy (``apt_proxy``)
 
16
- block-meta (``block``)
 
17
- debconf_selections (``debconf_selections``)
 
18
- disable_overlayroot (``disable_overlayroot``)
 
19
- grub (``grub``)
 
20
- http_proxy (``http_proxy``)
 
21
- install (``install``)
 
22
- kernel (``kernel``)
 
23
- kexec (``kexec``)
 
24
- multipath (``multipath``)
 
25
- network (``network``)
 
26
- power_state (``power_state``)
 
27
- reporting (``reporting``)
 
28
- restore_dist_interfaces: (``restore_dist_interfaces``)
 
29
- sources (``sources``)
 
30
- stages (``stages``)
 
31
- storage (``storage``)
 
32
- swap (``swap``)
 
33
- system_upgrade (``system_upgrade``)
 
34
- write_files (``write_files``)
 
35
 
 
36
 
 
37
apt_mirrors
 
38
~~~~~~~~~~~
 
39
Configure APT mirrors for ``ubuntu_archive`` and ``ubuntu_security``
 
40
 
 
41
**ubuntu_archive**: *<http://local.archive/ubuntu>*
 
42
 
 
43
**ubuntu_security**: *<http://local.archive/ubuntu>*
 
44
 
 
45
If the target OS includes /etc/apt/sources.list, Curtin will replace
 
46
the default values for each key set with the supplied mirror URL.
 
47
 
 
48
**Example**::
 
49
 
 
50
  apt_mirrors:
 
51
    ubuntu_archive: http://local.archive/ubuntu
 
52
    ubuntu_security: http://local.archive/ubuntu
 
53
 
 
54
 
 
55
apt_proxy
 
56
~~~~~~~~~
 
57
Curtin will configure an APT HTTP proxy in the target OS
 
58
 
 
59
**apt_proxy**: *<URL to APT proxy>*
 
60
 
 
61
**Example**::
 
62
 
 
63
  apt_proxy: http://squid.mirror:3267/
 
64
 
 
65
 
 
66
block-meta
 
67
~~~~~~~~~~
 
68
Configure how Curtin selects and configures disks on the target
 
69
system without providing a custom configuration (mode=simple).
 
70
 
 
71
**devices**: *<List of block devices for use>*
 
72
 
 
73
The ``devices`` parameter is a list of block device paths that Curtin may
 
74
select from with choosing where to install the OS.
 
75
 
 
76
**boot-partition**: *<dictionary of configuration>*
 
77
 
 
78
The ``boot-partition`` parameter controls how to configure the boot partition
 
79
with the following parameters:
 
80
 
 
81
**enabled**: *<boolean>*
 
82
 
 
83
Enabled will forcibly setup a partition on the target device for booting.
 
84
 
 
85
**format**: *<['uefi', 'gpt', 'prep', 'mbr']>*
 
86
 
 
87
Specify the partition format.  Some formats, like ``uefi`` and ``prep``
 
88
are restricted by platform characteristics.
 
89
 
 
90
**fstype**: *<filesystem type: one of ['ext3', 'ext4'], defaults to 'ext4'>*
 
91
 
 
92
Specify the filesystem format on the boot partition.
 
93
 
 
94
**label**: *<filesystem label: defaults to 'boot'>*
 
95
 
 
96
Specify the filesystem label on the boot partition.
 
97
 
 
98
**Example**::
 
99
 
 
100
  block-meta:
 
101
      devices:
 
102
        - /dev/sda
 
103
        - /dev/sdb
 
104
      boot-partition:
 
105
        - enabled: True
 
106
          format: gpt
 
107
          fstype: ext4
 
108
          label: my-boot-partition
 
109
 
 
110
 
 
111
debconf_selections
 
112
~~~~~~~~~~~~~~~~~~
 
113
Curtin will update the target with debconf set-selection values.  Users will
 
114
need to be familiar with the package debconf options.  Users can probe a
 
115
packages' debconf settings by using ``debconf-get-selections``.
 
116
 
 
117
**selection_name**: *<debconf-set-selections input>*
 
118
 
 
119
``debconf-set-selections`` is in the form::
 
120
 
 
121
  <packagename> <packagename/option-name> <type> <value>
 
122
 
 
123
**Example**::
 
124
 
 
125
  debconf_selections:
 
126
    set1: |
 
127
      cloud-init cloud-init/datasources multiselect MAAS
 
128
      lxd lxd/bridge-name string lxdbr0
 
129
    set2: lxd lxd/setup-bridge boolean true
 
130
 
 
131
 
 
132
 
 
133
disable_overlayroot
 
134
~~~~~~~~~~~~~~~~~~~
 
135
Curtin disables overlayroot in the target by default.
 
136
 
 
137
**disable_overlayroot**: *<boolean: default True>*
 
138
 
 
139
**Example**::
 
140
 
 
141
  disable_overlayroot: False
 
142
 
 
143
 
 
144
grub
 
145
~~~~
 
146
Curtin configures grub as the target machine's boot loader.  Users
 
147
can control a few options to tailor how the system will boot after
 
148
installation.
 
149
 
 
150
**install_devices**: *<list of block device names to install grub>*
 
151
 
 
152
Specify a list of devices onto which grub will attempt to install.
 
153
 
 
154
**replace_linux_default**: *<boolean: default True>*
 
155
 
 
156
Controls whether grub-install will update the Linux Default target
 
157
value during installation.
 
158
 
 
159
**update_nvram**: *<boolean: default False>*
 
160
 
 
161
Certain platforms, like ``uefi`` and ``prep`` systems utilize
 
162
NVRAM to hold boot configuration settings which control the order in
 
163
which devices are booted.  Curtin by default will not attempt to
 
164
update the NVRAM settings to preserve the system configuration.
 
165
Users may want to force NVRAM to be updated such that the next boot
 
166
of the system will boot from the installed device.
 
167
 
 
168
**Example**::
 
169
 
 
170
  grub:
 
171
     install_devices:
 
172
       - /dev/sda1
 
173
     replace_linux_default: False
 
174
     update_nvram: True
 
175
 
 
176
 
 
177
http_proxy
 
178
~~~~~~~~~~
 
179
Curtin will export ``http_proxy`` value into the installer environment.
 
180
 
 
181
**http_proxy**: *<HTTP Proxy URL>*
 
182
 
 
183
**Example**::
 
184
 
 
185
  http_proxy: http://squid.proxy:3728/
 
186
 
 
187
 
 
188
 
 
189
install
 
190
~~~~~~~
 
191
Configure Curtin's install options.
 
192
 
 
193
**log_file**: *<path to write Curtin's install.log data>*
 
194
 
 
195
Curtin logs install progress by default to /var/log/curtin/install.log
 
196
 
 
197
**post_files**: *<List of files to read from host to include in reporting data>*
 
198
 
 
199
Curtin by default will post the ``log_file`` value to any configured reporter.
 
200
 
 
201
**save_install_config**: *<Path to save merged curtin configuration file>*
 
202
 
 
203
Curtin will save the merged configuration data into the target OS at 
 
204
the path of ``save_install_config``.  This defaults to /root/curtin-install-cfg.yaml
 
205
 
 
206
**Example**::
 
207
 
 
208
  install:
 
209
     log_file: /tmp/install.log
 
210
     post_files:
 
211
       - /tmp/install.log
 
212
       - /var/log/syslog
 
213
     save_install_config: /root/myconf.yaml
 
214
 
 
215
 
 
216
kernel
 
217
~~~~~~
 
218
Configure how Curtin selects which kernel to install into the target image.
 
219
If ``kernel`` is not configured, Curtin will use the default mapping below
 
220
and determine which ``package`` value by looking up the current release
 
221
and current kernel version running.
 
222
 
 
223
 
 
224
**fallback-package**: *<kernel package-name to be used as fallback>*
 
225
 
 
226
Specify a kernel package name to be used if the default package is not
 
227
available.
 
228
 
 
229
**mapping**: *<Dictionary mapping Ubuntu release to HWE kernel names>*
 
230
 
 
231
Default mapping for Releases to package names is as follows::
 
232
 
 
233
 precise:
 
234
    3.2.0: 
 
235
    3.5.0: -lts-quantal
 
236
    3.8.0: -lts-raring
 
237
    3.11.0: -lts-saucy
 
238
    3.13.0: -lts-trusty
 
239
  trusty:
 
240
    3.13.0: 
 
241
    3.16.0: -lts-utopic
 
242
    3.19.0: -lts-vivid
 
243
    4.2.0: -lts-wily
 
244
    4.4.0: -lts-xenial
 
245
  xenial:
 
246
    4.3.0:
 
247
    4.4.0:
 
248
 
 
249
 
 
250
**package**: *<Linux kernel package name>*
 
251
 
 
252
Specify the exact package to install in the target OS.
 
253
 
 
254
**Example**::
 
255
 
 
256
  kernel:
 
257
    fallback-package: linux-image-generic
 
258
    package: linux-image-generic-lts-xenial
 
259
    mapping:
 
260
      - xenial:
 
261
        - 4.4.0: -my-custom-kernel    
 
262
 
 
263
 
 
264
kexec
 
265
~~~~~
 
266
Curtin can use kexec to "reboot" into the target OS.
 
267
 
 
268
**mode**: *<on>*
 
269
 
 
270
Enable rebooting with kexec.
 
271
 
 
272
**Example**::
 
273
 
 
274
  kexec: on
 
275
 
 
276
 
 
277
multipath
 
278
~~~~~~~~~
 
279
Curtin will detect and autoconfigure multipath by default to enable
 
280
boot for systems with multipath.  Curtin does not apply any advanced
 
281
configuration or tuning, rather it uses distro defaults and provides
 
282
enough configuration to enable booting.
 
283
 
 
284
**mode**: *<['auto', ['disabled']>*
 
285
 
 
286
Defaults to auto which will configure enough to enable booting on multipath
 
287
devices.  Disabled will prevent curtin from installing or configuring
 
288
multipath.
 
289
 
 
290
**overwrite_bindings**: *<boolean>*
 
291
 
 
292
If ``overwrite_bindings`` is True then Curtin will generate new bindings
 
293
file for multipath, overriding any existing binding in the target image.
 
294
 
 
295
**Example**::
 
296
 
 
297
  multipath:
 
298
      mode: auto
 
299
      overwrite_bindings: True
 
300
 
 
301
 
 
302
network
 
303
~~~~~~~
 
304
Configure networking (see Networking section for details).
 
305
 
 
306
**network_option_1**: *<option value>*
 
307
 
 
308
**Example**::
 
309
 
 
310
  network:
 
311
     version: 1
 
312
     config:
 
313
       - type: physical
 
314
         name: eth0
 
315
         mac_address: "c0:d6:9f:2c:e8:80"
 
316
         subnets:
 
317
           - type: dhcp4
 
318
 
 
319
 
 
320
power_state
 
321
~~~~~~~~~~~
 
322
Curtin can configure the target machine into a specific power state after
 
323
completing an installation.  Default is to do nothing.
 
324
 
 
325
**delay**: *<Integer seconds to delay change in state>*
 
326
 
 
327
Curtin will wait ``delay`` seconds before changing the power state.
 
328
 
 
329
**mode**: *<New power state is one of: [halt, poweroff, reboot]>*
 
330
 
 
331
Curtin will transition the node into one of the new states listed.
 
332
 
 
333
``halt`` will stop a machine, but may not cut the power to the system.
 
334
``poweroff`` will stop a machine and request it shut off the power.
 
335
``reboot`` will perform a platform reset.
 
336
 
 
337
**message**:  *<message string>*
 
338
 
 
339
The ``message`` string will be broadcast to system consoles prior to
 
340
power state change.
 
341
 
 
342
 
 
343
**Example**::
 
344
 
 
345
  power_state:
 
346
    mode: poweroff
 
347
    delay: 5
 
348
    message: Bye Bye
 
349
 
 
350
 
 
351
reporting
 
352
~~~~~~~~~
 
353
Configure installation reporting (see Reporting section for details).
 
354
 
 
355
**Example**::
 
356
 
 
357
  reporting:
 
358
    maas:
 
359
      level: DEBUG
 
360
      type: webhook
 
361
      endpoint: http://localhost:8000/
 
362
 
 
363
 
 
364
restore_dist_interfaces
 
365
~~~~~~~~~~~~~~~~~~~~~~~
 
366
Curtin can restore a copy of /etc/network/interfaces built in to cloud images.
 
367
 
 
368
**restore_dist_interfaces**: *<boolean>*
 
369
 
 
370
If True, then Curtin will restore the interfaces file into the target.
 
371
 
 
372
 
 
373
**Example**::
 
374
 
 
375
  restore_dist_interfaces: True
 
376
 
 
377
 
 
378
sources
 
379
~~~~~~~
 
380
Specify the root image to install on to the target system.  The URI also
 
381
configures the method used to copy the image to the target system.
 
382
 
 
383
**sources**: *<List of source URIs>*
 
384
 
 
385
``source URI`` may be one of:
 
386
 
 
387
- **dd-**:  Use ``dd`` command to write image to target.
 
388
- **cp://**: Use ``rsync`` command to copy source directory to target.
 
389
- **file://**: Use ``tar`` command to extract source to target.
 
390
- **http[s]://**: Use ``wget | tar`` commands to extract source to target.
 
391
 
 
392
**Example Cloud-image**::
 
393
 
 
394
  sources: 
 
395
    - https://cloud-images.ubuntu.com/xenial/current/xenial-server-cloudimg-amd64-root.tar.gz
 
396
 
 
397
**Example Custom DD image**::
 
398
 
 
399
  sources: 
 
400
    - dd-img: https://localhost/raw_images/centos-6-3.img
 
401
 
 
402
**Example Copy from booted environment**::
 
403
 
 
404
  sources: 
 
405
    - cp:///
 
406
 
 
407
 
 
408
**Example Copy from local tarball**::
 
409
 
 
410
  sources: 
 
411
    - file:///tmp/root.tar.gz
 
412
 
 
413
 
 
414
stages
 
415
~~~~~~
 
416
Curtin installation executes in stages.  At each stage, Curtin will look for
 
417
a list of commands to run at each stage by reading in from the Curtin config
 
418
*<stage_name>_commands* which is a dictionary and each key contains a list
 
419
of commands to run.  Users may override the stages value to control
 
420
what curtin stages execute.  During each stage, the commands are executed
 
421
in C Locale sort order.  Users should name keys in a NN-XXX format where NN
 
422
is a two-digit number to exercise control over execution order.
 
423
 
 
424
The following stages are defined in Curtin and 
 
425
run by default.
 
426
 
 
427
- **early**: *Preparing for Installation*
 
428
 
 
429
This stage runs before any actions are taken for installation.  By default
 
430
this stage does nothing.
 
431
 
 
432
- **partitioning**: *Select and partition disks for installation*
 
433
 
 
434
This stage runs ``curtin block-meta simple`` by default.
 
435
 
 
436
- **network**: *Probe and configure networking*
 
437
 
 
438
This stage runs ``curtin net-meta auto`` by default.
 
439
 
 
440
- **extract**: *Writing install sources to disk*
 
441
 
 
442
This stage runs ``curtin extract`` by default.
 
443
 
 
444
- **extract**: *Writing install sources to disk*
 
445
 
 
446
This stage runs ``curtin extract`` by default.
 
447
 
 
448
- **curthooks**: *Configuring installed system*
 
449
 
 
450
This stage runs ``curtin curthooks`` by default.
 
451
 
 
452
- **hooks**: *Finalizing installation*
 
453
 
 
454
This stage runs ``curtin hook`` by default.
 
455
 
 
456
- **late**: *Executing late commands*
 
457
 
 
458
This stage runs after Curtin has completed the installation.  By default
 
459
this stage does nothing.
 
460
 
 
461
**Example Custom Stages**::
 
462
 
 
463
  # Skip the whole install and just run `mystage`
 
464
  stages: ['early', 'late', 'mystage']
 
465
  mystage_commands:
 
466
     00-cmd: ['/usr/bin/foo']
 
467
 
 
468
**Example Early and Late commands**::
 
469
 
 
470
  early_commands:
 
471
      99-cmd:  ['echo', 'I ran last']
 
472
      00-cmd:  ['echo', 'I ran first']
 
473
  late_commands:
 
474
      50-cmd: ['curtin', 'in-target' '--', 'touch', '/etc/disable_overlayroot']
 
475
    
 
476
 
 
477
swap
 
478
~~~~
 
479
Curtin can configure a swapfile on the filesystem in the target system.
 
480
Size settings can be integer or string values with suffix.  Curtin
 
481
supports the following suffixes which multiply the value.
 
482
 
 
483
- **B**: *1*
 
484
- **K[B]**: *1 << 10*
 
485
- **M[B]**: *1 << 20*
 
486
- **G[B]**: *1 << 30*
 
487
- **T[B]**: *1 << 40*
 
488
 
 
489
Curtin will use a heuristic to configure the swapfile size if the ``size``
 
490
parameter is not set to a specific value.  The ``maxsize`` sets the upper
 
491
bound of the heuristic calculation.
 
492
 
 
493
**filename**: *<path to swap file>* 
 
494
 
 
495
Configure the filename of the swap file. Defaults to /swap.img
 
496
 
 
497
**maxsize**: *<Size string>*
 
498
 
 
499
Configure the max size of the swapfile, defaults to 8GB
 
500
 
 
501
**size**: *<Size string>*
 
502
 
 
503
Configure the exact size of the swapfile.  Setting ``size`` to 0 will
 
504
disable swap.
 
505
 
 
506
**Example**::
 
507
 
 
508
  swap:
 
509
    filename: swap.img
 
510
    size: None
 
511
    maxsize: 4GB
 
512
 
 
513
 
 
514
system_upgrade
 
515
~~~~~~~~~~~~~~
 
516
Control if Curtin runs `dist-upgrade` in target after install.  Defaults to
 
517
False.
 
518
 
 
519
**enabled**: *<boolean>*
 
520
 
 
521
**Example**::
 
522
 
 
523
  system_upgrade:
 
524
    enabled: False
 
525
 
 
526
 
 
527
write_files
 
528
~~~~~~~~~~~
 
529
Curtin supports writing out arbitrary data to a file.
 
530
``write_files`` accepts a dictionary of entries formatted as follows:
 
531
 
 
532
**path**: *<path and filename to save content>*
 
533
 
 
534
Specify the name and location of where to write the content.
 
535
 
 
536
**permissions**: *<Unix permission string>*
 
537
 
 
538
Specify the permissions mode as an integer or string of numbers.
 
539
 
 
540
**content**: *<data>*
 
541
 
 
542
Specify the content.
 
543
 
 
544
**Example**::
 
545
 
 
546
  write_files:
 
547
    f1:
 
548
      path: /file1
 
549
      content: !!binary |
 
550
        f0VMRgIBAQAAAAAAAAAAAAIAPgABAAAAwARAAAAAAABAAAAAAAAAAJAVAAAAAAA
 
551
    f2: {path: /file2, content: "foobar", permissions: '0666'}