fabacab / cloud-init-vagrant-example

Bare-bones example for testing a cloud-init cloud config script in a local Vagrant development environment.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

cloud-init Vagrant Example

This repository showcases a bare-bones, thoroughly documented example in which one can test cloud-init configurations locally by using Vagrant to provision a virtual machine without requiring access to an Amazon Web Services (AWS), Google Cloud Platform (GCP), or other public cloud provider account.

Vagrant is a virtual machine hypervisor automation utility capable of automatically creating virtual machines in VirtualBox, VMware, Hyper-V, Linux KVM, and other host-based virtual machine managers for which it has an installed provider. Cloud-init is an industry standard mechanism for running (usually) one-time configuration commands on generic Operating System base images such as AMIs or GCE images in order to customize them during the instance's (first) boot. This makes it easier to build generic "gold master" images of your software distribution that can nevertheless be optimized for specific public or private cloud environments.

Testing your cloud-init configurations can be difficult if you do not have access to such a public cloud environment because the cloud infrastructure provider (i.e., "Infrastructure as a Service" or IaaS platform) often delivers metadata about the environment to the compute instances that you launch. For example, the Amazon Instance Metadata Service can be queried from a newly-launched instance at the magic http://169.254.169.254/ URL. Other cloud providers have their own implementations of instance metadata services. For example, DigitalOcean Droplet Metadata and Azure Instance Metadata Service.

This example Vagrant project shows how to use the cloud-init NoCloud datasource to deliver both platform-provided instance meta- and optional user-supplied instance "user-data" to cloud-init-enabled Vagrant base boxes so that you can more easily experiment with and test various cloud-init scripts on your local development environment before you ever hit a public (and often not entirely monetarily free) API.

About

Bare-bones example for testing a cloud-init cloud config script in a local Vagrant development environment.


Languages

Language:Shell 100.0%