Skip to content

Commit 37b2bfc

Browse files
committed
Fix typos. Add docs about execution order of Cloud-init files, steps, and substeps
Signed-off-by: jjqq2013 <[email protected]>
1 parent 33f51de commit 37b2bfc

File tree

2 files changed

+26
-3
lines changed

2 files changed

+26
-3
lines changed

docs/content/en/docs/Customizing/stages.md

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,35 @@ We have a custom augmented cloud-init syntax that allows to hook into various st
1414
- Network availability
1515
- During upgrades, installation, deployments , and resets
1616

17-
Cloud-init files in `/system/oem`, `/oem` and `/usr/local/oem` are applied in 5 different phases: `boot`, `network`, `fs`, `initramfs` and `reconcile`. All the available cloud-init keywords can be used in each stage. Additionally, it's possible also to hook before or after a stage has run, each one has a specific stage which is possible to run steps: `boot.after`, `network.before`, `fs.after` etc.
17+
Cloud-init files in `/system/oem`, `/oem`, `/usr/local/oem`, and kernel boot args are applied in 5 different phases: `boot`, `network`, `fs`, `initramfs` and `reconcile`. All the available cloud-init keywords can be used in each stage. Additionally, it's possible also to hook before or after a stage has run, each one has a specific stage which is possible to run steps: `boot.after`, `network.before`, `fs.after` etc.
1818

1919
Multiple stages can be specified in a single cloud-init file.
2020

21+
File extension name must be *.yaml or *.yml.
22+
2123
{{% alert title="Note" %}}
22-
When a Elemental derivative boots it creates sentinel files in order to allow to execute cloud-init steps programmaticaly.
24+
When an Elemental derivative boots it creates sentinel files in order to allow executing cloud-init steps programmatically.
2325

2426
- `/run/cos/recovery_mode` is being created when booting from the recovery partition
2527
- `/run/cos/live_mode` is created when booting from the LiveCD
2628

2729
To execute a block using the sentinel files you can specify: `if: '[ -f "/run/cos/..." ]'`, see the examples below.
2830
{{% /alert %}}
2931

32+
At every stage, Elemental derivative parse and execute Cloud-init files in the following order:
33+
- `/system/oem` (Cannot be modified by users)
34+
- `/oem` (Can be modified by users)
35+
- `/usr/local/oem` (Can be modified by users)
36+
- Cloud-init config URL specified in kernel boot args, e.g., cos.setup=http://example.com/cloudinit.cfg
37+
- Cloud-init config encoded in kernel boot args, e.g., stages.network[0].authorized_keys.user=github:user
38+
39+
In each above directory, files are processed in the lexical order of file name.
40+
41+
Unlike the standard Cloud-init, which merges all config files before execution, Elemental derivative executes
42+
Cloud-init files one by one.
43+
44+
Therefore, definitions in later Cloud-init files override what previous files defined, partially or completely.
45+
3046
## Stages
3147

3248
Below there is a detailed list of the stages available that can be used in the cloud-init configuration files

docs/content/en/docs/Reference/cloud_init.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,14 @@ stages:
8585
The default cloud-config format is split into *stages* (*initramfs*, *boot*, *network*, *initramfs*, *reconcile*, called generically **STAGE_ID** below) [see also stages](../../customizing/stages) that are emitted internally during the various phases by calling `cos-setup STAGE_ID`.
8686
*steps* (**STEP_NAME** below) defined for each stage are executed in order.
8787

88-
Each cloud-config file is loaded and executed only at the apprioriate stage, this allows further components to emit their own stages at the desired time.
88+
Each cloud-config file is loaded and executed only at the appropriate stage, this allows further components to emit their own stages at the desired time.
89+
90+
_Note_:
91+
- The execution order of multiple `substeps` (such as `files`, `commands`, `environment` etc.) within a single `step` is not guaranteed.
92+
Therefore, when you have multiple `substeps` that related to each other, please do not define them in a single `step`.
93+
Instead, you can split the `substeps` into multiple `steps` which are ensured to be executed by the definition order.
94+
- The name of `steps` and output of `substeps` will be output to system journal log which can be viewed by the command `journalctl -u 'elemental*'`.
95+
- It is highly recommended to declare the `name` property of *steps*, so that it will be easier to investigate the output of `journalctl -u 'elemental*'` by the name.
8996

9097
{{% pageinfo %}}
9198
The [cloud-init tool](https://github.com/mudler/yip#readme) can be also run standalone, this helps debugging locally and also during development, you can find separate [releases here](https://github.com/mudler/yip/releases).

0 commit comments

Comments
 (0)