Blame doc/rtd/topics/datasources/openstack.rst

Packit Service a04d08
.. _datasource_openstack:
Packit Service a04d08
Packit Service a04d08
OpenStack
Packit Service a04d08
=========
Packit Service a04d08
Packit Service a04d08
This datasource supports reading data from the
Packit Service a04d08
`OpenStack Metadata Service
Packit Service 751c4a
<https://docs.openstack.org/nova/latest/admin/metadata-service.html>`_.
Packit Service a04d08
Packit Service a04d08
Discovery
Packit Service a04d08
-------------
Packit Service a04d08
To determine whether a platform looks like it may be OpenStack, cloud-init
Packit Service a04d08
checks the following environment attributes as a potential OpenStack platform:
Packit Service a04d08
Packit Service a04d08
 * Maybe OpenStack if
Packit Service a04d08
Packit Service a04d08
   * **non-x86 cpu architecture**: because DMI data is buggy on some arches
Packit Service a04d08
 * Is OpenStack **if x86 architecture and ANY** of the following
Packit Service a04d08
Packit Service a04d08
   * **/proc/1/environ**: Nova-lxd contains *product_name=OpenStack Nova*
Packit Service a04d08
   * **DMI product_name**: Either *Openstack Nova* or *OpenStack Compute*
Packit Service 751c4a
   * **DMI chassis_asset_tag** is *OpenTelekomCloud*, *SAP CCloud VM*,
Packit Service 751c4a
     *OpenStack Nova* (since 19.2) or *OpenStack Compute* (since 19.2)
Packit Service a04d08
Packit Service a04d08
Packit Service a04d08
Configuration
Packit Service a04d08
-------------
Packit Service a04d08
The following configuration can be set for the datasource in system
Packit Service a04d08
configuration (in `/etc/cloud/cloud.cfg` or `/etc/cloud/cloud.cfg.d/`).
Packit Service a04d08
Packit Service a04d08
The settings that may be configured are:
Packit Service a04d08
Packit Service a04d08
 * **metadata_urls**: This list of urls will be searched for an OpenStack
Packit Service a04d08
   metadata service. The first entry that successfully returns a 200 response
Packit Service a04d08
   for <url>/openstack will be selected. (default: ['http://169.254.169.254']).
Packit Service a04d08
 * **max_wait**:  the maximum amount of clock time in seconds that should be
Packit Service a04d08
   spent searching metadata_urls.  A value less than zero will result in only
Packit Service a04d08
   one request being made, to the first in the list. (default: -1)
Packit Service a04d08
 * **timeout**: the timeout value provided to urlopen for each individual http
Packit Service a04d08
   request.  This is used both when selecting a metadata_url and when crawling
Packit Service a04d08
   the metadata service. (default: 10)
Packit Service a04d08
 * **retries**: The number of retries that should be done for an http request.
Packit Service a04d08
   This value is used only after metadata_url is selected. (default: 5)
Packit Service a04d08
 * **apply_network_config**: A boolean specifying whether to configure the
Packit Service a04d08
   network for the instance based on network_data.json provided by the
Packit Service a04d08
   metadata service. When False, only configure dhcp on the primary nic for
Packit Service a04d08
   this instances. (default: True)
Packit Service a04d08
Packit Service a04d08
An example configuration with the default values is provided below:
Packit Service a04d08
Packit Service a04d08
.. sourcecode:: yaml
Packit Service a04d08
Packit Service a04d08
  datasource:
Packit Service 751c4a
    OpenStack:
Packit Service 751c4a
      metadata_urls: ["http://169.254.169.254"]
Packit Service 751c4a
      max_wait: -1
Packit Service 751c4a
      timeout: 10
Packit Service 751c4a
      retries: 5
Packit Service 751c4a
      apply_network_config: True
Packit Service a04d08
Packit Service a04d08
Packit Service a04d08
Vendor Data
Packit Service a04d08
-----------
Packit Service a04d08
Packit Service a04d08
The OpenStack metadata server can be configured to serve up vendor data
Packit Service a04d08
which is available to all instances for consumption.  OpenStack vendor
Packit Service a04d08
data is, generally, a JSON object.
Packit Service a04d08
Packit Service a04d08
cloud-init will look for configuration in the ``cloud-init`` attribute
Packit Service a04d08
of the vendor data JSON object. cloud-init processes this configuration
Packit Service a04d08
using the same handlers as user data, so any formats that work for user
Packit Service a04d08
data should work for vendor data.
Packit Service a04d08
Packit Service a04d08
For example, configuring the following as vendor data in OpenStack would
Packit Service a04d08
upgrade packages and install ``htop`` on all instances:
Packit Service a04d08
Packit Service a04d08
.. sourcecode:: json
Packit Service a04d08
Packit Service a04d08
  {"cloud-init": "#cloud-config\npackage_upgrade: True\npackages:\n - htop"}
Packit Service a04d08
Packit Service a04d08
For more general information about how cloud-init handles vendor data,
Packit Service a04d08
including how it can be disabled by users on instances, see
Packit Service a04d08
:doc:`/topics/vendordata`.
Packit Service a04d08
Packit Service a04d08
.. vi: textwidth=78