Cloud-init: Difference between revisions
Jump to navigation
Jump to search
Line 4: | Line 4: | ||
* http://cloudinit.readthedocs.org/en/latest/topics/examples.html | * http://cloudinit.readthedocs.org/en/latest/topics/examples.html | ||
* https://wiki.archlinux.org/index.php/Cloud-init | * https://wiki.archlinux.org/index.php/Cloud-init | ||
* http://stackoverflow.com/questions/23411408/how-do-i-set-up-cloud-init-on-custom-amis-in-aws-centos | |||
=Internal= | =Internal= |
Revision as of 18:42, 16 March 2021
External
- https://cloudinit.readthedocs.io/en/latest/
- http://cloudinit.readthedocs.org/en/latest/topics/examples.html
- https://wiki.archlinux.org/index.php/Cloud-init
- http://stackoverflow.com/questions/23411408/how-do-i-set-up-cloud-init-on-custom-amis-in-aws-centos
Internal
Read before going further
TODO:
Overview
Cloud-init is an industry standard method for cross-platform cloud instance initialization. It is supported across all major cloud providers.
Cloud instances are initialized from a disk image and instance data. Instance data consists of:
- Cloud metadata
- User data
- Vendor data
Cloud-init identifies during boot the cloud the instance is running, reads any provided cloud metadata from the cloud and initializes the system accordingly - sets up network, storage, SSH access, etc. Cloud-init then parses and processes user data, if available and vendor data, if available.
The cloud-init runtime is written in python.
Configuration
/etc/cloud/cloud.cfg
Example
users: - default disable_root: 1 ssh_pwauth: 0 mount_default_fields: [~, ~, 'auto', 'defaults,nofail', '0', '2'] resize_rootfs_tmp: /dev ssh_deletekeys: 0 ssh_genkeytypes: ~ syslog_fix_perms: ~ cloud_init_modules: - migrator - bootcmd - write-files - growpart - resizefs - rsyslog - users-groups - ssh cloud_config_modules: - mounts - locale - set-passwords - yum-add-repo - package-update-upgrade-install - timezone - puppet - chef - salt-minion - mcollective - disable-ec2-metadata - runcmd cloud_final_modules: - rightscale_userdata - scripts-per-once - scripts-per-boot - scripts-per-instance - scripts-user - ssh-authkey-fingerprints - keys-to-console - phone-home - final-message system_info: default_user: name: ec2-user lock_passwd: true gecos: Cloud User groups: [wheel, adm, systemd-journal] sudo: ["ALL=(ALL) NOPASSWD:ALL"] shell: /bin/bash distro: rhel paths: cloud_dir: /var/lib/cloud templates_dir: /etc/cloud/templates ssh_svcname: sshd # vim:syntax=yaml
Setting hostname
Done by the following modules, that work with systemd-hostnamed:
... cloud_init_modules: ... - set_hostname - update_hostname - update_etc_hosts ...