Skip to content

Commit

Permalink
bring back section headers
Browse files Browse the repository at this point in the history
  • Loading branch information
TheRealFalcon committed Jul 26, 2024
1 parent fd81070 commit f4e3094
Showing 1 changed file with 36 additions and 18 deletions.
54 changes: 36 additions & 18 deletions doc/rtd/explanation/format.rst
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ Cloud config data
| **Header:** #cloud-config
| **Content-Type:** text/cloud-config
**Example**
Example
-------

.. code-block:: yaml
Expand All @@ -55,7 +56,8 @@ Cloud config data
chpasswd:
expire: False
**Explanation**
Explanation
-----------

Cloud-config can be used to define how an instance should be configured
in a human-friendly format. The cloud config format uses `YAML`_ with
Expand Down Expand Up @@ -84,14 +86,16 @@ User data script
| **Header:** #!
| **Content-Type:** text/x-shellscript
**Example**
Example
-------

.. code-block:: shell
#!/bin/sh
echo "Hello World" > /var/tmp/output.txt
**Explanation**
Explanation
-----------

A user data script is a single shell script to be executed once per instance.
User data scripts are run relatively late in the boot process, during the
Expand All @@ -105,15 +109,17 @@ Cloud boothook
| **Header:** #cloud-boothook
| **Content-Type:** text/cloud-boothook
**Simple Example**
Simple Example
--------------

.. code-block:: shell
#cloud-boothook
#!/bin/sh
echo 192.168.1.130 us.archive.ubuntu.com > /etc/hosts
**Example of once-per-instance script**
Example of once-per-instance script
-----------------------------------

.. code-block:: bash
Expand All @@ -131,7 +137,8 @@ Cloud boothook
fi
sudo echo $INSTANCE_ID > $PERSIST_ID
**Explanation**
Explanation
-----------

A cloud boothook is similar to a :ref:`user data script<user_data_script>`
in that it is a shell script run on boot. The boothook is different in that:
Expand All @@ -148,7 +155,8 @@ MIME multi-part archive
| **Header:** Content-Type: multipart/mixed;
| **Content-Type:** multipart/mixed
**Example**
Example
-------

.. code-block::
Expand All @@ -175,7 +183,8 @@ MIME multi-part archive
- echo "this is from a cloud-config." > /var/tmp/bootcmd.txt
--===============2389165605550749110==--
**Explanation**
Explanation
-----------

Using a MIME multi-part file, the user can specify more than one type of data.

Expand Down Expand Up @@ -242,7 +251,8 @@ Cloud config archive
| **Header:** #cloud-config-archive
| **Content-Type:** text/cloud-config-archive
**Example**
Example
-------

.. code-block:: shell
Expand All @@ -256,7 +266,8 @@ Cloud config archive
bootcmd:
- echo "this is from a cloud-config." > /var/tmp/bootcmd.txt
**Explanation**
Explanation
-----------

A cloud-config-archive is a way to specify more than one type of data
using YAML. It can be seen as an alternative to building a MIME multi-part
Expand All @@ -283,7 +294,8 @@ Jinja template
| **Header:** ## template: jinja
| **Content-Type:** text/jinja
**Example cloud-config**
Example cloud-config
--------------------

.. code-block:: yaml
Expand All @@ -292,15 +304,17 @@ Jinja template
runcmd:
- echo 'Running on {{ v1.cloud_name }}' > /var/tmp/cloud_name
**Example user data script**
Example user data script
------------------------

.. code-block:: shell
## template: jinja
#!/bin/sh
echo 'Current instance id: {{ v1.instance_id }}' > /var/tmp/instance_id
**Explanation**
Explanation
-----------

`Jinja templating <https://jinja.palletsprojects.com/>`_ may be used for
cloud-config and user data scripts. Any
Expand All @@ -319,15 +333,17 @@ Include file
| **Header:** #include
| **Content-Type:** text/x-include-url
**Example**
Example
-------

.. code-block:: text
#include
https://raw.githubusercontent.com/canonical/cloud-init/403f70b930e3ce0f05b9b6f0e1a38d383d058b53/doc/examples/cloud-config-run-cmds.txt
https://raw.githubusercontent.com/canonical/cloud-init/403f70b930e3ce0f05b9b6f0e1a38d383d058b53/doc/examples/cloud-config-boot-cmds.txt
**Explanation**
Explanation
-----------

An include file contains a list of URLs, one per line. Each of the URLs will
be read and their content can be any kind of user data format, both base
Expand All @@ -351,13 +367,15 @@ Part handler
| **Header:** #part-handler
| **Content-Type:** text/part-handler
**Example**
Example
-------

.. literalinclude:: ../../examples/part-handler.txt
:language: python
:linenos:

**Explanation**
Explanation
-----------

A part handler contains custom code for either supporting new
mime-types in multi-part user data or for overriding the existing handlers for
Expand Down

0 comments on commit f4e3094

Please sign in to comment.