Cloud-init
Jump to navigation
Jump to search
External
- https://cloudinit.readthedocs.io/en/latest/
- http://cloudinit.readthedocs.org/en/latest/topics/examples.html
- https://wiki.archlinux.org/index.php/Cloud-init
Internal
Read before going further
TODO: http://stackoverflow.com/questions/23411408/how-do-i-set-up-cloud-init-on-custom-amis-in-aws-centos
Overview
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 ...