Giter Site home page Giter Site logo

nawed005 / devops-workstream Goto Github PK

View Code? Open in Web Editor NEW

This project forked from lightenna/devops-workstream

0.0 0.0 0.0 386 KB

A set of infrastructure-as-code examples to help those getting started with DevOps tools

License: MIT License

Shell 7.96% JavaScript 0.42% Ruby 2.31% Python 0.25% Go 0.65% Puppet 28.60% PowerShell 0.06% HTML 0.66% Smarty 0.45% HCL 57.86% Dockerfile 0.73% Jinja 0.04%

devops-workstream's Introduction

Workstream

About

This repo contains an example set of Terraform modules, Packer templates, Ansible Playbooks, Chef Recipes and Puppet manifests that provision and configure a set of machines in various clouds such as AWS and Azure. It's designed to help coders get started in DevOps.

Getting started

This repo is designed to be a simple starting point for infrastructure-as-code projects. Invariably, you'll need some tools to build that infrastructure and credentials to secure access to it. The setup of both is described here:

If you've used the default key name and path (described above), then to see what terraform plans to build out in the default region (eu-west-2):

terraform plan

If it seems sensible, apply it:

terraform apply

Look at what you've created in the AWS console!

Shutting down

Most important of all while developing IAC, clear it up afterwards:

terraform destroy

Also be aware that while terraform destroy will remove all the instantiated hosts/security groups/subnets/VPCs etc., it will not remove everything. You'll need to use the AWS console to manually deregister/delete:

  • Volumes belonging to hosts instantiated by Terraform
    • After multiple terraform-plan-apply-destroy cycles, you can easily accumulate a few dozen volumes. These will persist (at a cost) unless explicitly removed.
  • AMIs produced by Packer
    • Also the Snapshots that Packer produces as an intermediate file.

File structure

This repo is organised at the top-level by technology.

  • /bin - a few scripts to hold useful commands for reference
  • /docs - markdown-formatted documents describing the examples in this repo

Image creation and orchestration

  • /packer - a set of Packer templates
    • centos_updates.json - create updated AMI image based on CentOS 7 (cross-region)
    • remprov/remote_provisioning.json - create AMI image based on CentOS 7, including this repo with all pre-requisites installed

Config management

  • /ansible - an ansible control folder (/etc/ansible) containing an array of playbooks and roles
    • roles
      • common - a simple common role shared across all playbooks
  • /puppet - a Puppet control folder (/etc/puppet) containing an array of environments and modules
    • environments
      • workstream - the main workstream template environment
        • manifests - puppet manifests
          • host-<hostname>.pp - puppet masterless manifest, called directly with puppet apply
          • site.pp - general environment master manifest, server via Puppet master
        • modules - environment specific modules
    • modules - community modules

Provisioning

  • /terraform - a collection of terraform root modules to provision machines.
    • aws_basic - terraform apply produces a set of resources in AWS
    • azure_basic - terraform apply produces a set of resources in Azure
    • playspace - terraform apply produces nothing (as yet). This is an empty root module for you to experiment with
    • shared - a collection of submodules that abstract some of the complexity for different operations
      • ansible - a terraform module to set up a generic host and invoke ansible on it locally
      • aws_background - a terraform module to set up a basic AWS environment
      • pack_amis - a terraform module to invoke packer
      • packer - a terraform module to instantiate a host from a packed machine image
      • puppetmless - a terraform module to set up a generic host and invoke puppet apply on it locally

Testing

To run the integration test suite in /tests/awspec, you need install the gems bundle install

The test run command is as simple as bundle exec rake spec after a successful terraform apply, but you need explicitly set the region environment variable:

AWS_DEFAULT_REGION="eu-west-2" bundle exec rake spec

Security

All hosts are built with SELinux enabled (enforcing). While every effort has been made to build these examples in the right way, new vectors are being discovered everyday. Keep yourself safe by validating hashes for everything you download and run, locking down your environment with passworded rotated keys, etc. Read the LICENSE carefully.

Documentation

We've taken the same simple approach to documentation. It's all in markdown-formatted .md files, linked directly from the documentation README.md.

Forking

Should you fork from this repo, you may like to pull upstream changes, something like:

git pull [email protected]:lightenna/devops-workstream.git master

Version 2.0

This project started out as a training course that I designed and ran at the Department of Work and Pensions. Since leaving it's no longer being maintained. In response to a few requests, I'll try to find time to continue to develop it open-source. If you've got questions about the course or using it to train your team, please get in touch.

devops-workstream's People

Contributors

cleverlight 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.