Skip to content

Commit

Permalink
doc: add doc for custom config modules (canonical#5548)
Browse files Browse the repository at this point in the history
SC-1836
Fixes canonicalGH-4649
  • Loading branch information
aciba90 committed Jul 25, 2024
1 parent 98907d5 commit 6e5f22e
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 0 deletions.
11 changes: 11 additions & 0 deletions doc/rtd/development/module_creation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,17 @@ in the correct location based on dependencies. If your module has no particular
dependencies or is not necessary for a later boot stage, it should be placed
in the ``cloud_final_modules`` section before the ``final-message`` module.

Benefits of including your config module in upstream cloud-init
===============================================================

Config modules included in upstream cloud-init benefit from ongoing
maintenance,
compatibility with the rest of the codebase, and security fixes by the upstream
development team.

If this is not possible, one can add
:ref:`custom out-of-tree config module<custom_configuration_module>`
to cloud-init.

.. _MetaSchema: https://github.com/canonical/cloud-init/blob/3bcffacb216d683241cf955e4f7f3e89431c1491/cloudinit/config/schema.py#L58
.. _OSFAMILIES: https://github.com/canonical/cloud-init/blob/3bcffacb216d683241cf955e4f7f3e89431c1491/cloudinit/distros/__init__.py#L35
Expand Down
2 changes: 2 additions & 0 deletions doc/rtd/reference/base_config_reference.rst
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ distribution supported by ``cloud-init``.
Base configuration keys
=======================

.. _base_config_module_keys:

Module keys
-----------

Expand Down
14 changes: 14 additions & 0 deletions doc/rtd/reference/custom_modules/custom_configuration_module.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,17 @@

Custom Configuration Module
***************************

Custom 3rd-party out-of-tree configuration modules can be added to cloud-init
by:

#. :ref:`Implement a config module<module_creation>` in a Python file with its
name starting with ``cc_``.

#. Place the file where the rest of config modules are
On Ubuntu this path is typically:
`/usr/lib/python3/dist-packages/cloudinit/config/`.

#. Extend the :ref:`base-configuration's <base_config_module_keys>`
``cloud_init_modules``, ``cloud_config_modules`` or ``cloud_final_modules``
to let the config module run on one of those stages.

0 comments on commit 6e5f22e

Please sign in to comment.