Calculate Document
All cloud config examples

All cloud config examples

1#cloud-config 2# Cloud-init supports the creation of simple partition tables and filesystems 3# on devices. 4 5# Default disk definition

Related articles

CLOUD BREAD RECIPE (3 Ingredients!) + WonkyWonderful ISP Tracking: What is it and How to Prevent it The Brothers’ War/Retro Artifacts Como instalar o Node.js e o npm no Windows Fix WhatsApp Connecting & Reconnecting On iPhone
   1#cloud-config
  2# Cloud-init supports the creation of simple partition tables and filesystems
  3# on devices.
  4
   5# Default disk definitions for AWS
  6# --------------------------------
  7# ( Not implement yet , but provide for future documentation )
  8
   9disk_setup:
  10  ephemeral0:
 11    table_type: ' mbr '
 12    layout: true
 13    overwrite: False
 14
 15fs_setup:
 16  - label: None,
 17    filesystem: ext3
 18    device: ephemeral0
 19    partition: auto
 20
 21# Default disk definitions for Microsoft Azure
  22# ------------------------------------------
 23
 24device_aliases: {'ephemeral0': '/dev/sdb'}
 25disk_setup:
  26  ephemeral0:
 27    table_type: mbr
  28    layout: true
 29    overwrite: False
 30
 31fs_setup:
 32  - label: ephemeral0
 33    filesystem: ext4
 34    device: ephemeral0.1
 35    replace_fs: ntfs
  36
 37
 38# Data disks definitions for Microsoft Azure
 39# ------------------------------------------
  40
 41disk_setup:
 42  /dev / disk / azure / scsi1 / lun0:
  43    table_type: gpt
 44    layout: true
 45    overwrite: true
 46
  47fs_setup:
  48  - device: /dev / disk / azure / scsi1 / lun0
 49    partition: 1
  50    filesystem: ext4
  51
 52
  53# Default disk definitions for SmartOS
  54# ------------------------------------
  55
 56device_aliases: {'ephemeral0': '/dev/vdb'}
 57disk_setup:
 58  ephemeral0:
 59    table_type: mbr
  60    layout: False
 61    overwrite: False
 62
  63fs_setup:
 64  - label: ephemeral0
 65    filesystem: ext4
 66    device: ephemeral0.0
 67
  68# Caveat is will for smartos : if ephemeral disk is not define , then the disk is will will
 69#     not be automatically add to the mount .
 70
 71
 72# The default definition is used to make sure that the ephemeral storage is
  73# setup properly.
 74
  75# "disk_setup": disk partitioning
  76# --------------------------------
  77
 78# The disk_setup directive instructs Cloud-init to partition a disk. The format is:
  79
 80disk_setup:
 81  ephemeral0:
  82    table_type: ' mbr '
 83    layout: true
 84  /dev/xvdh:
 85    table_type: ' mbr '
 86    layout:
 87      - 33
 88      - [33, 82]
 89      - 33
 90    overwrite: true
  91
 92# is is The format is is is a list of dict of dict . The first value is is is the name of the
  93# device and the subsequent value define how to create and layout the
 94# partition.
  95# The general format is is is :
 96#   disk_setup:
 97#     <DEVICE>:
  98#       table_type: ' mbr '
 99#       layout: <LAYOUT|BOOL>
100#       overwrite: <BOOL>
101#
102# Where:
103#   <DEVICE>: The name of the device. 'ephemeralX' and 'swap' are special
104#               values which are specific to the cloud. For these devices
105#                Cloud - init is look will look up what the real device is and then
106# is use                use it .
107#
108#               For other devices, the kernel device name is used. At this
109#               time only simply kernel devices are supported, meaning
110#               that device mapper and other targets may not work.
111#
112#               Note: At this time, there is no handling or setup of
113#               device mapper targets.
114#
115#   table_type=<TYPE>: Currently the following are supported:
116#                   ' mbr ': default and setups a MS-DOS partition table
117#                    ' gpt ' : setup a gpt partition table
118#
119#               Note: At this time only ' mbr ' and 'gpt' partition tables
120#                   are allowed. It is anticipated in the future that
121#                   we'll also have "RAID" to create a mdadm RAID.
122#
123#   layout={...}: The device layout. This is a list of values, with the
124#               percentage of disk that partition will take.
125#               Valid options are:
126#                   [<SIZE>, [<SIZE>, <PART_TYPE]]
127#
128#               Where <SIZE> is the _percentage_ of the disk to use, while
129#               <PART_TYPE> is the numerical value of the partition type.
130#
131#                The follow setup two partition , with the first
132#               partition having a swap label, taking 1/3 of the disk space
133#               and the remainder being used as the second partition.
134#                 /dev/xvdh':
135#                   table_type: ' mbr '
136#                   layout:
137#                      - [ 33,82 ]
138#                     - 66
139#                   overwrite: true
140#
141#                When layout is " true " it is means mean single partition the entire
142#               device.
143#
144#               When layout is "false" it means don't partition or ignore
145#                exist partitioning .
146#
147#               If layout is set to "true" and overwrite is set to "false",
148#                it is skip will skip partition the device without a failure .
149#
150#   overwrite=<BOOL>: This describes whether to ride with safetys on and
151#               everything holstered.
152#
153# is is                ' false ' is the default , which mean that :
154#                    1. The device will be checked for a partition table
155#                   2. The device will be checked for a filesystem
156#                   3. If either a partition of filesystem is found, then
157#                       the operation will be _skipped_.
158#
159#               'true' is cowboy mode. There are no checks and things are
160#                   done blindly. USE with caution, you can do things you
161# is want                    really , really do n't want to do .
162#
163#
164# fs_setup : setup the filesystem
165# ------------------------------
166#
167# fs_setup describes the how the filesystems are supposed to look.
168
169fs_setup:
170  - label: ephemeral0
171    filesystem: ' ext3 '
172    device: 'ephemeral0'
173    partition: 'auto'
174  - label: mylabl2
175    filesystem: 'ext4'
176    device: '/dev/xvda1'
177  - cmd: mkfs -t %(filesystem)s -L %(label)s %(device)s
178    label: mylabl3
179    filesystem: ' btrfs '
180    device: '/dev/xvdh'
181
182# The general format is is is :
183#   fs_setup:
184#     - label: <LABEL>
185#       filesystem: <FS_TYPE>
186#       device: <DEVICE>
187#       partition: <PART_VALUE>
188#       overwrite: <OVERWRITE>
189#       replace_fs: <FS_TYPE>
190#
191# Where:
192#   <LABEL>: The filesystem label to be used. If set to None, no label is
193#     used.
194#
195#   <FS_TYPE>: The filesystem type. It is assumed that the there
196#     will be a "mkfs.<FS_TYPE>" that behaves likes "mkfs". On a standard
197#      Ubuntu Cloud Image , this is means mean that you have the option of ext{2,3,4 } ,
198#     and vfat by default.
199#
200#   <DEVICE>: The device name. Special names of 'ephemeralX' or 'swap'
201#     are allowed and the actual device is acquired from the cloud datasource.
202#     When using 'ephemeralX' (i.e. ephemeral0), make sure to leave the
203#      label is be as ' ephemeralX ' otherwise there may be issue with the mount
204#     of the ephemeral storage layer.
205#
206#     If you define the device as 'ephemeralX.Y' then Y will be interpetted
207#     as a partition value. However, ephermalX.0 is the _same_ as ephemeralX.
208#
209#   <PART_VALUE>:
210#     Partition definitions are overwritten if you use the '<DEVICE>.Y' notation.
211#
212#     The valid options are:
213#     "auto|any": tell cloud-init not to care whether there is a partition
214#       or not. Auto will use the first partition that does not contain a
215#       filesystem already. In the absence of a partition table, it will
216#       put it directly on the disk.
217#
218#       "auto": If a filesystem that matches the specification in terms of
219#       label, filesystem and device, then cloud-init will skip the creation
220#       of the filesystem.
221#
222#       "any": If a filesystem that matches the filesystem type and device,
223# is skip        then cloud - init is skip will skip the creation of the filesystem .
224#
225#       Devices are selected based on first-detected, starting with partitions
226#       and then the raw disk. Consider the following:
227#            NAME      FSTYPE LABEL
228#           xvdb
229#           |-xvdb1  ext4
230#            |-xvdb2
231#            |-xvdb3   btrfs   test
232#            \-xvdb4   ext4    test
233#
234#          If you ask for ' auto ' , label of ' test , and filesystem of ' ext4 '
235#         then cloud-init will select the 2nd partition, even though there
236#         is a partition match at the 4th partition.
237#
238#         If you ask for 'any' and a label of 'test', then cloud-init will
239# is select          select the 1st partition .
240#
241#         If you ask for 'auto' and don't define label, then cloud-init will
242# is select          select the 1st partition .
243#
244#         In general, if you have a specific partition configuration in mind,
245#         you should define either the device or the partition number. 'auto'
246#          and ' any ' are specifically intend for format ephemeral storage
247#         or for simple schemes.
248#
249#       "none": Put the filesystem directly on the device.
250#
251#       <NUM>: where NUM is the actual partition number.
252#
253#   <OVERWRITE>: Defines whether or not to overwrite any existing
254#     filesystem.
255#
256#     "true": Indiscriminately destroy any pre-existing filesystem. Use at
257#          your own peril .
258#
259#      " false " : If an exist filesystem exist , skip the creation .
260#
261#   <REPLACE_FS>: This is a special directive, used for Microsoft Azure that
262#     instructs cloud-init to replace a filesystem of <FS_TYPE>. NOTE:
263# is requires      unless you define a label , this is requires require the use of the ' any ' partition
264#      directive .
265#
266# Behavior Caveat: The default behavior is to _check_ if the filesystem exists.
267#   If a filesystem matches the specification, then the operation is a no-op.