以前、cloud-initでEBSのリサイズを起動時に自動で行う(CentOS6)の記事を紹介しましたが、 cloud-initは他にも起動時に自動でできる処理があり、今回は/etc/hostsにホスト名を追加する 設定方法を紹介します。 (上記でcloud-initが導入済みとします) ○/etc/hostsの確認 通常通りのものが入っています。 # cat /etc/hosts 127.0.0.1 localhost.localdomain localhost ○/etc/cloud/cloud.cfgの設定 /etc/hostsファイルにホスト名を追加するにはupdate_etc_hostsです。 # cat /etc/cloud/cloud.cfg manage_etc_hosts: localhost cloud_init_modules: - resizefs - update