Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/fabacab/cloud-init-vagrant-example

Bare-bones example for testing a cloud-init cloud config script in a local Vagrant development environment.
https://github.com/fabacab/cloud-init-vagrant-example

Last synced: about 2 months ago
JSON representation

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

Awesome Lists containing this project

README

        

# `cloud-init` Vagrant Example

This repository showcases a bare-bones, thoroughly documented example in which one can test [`cloud-init`](https://cloud-init.io/) configurations locally by using [Vagrant](https://www.vagrantup.com/) 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](https://virtualbox.org/), [VMware](https://www.vmware.com/), [Hyper-V](https://docs.microsoft.com/en-us/virtualization/hyper-v-on-windows/), [Linux KVM](https://www.linux-kvm.org/), and other host-based virtual machine managers for which it has an installed [provider](https://www.vagrantup.com/docs/providers/). *Cloud-init* is an industry standard mechanism for running (usually) one-time configuration commands on generic Operating System base images such as [AMIs](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/AMIs.html) or [GCE images](https://cloud.google.com/compute/docs/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](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-instance-metadata.html) 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](https://www.digitalocean.com/docs/droplets/resources/metadata/) and [Azure Instance Metadata Service](https://docs.microsoft.com/en-us/azure/virtual-machines/windows/instance-metadata-service).

This example Vagrant project shows how to use the [cloud-init NoCloud datasource](https://cloudinit.readthedocs.io/en/latest/topics/datasources/nocloud.html) 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](https://cloudinit.readthedocs.io/en/latest/topics/examples.html) on your local development environment before you ever hit a public (and often not entirely monetarily free) API.