-
-
Save sierrezinal/5e6ec1de8d82b969ca100f73bf7942ba to your computer and use it in GitHub Desktop.
Digital Ocean cloud-init / cloud-config / droplet metadata usage
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # | |
| #DO droplet metadata intro + for DO-API | |
| # [https://www.digitalocean.com/community/tutorials/an-introduction-to-droplet-metadata#how-to-retrieve-droplet-metadata#digitalocean-api] | |
| # | |
| #intro to cloud-config scripting (source of following examples) | |
| # [https://www.digitalocean.com/community/tutorials/an-introduction-to-cloud-config-scripting] | |
| # | |
| #howto | |
| # [https://www.digitalocean.com/community/tutorials/how-to-use-cloud-config-for-your-initial-server-setup] | |
| # | |
| #coreos cloud-config docs , validator | |
| # [https://coreos.com/os/docs/latest/cloud-config.html] | |
| # [https://coreos.com/validate/] | |
| # | |
| #see also examples directory inside Droplets | |
| # '/usr/share/doc/cloud-init/examples' | |
| #cloud-config | |
| write_files: | |
| - path: /test.txt | |
| content: | | |
| Here is a line. | |
| Another line is here. | |
| #cloud-config | |
| package_update: true | |
| #cloud-config | |
| package_upgrade: true | |
| #cloud-config | |
| packages: | |
| - package_1 | |
| - package_2 | |
| - [package_3, version_num] | |
| #cloud-config | |
| ssh_authorized_keys: | |
| - ssh_key_1 | |
| - ssh_key_2 | |
| #cloud-config | |
| manage-resolv-conf: true | |
| resolv_conf: | |
| nameservers: | |
| - 'first_nameserver' | |
| - 'second_nameserver' | |
| searchdomains: | |
| - first.domain.com | |
| - second.domain.com | |
| domain: domain.com | |
| options: | |
| option1: value1 | |
| option2: value2 | |
| option3: value3 | |
| #cloud-config | |
| ssh_keys: | |
| rsa_private: | | |
| -----BEGIN RSA PRIVATE KEY----- | |
| your_rsa_private_key | |
| -----END RSA PRIVATE KEY----- | |
| rsa_public: your_rsa_public_key | |
| #cloud-config | |
| ca-certs: | |
| remove-defaults: true | |
| trusted: | |
| - | | |
| -----BEGIN CERTIFICATE----- | |
| your_CA_cert | |
| -----END CERTIFICATE----- | |
| #cloud-config | |
| runcmd: | |
| - [ sed, -i, -e, 's/here/there/g', some_file] | |
| - echo "modified some_file" | |
| - [cat, some_file] | |
| #cloud-config | |
| power_state: | |
| timeout: 120 | |
| delay: "+5" | |
| message: Rebooting in five minutes. Please save your work. | |
| mode: reboot | |
| #--- | |
| #real example: [http://stackoverflow.com/questions/31214080/cloud-init-yaml-script-on-digital-ocean-droplets] | |
| #cloud-config | |
| users: | |
| - name: username | |
| ssh-authorized-keys: | |
| - ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCv60WjxoM39LgPDbiW7ne3gu18q0NIVv0RE6rDLNal1quXZ3nqAlANpl5qmhDQ+GS/sOtygSG4/9aiOA4vXO54k1mHWL2irjuB9XbXr00+44vSd2q/vtXdGXhdSMTf4/XK17fjKSG/9y3yD6nml6 [email protected] | |
| - ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPfb8aT/rawAUH7UBvjNRpg0ed7Jfvj7z0bELrmMhlRl [email protected]_ed25519 | |
| - ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJ+qAaqs5wh0WTccouzoFi+X91xEuIIx/jkwwNGmPE3S [email protected]_ed25519 | |
| - ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCaRyzjkVdfGUwkfwqF7ptNoEZhAeG8E6FmxWvV+5fJzuEJAduPCW3HxXD+DhHN0I7MxfMljdgsRVMcd2CLuMPJU/C0tjnQeTT7T9ME7EmKeko3GaSLhzw1T5k/Dkn9C6gVtChdIxfoyStoPz6mjBd+74q72FsVYnruIKDy+SGAC2cqWj3wfWfcX9B8AyZkb/UAQUsKDhmndl+YUVsccvu3Xo2XgbrnzWPCEZD9gZwSOyZiYXq9SRtz6f4PLXSJnUB38P2QctqjnSCHhsZwRJg/VpZjCieVQ0ILLGFv+US1/U2FFEtLN53GGcyw9d9UTwhhs7m6yik1oKP4ZJbhxJeN mike@x1[2048].id_rsa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/qh1TWrwZZJS1HqP6ZwwQhUSooSLCTy27CXEYtzdrDP+pxDEewIgMrPuw+oNONyNF9ygct12OD1TOS46PGbM/wANDBjF0P0uHLU1jr04J5iT9EgmgOZ/CpnojZbJMRgeXPt4LbshwG9GWSJdwzR3HV83CewV430hvhYvD92F7E/sql/7kf+4lQbkRkvgqZtvLQXbyw/2RBO75Qs/BR+fdGh mnichols@gnstestpc04-gh | |
| sudo: ['ALL=(ALL) NOPASSWD:ALL'] | |
| groups: sudo | |
| shell: /bin/bash |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment