TEXT   41

var lib cloud

Guest on 17th May 2022 01:29:47 AM

  1. /var/lib/cloud has the following structure:
  2.   - scripts/
  3.       per-instance/
  4.       per-boot/
  5.       per-once/
  6.  
  7.     files in these directories will be run by 'run-parts' once per
  8.     instance, once per boot, and once per *ever*.
  9.  
  10.   - seed/
  11.      <datasource>/
  12.         sys-user-data
  13.         user-data
  14.         meta-data
  15.  
  16.      The 'seed/' directory allows you to seed a specific datasource
  17.      For example, to seed the 'nocloud' datasource you would need to
  18.      populate
  19.        seed/nocloud/user-data
  20.        seed/nocloud/meta-data
  21.  
  22.   - instance -> instances/i-abcde
  23.     This is a symlink to the current instance/<instance-id> directory
  24.     created/updated on boot
  25.   - instances/
  26.       i-abcdefgh/
  27.          scripts/ # all scripts in scripts are per-instance
  28.          sem/
  29.             config-puppet
  30.             config-ssh
  31.             set-hostname
  32.          cloud-config.txt
  33.          user-data.txt
  34.          user-data.txt.i
  35.          obj.pkl
  36.          handlers/
  37.          data/  # just a per-instance data location to be used
  38.          boot-finished
  39.             # this file indicates when "boot" is finished
  40.             # it is created by the 'final_message' cloud-config
  41.          datasource # a file containing the class and string of datasource
  42.  
  43.   - sem/
  44.       scripts.once
  45.     These are the cloud-specific semaphores.  The only thing that
  46.     would go here are files to mark that a "per-once" script
  47.     has run.
  48.  
  49.   - handlers/
  50.       "persistent" handlers (not per-instance).  Same as handlers
  51.       from user-data, just will be cross-instance id
  52.  
  53.   - data/
  54.       this is a persistent data location.  cloud-init won't really
  55.       use it, but something else (a handler or script could)
  56.       previous-datasource
  57.       previous-instance-id
  58.       previous-hostname
  59.  
  60. to clear out the current instance's data as if to force a "new run" on reboot
  61. do:
  62.   ( cd /var/lib/cloud/instance && sudo rm -Rf * )

Raw Paste


Login or Register to edit or fork this paste. It's free.