/usr/share/doc/cloud-init/examples
NameSizeModeActions
seed/-0755rm
boothook.txt800644editdlrm
cloud-config-add-apt-repos.txt15730644editdlrm
cloud-config-ansible-controller.txt73630644editdlrm
cloud-config-ansible-managed.txt38230644editdlrm
cloud-config-ansible-pull.txt3410644editdlrm
cloud-config-apt.txt129940644editdlrm
cloud-config-archive-launch-index.txt8020644editdlrm
cloud-config-archive.txt2390644editdlrm
cloud-config-boot-cmds.txt4060644editdlrm
cloud-config-ca-certs.txt11840644editdlrm
cloud-config-chef-oneiric.txt34550644editdlrm
cloud-config-chef.txt42030644editdlrm
cloud-config-datasources.txt23220644editdlrm
cloud-config-disk-setup.txt90840644editdlrm
cloud-config-gluster.txt4560644editdlrm
cloud-config-install-packages.txt3830644editdlrm
cloud-config-launch-index.txt5700644editdlrm
cloud-config-lxd.txt18140644editdlrm
cloud-config-mount-points.txt15040644editdlrm
cloud-config-ntp.txt8350644editdlrm
cloud-config-reporting.txt3350644editdlrm
cloud-config-run-cmds.txt9630644editdlrm
cloud-config-ssh-keys.txt22890644editdlrm
cloud-config-update-apt.txt2290644editdlrm
cloud-config-update-packages.txt930644editdlrm
cloud-config-user-groups.txt68230644editdlrm
cloud-config-wireguard.txt11830644editdlrm
cloud-config-write-files.txt10780644editdlrm
cloud-config-yum-repo.txt8970644editdlrm
cloud-config.txt165590644editdlrm
include-once.txt3530644editdlrm
include.txt4340644editdlrm
kernel-command-line.txt10290644editdlrm
network-config-v1-bonded-pair.yaml4280644editdlrm
network-config-v1-bonded-vlan.yaml5080644editdlrm
network-config-v1-bridge.yaml6380644editdlrm
network-config-v1-multiple-vlan.yaml12080644editdlrm
network-config-v1-nameserver.yaml4030644editdlrm
network-config-v1-physical-3-nic.yaml4430644editdlrm
network-config-v1-physical-dhcp.yaml1000644editdlrm
network-config-v1-route.yaml3210644editdlrm
network-config-v1-subnet-dhcp.yaml1510644editdlrm
network-config-v1-subnet-multiple.yaml3640644editdlrm
network-config-v1-subnet-routes.yaml5270644editdlrm
network-config-v1-subnet-static.yaml3480644editdlrm
network-config-v1-vlan.yaml2530644editdlrm
part-handler-v2.txt15620644editdlrm
part-handler.txt20810644editdlrm
plain-ignored.txt680644editdlrm
user-script.txt1250644editdlrm
Edit: /usr/share/doc/cloud-init/examples/part-handler-v2.txt (1562B)
#part-handler # vi: syntax=python ts=4 # this is an example of a version 2 part handler. # the differences between the initial part-handler version # and v2 is: # * handle_part receives a 5th argument, 'frequency' # frequency will be either 'always' or 'per-instance' # * handler_version must be set # # A handler declaring version 2 will be called on all instance boots, with a # different 'frequency' argument. handler_version = 2 def list_types(): # return a list of mime-types that are handled by this module return(["text/plain", "text/go-cubs-go"]) def handle_part(data, ctype, filename, payload, frequency): # data: the cloudinit object # ctype: '__begin__', '__end__', or the specific mime-type of the part # filename: the filename for the part, or dynamically generated part if # no filename is given attribute is present # payload: the content of the part (empty for begin or end) # frequency: the frequency that this cloud-init run is running for # this is either 'per-instance' or 'always'. 'per-instance' # will be invoked only on the first boot. 'always' will # will be called on subsequent boots. if ctype == "__begin__": print(f"my handler is beginning, frequency={frequency}") return if ctype == "__end__": print(f"my handler is ending, frequency={frequency}") return print(f"==== received ctype={ctype} filename={filename} ====") print(payload) print(f"==== end ctype={ctype} filename={filename}")