Code Monkey home page Code Monkey logo

puppet_repo's Introduction

puppet_repo

puppet repo with serverspec acceptance tests via ssh to a server. The tests are stored in the repository rather than separately in /test/integration (as is the chef format)

This demonstrates using test-kitchen, puppet and kitchen-verifier-serverspec to build and verify a server that is in a cloud and accessible by ssh.

Workstation Software Installation

The first thing you need to do is install the test-kitchen environment on your workstation. A useful link is: http://misheska.com/blog/2013/12/26/set-up-a-sane-ruby-cookbook-authoring-environment-for-chef/

The follow instructions are for Windows PC (it will be similar for Mac):

  1. Download and install the Windows RubyInstaller for 64 bit Ruby 2.1 from http://rubyinstaller.org/downloads.
    • Check the option to add ruby to your path.
  2. Download and install the Windows Ruby DevKit for use with Ruby 2.0 and above (64bits version only) from http://rubyinstaller.org/downloads.
  3. Configure the Ruby DevKit
    • In the devkit directory run “ruby dk.rb init”.
    • Check the config.yml generated has added the the path of the ruby install, if not add it manaully.
    • run “ruby dk.rb install” to bind it to the ruby installation.
  4. Then install the following gems
  • gem install librarian-puppet
  • gem install test-kitchen
  • gem install kitchen-puppet
  • gem install kitchen-ssh
  • gem install kitchen-verifier-serverspec
  1. git clone the repository https://github.com/neillturner/puppet_repo
  2. review settings in the .kitchen.yml file

Check everything installed

In a command window in the puppet_repo directory run command

kitchen list

This will return a list if everyting is correctly installed.

Connect to server via ssh.

kitchen create base-nocm-centos-65 -l debug

Build the server.

kitchen converge base-nocm-centos-65 -l debug

Verify the server.

kitchen verify base-nocm-centos-65 -l debug

Shutdown the server.

kitchen destroy base-nocm-centos-65 -l debug

puppet_repo's People

Contributors

neillturner avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Forkers

petardenev

puppet_repo's Issues

bundler: command not found

Hi there, I'm not sure which component has the problem so I'm only guessing that it's this one.

Getting a failure like this:

-----> Setting up <default-centos-72>...
$$$$$$ Running legacy setup for 'Docker' Driver
       Installing ruby, bundler and serverspec remotely on server
Fetching: bundler-1.12.4.gem (100%)
       Successfully installed bundler-1.12.4
       1 gem installed
       sudo: bundler: command not found
>>>>>> Setup failed on instance <default-centos-72>.
>>>>>> Please see .kitchen/logs/default-centos-72.log for more details
>>>>>> ------Exception-------
>>>>>> Class: Kitchen::ActionFailed
>>>>>> Message: SSH exited (1) for command: [            
            if [ ! $(which ruby) ]; then
              echo '-----> Installing ruby, will try to determine platform os'
              if [ -f /etc/centos-release ] || [ -f /etc/redhat-release ] || [ -f /etc/oracle-release ]; then
                sudo -E yum -y install ruby
              else
                if [ -f /etc/system-release ] || [ grep -q 'Amazon Linux' /etc/system-release ]; then
                  sudo -E yum -y install ruby
                else
                  sudo -E apt-get -y install ruby
                fi
              fi
            fi
                        if [ $(sudo -E gem list bundler -i) == 'false' ]; then
              sudo -E gem install  --no-ri --no-rdoc bundler
            fi

            if [ -d /tmp/kitchen ]; then
                            if [ $(sudo -E gem list serverspec -i) == 'false' ]; then
                        sudo -E rm -f /tmp/kitchen/Gemfile
          sudo -E echo "source 'https://rubygems.org'" >> /tmp/kitchen/Gemfile
          sudo -E echo "gem 'net-ssh','~> 2.9'"  >> /tmp/kitchen/Gemfile
          sudo -E echo "gem 'serverspec'" >> /tmp/kitchen/Gemfile

              sudo -E bundler install --gemfile=/tmp/kitchen/Gemfile
            fi


            else
              echo "ERROR: Default path '/tmp/kitchen' does not exist"
              exit 1
            fi
]
>>>>>> ----------------------

My .kitchen.yml:

---
driver:
  name: docker

provisioner:
  name: ansible_playbook
  hosts: test-kitchen
  ansible_verbose: false
  ansible_verbosity: 2
  require_ansible_repo: false
  require_ansible_omnibus: true

verifier:
  name: serverspec

platforms:
  - name: centos-7.2

suites:
  - name: default

And my bundle:

$ bundle show 
Gems included by the bundle:
  * artifactory (2.3.2)
  * backticks (0.4.0)
  * bundler (1.10.5)
  * docker (0.3.1)
  * faraday (0.9.2)
  * highline (1.7.8)
  * kitchen-ansible (0.42.5)
  * kitchen-docker (2.4.0)
  * kitchen-verifier-serverspec (0.4.2)
  * librarian (0.1.2)
  * librarian-ansible (3.0.0)
  * mixlib-install (1.0.11)
  * mixlib-shellout (2.2.6)
  * mixlib-versioning (1.1.0)
  * multipart-post (2.0.0)
  * net-scp (1.2.1)
  * net-ssh (3.1.1)
  * safe_yaml (1.0.4)
  * test-kitchen (1.8.0)
  * thor (0.19.1)

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.