GithubHelp home page GithubHelp logo

asmtal / infrastructure-as-cattle Goto Github PK

View Code? Open in Web Editor NEW

This project forked from thehedgefrog/infrastructure-as-cattle

0.0 0.0 0.0 33 KB

Use Packer and Terraform to treat your infrastructure as cattle.

License: MIT License

Shell 5.59% HCL 94.41%

infrastructure-as-cattle's Introduction

Infrastructure as Cattle

This is my implementation of the 'infrastructure as cattle' concept. While this is working for me right now, I will try to keep it up to date with my best practices.

Why?

Homelabbers have a tendency to treat infrastructure as pets. This is something I used to do. That means updating VMs manually, making tons of manual changes and - crucially - being devastated when something happens to your VM, because all that work is lost.

By treating it as cattle, you can build and destroy infrastructure in a few commands, and it will always get created how you want it and fully updated. When you want a cluster, spin it up - when you're done with it, destroy it and don't worry about it.

How to use

Prerequisites

  • A local machine with Ansible, Packer and Terraform installed
  • VMware vSphere 7 (this setup does not work on free ESXi)
  • A good text editor (optional, but highly recommended)
  • Smallstep SSH (optional, free, makes SSH to your machines a breeze)

Creating a template

Your template is your base to customize and work on. Clone this repo on your machine, and go through and customize files.

Validate your config - $~ cd packer then run

  • packer init .
  • packer validate .
  • packer build .

In 15-20 minutes, you will have a fully installed, fully updated, customized template of Ubuntu. This only needs to be updated when you need to make a change to the template itself, or to upgrade the OS version. The Terraform process is independant of this, so you can apply and destroy Terraform resources without touching the template or Packer itself.

Deploying infrastructure

This is where you customize your VMs, decide how many you spin up, and choose what you create.

$~ cd terraform, then

  • terraform init
  • terraform validate
  • terraform plan
  • terraform apply

When you want to get rid of your VMs, run terraform destroy.

Defaults

SSH username SSH password
packer packer

That's it!

infrastructure-as-cattle's People

Contributors

thehedgefrog avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.