GithubHelp home page GithubHelp logo

isabella232 / dsc-test-bootstrap Goto Github PK

View Code? Open in Web Editor NEW

This project forked from chef-boneyard/dsc-test-bootstrap

0.0 0.0 0.0 30 KB

Enables test execution of PowerShell DSC resources

License: Apache License 2.0

Ruby 73.99% PowerShell 26.01%

dsc-test-bootstrap's Introduction

dsc-test-bootstrap-cookbook

Build Status

The purpose of this cookbook is to bootstrap up machines to test the DSC script resource

This cookbook installs powershell/git and pulls down a version of chef specified by attributes. It then uses that version of chef to run a recipe in local mode (Local mode is run with a different lock file)

Requirements

Platforms

  • Windows 2012

Chef

  • Chef 12+

Cookbooks

  • windows
  • powershell
  • git
  • chocolatey

Attributes

Key Type Description
['dsc-test-bootstrap']['github_owner'] String The owner of the github repository for chef
['dsc-test-bootstrap']['github_repo'] String The github repo containing chef
['dsc-test-bootstrap']['git_revision'] String The git revision to checkout

Usage

Requirements

You will need to have knife, knife-azure, and knife-windows. At the time of writing this(knife windows latest release was 0.6.0 42c358e), knife-windows needed to be checked out and installed from https://github.com/opscode/knife-windows

bootstrap.ps1

Provided is a script to create a node in azure and register it to your chef server.

Below is an example of my knife.rb

current_dir = File.dirname(__FILE__)
log_level                :info
log_location             STDOUT
client_key               "#{current_dir}/jdmundrawala.pem"
validation_client_name   "mundrawala-test-validator"
validation_key           "#{current_dir}/mundrawala-test-validator.pem"
chef_server_url          "https://api.opscode.com/organizations/mundrawala-test"
cache_type               'BasicFile'
cache_options( :path => "#{ENV['HOME']}/.chef/checksums" )

knife[:azure_publish_settings_file] = "c:/users/Jay\ Mundrawala/myazure.publishsettings"
knife[:azure_vm_size] = "Medium"
knife[:azure_source_image] = "a699494373c04fc0bc8f2bb1389d6106__Windows-Server-2012-R2-201407.01-en.us-127GB.vhd"
knife[:azure_service_location] = "West US"
knife[:bootstrap_protocol] = "winrm"
knife[:winrm_user] = "myuser"
knife[:winrm_password] = "mypassword”

Start by getting the cookbook dependencies:

berks install

Upload the cookbooks to your chef server:

berks vendor
knife cookbook upload -a --cookbook-path .\berks-cookbooks\

Create a node in Azure and bootstrap it:

.\bootstrap.ps1 -NodeName mynode -PSVersion 5

Given the knife.rb file above, this command will create a server running windows 2012 in Azure. It will clone https://github.com/opscode/chef, and checkout platform/dsc-phase-1 because the defaults set in bootstrap.ps1

Param(
    [Parameter(Mandatory=$true)]
    [string]$NodeName,
    [string]$GithubOwner = "opscode",
    [string]$GithubRepo = "chef",
    [string]$GitRevision = "platform/dsc-phase-1",
    [string]$PSVersion = 4,
    [switch]$ClientRunOnly
)

Part of the bootstrap will run the version of chef client that was checked out from github. This will run

bundle exec chef-client -z test_recipe.rb > log

test_recipe.rb is in the files/default directory.

Now say you make a change to files/default/test_recipe.rb (or anything in this cookbook). If you do not require a clean machine, upload your updated cookbooks to your chef server, and run

.\bootstrap.ps1 -NodeName mynode -ClientRunOnly

License & Authors

Author: Jay Mundrawala ([email protected])

Copyright: 2008-2015, Chef Software, Inc.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

dsc-test-bootstrap's People

Contributors

jaym avatar tas50 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.