File: configdrive.rst

package info (click to toggle)
cloud-init 25.3-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 12,412 kB
  • sloc: python: 135,894; sh: 3,883; makefile: 141; javascript: 30; xml: 22
file content (141 lines) | stat: -rw-r--r-- 4,382 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
.. _datasource_config_drive:

Config drive
************

The configuration drive datasource supports the `OpenStack`_ configuration
drive disk.

By default, ``cloud-init`` *always* considers this source to be a
fully-fledged datasource. Instead, the typical behavior is to assume it is
really only present to provide networking information. ``Cloud-init`` will
copy the network information, apply it to the system, and then continue on.
The "full" datasource could then be found in the EC2 instance metadata service.
If this is not the case then the files contained on the located drive must
provide equivalents to what the EC2 instance metadata service would provide
(which is typical of the version 2 support listed below).

.. note::
   See `the config drive extension`_ and `meta-data introduction`_ in the
   public documentation for more information.

.. dropdown:: Version 1 (deprecated)

   **Note: Version 1 is legacy and should be considered deprecated.
   Version 2 has been supported in OpenStack since 2012.2 (Folsom).**

   The following criteria are required to use a config drive:

        1. Must be formatted with `vfat`_ filesystem.
        2. Must contain *one* of the following files: ::

            /etc/network/interfaces
            /root/.ssh/authorized_keys
            /meta.js

        ``/etc/network/interfaces``

            This file is laid down by nova in order to pass static networking
            information to the guest. ``Cloud-init`` will copy it off of the
            config-drive and into /etc/network/interfaces (or convert it to RH
            format) as soon as it can, and then attempt to bring up all network
            interfaces.

        ``/root/.ssh/authorized_keys``

            This file is laid down by nova, and contains the ssk keys that were
            provided to nova on instance creation (nova-boot --key ....)

        ``/meta.js``

            meta.js is populated on the config-drive in response to the user
            passing "meta flags" (nova boot --meta key=value ...). It is
            expected to be json formatted.


Version 2
=========

The following criteria are required to use a config drive:

1. Must be formatted with `vfat`_ or `iso9660`_ filesystem, or have a
   *filesystem* label of ``config-2`` or ``CONFIG-2``.
2. The files that will typically be present in the config drive are: ::

    openstack/
      - 2012-08-10/ or latest/
        - meta_data.json
        - user_data (not mandatory)
      - content/
        - 0000 (referenced content files)
        - 0001
        - ....
    ec2
      - latest/
        - meta-data.json (not mandatory)

Keys and values
===============

``Cloud-init``'s behaviour can be modified by keys found in the
:file:`meta.js` (version 1 only) file in the following ways.

``ds-mode``
-----------

::

   dsmode:
     values: local, net, pass
     default: pass

This is what indicates if config drive is a final datasource or not. By
default it is 'pass', meaning this datasource should not be read. Set it to
'local' or 'net' to stop ``cloud-init`` from continuing to search for other
datasources after network config.

The difference between 'local' and 'net' is that local will not require
networking to be up before user-data actions are run.

``instance-id``
---------------

::

   instance-id:
     default: iid-dsconfigdrive

This is utilized as the meta-data's instance-id. It should generally
be unique, as it is what is used to determine "is this a new instance?".

``public-keys``
---------------

::

   public-keys:
     default: None

If present, these keys will be used as the public keys for the
instance. This value overrides the content in ``authorized_keys``.

.. note::
   It is likely preferable to provide keys via user-data.

``user-data``
-------------

::

   user-data:
     default: None

This provides ``cloud-init`` user-data. See :ref:`examples <yaml_examples>`
for details of what needs to be present here.

.. _OpenStack: http://www.openstack.org/
.. _meta-data introduction: https://docs.openstack.org/nova/latest/user/metadata.html#config-drives
.. _python-novaclient: https://github.com/openstack/python-novaclient
.. _iso9660: https://en.wikipedia.org/wiki/ISO_9660
.. _vfat: https://en.wikipedia.org/wiki/File_Allocation_Table
.. _the config drive extension: https://docs.openstack.org/nova/latest/admin/config-drive.html