File: custom_clean_scripts.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 (25 lines) | stat: -rw-r--r-- 866 bytes parent folder | download | duplicates (2)
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
.. _custom_clean_scripts:

Custom Clean Scripts
********************

Cloud-init provides the directory :file:`/etc/cloud/clean.d/` for third party
applications which need additional configuration artifact cleanup from
the filesystem when the :ref:`cloud-init clean<cli_clean>` command is invoked.

The :command:`clean` operation is typically performed by image creators
when preparing a golden image for clone and redeployment. The clean command
removes any cloud-init internal state, allowing cloud-init to treat the next
boot of this image as the "first boot".
Any executable scripts in this subdirectory will be invoked in lexicographical
order when running the :command:`clean` command.

Example
=======

.. code-block:: bash

   $ cat /etc/cloud/clean.d/99-live-installer
   #!/bin/sh
   sudo rm -rf /var/lib/installer_imgs/
   sudo rm -rf /var/log/installer/