Juniper/junos-chef

Name: junos-chef

Owner: Juniper Networks

Description: Junos Packaging for Opscode Chef

Forked from: chef-partners/junos-chef

Created: 2015-08-03 06:51:59.0

Updated: 2016-08-22 16:15:47.0

Pushed: 2015-08-12 13:30:53.0

Homepage:

Size: 40447

Language: C

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

Chef for Junos

This project creates a full-stack Chef bundle for the Junos operation system which runs on Juniper switches. Just like the Chef Omnibus packages for other platforms, this final bundle contains all of Chef's dependencies including Ruby!

Installation

First you need to generate build sandbox with the Junos SDK:

 -name chef -base /usr/tmp/

Code in this sandbox is compiled and linked with the libraries in the Junos SDK backing sandbox to produce a Chef bundle that can be loaded on a supported Junos router.

Next clone this repository into your build sandbox as the src directory:

clone git@github.com:opscode/junos-chef.git /usr/tmp/chef/src

Finally install all required gems using Bundler:

install bundler
le install

You can verify everything is configure correctly with a simple rake -T:

ke -T
 clean    # Remove any temporary products.
 clobber  # Remove any generated file.
 package  # package all the things
Usage/Tasks
Package

For each gem to be packaged up (currently Chef and Junos EZ Stdlib) the task:

Next the normal Junos SDK build workflow takes over:

usr/tmp/chef/src
 package
Clean/Clobber

You can clean up all temporary files generated during the build process with the clean task:

usr/tmp/chef/src
 clean

If you want to remove ALL files generated during the build (including output packges) use the clobber task:

usr/tmp/chef/src
 clobber
Junos SDK Build VM Setup

General information about the Junos SDK along instructions for setting up the Virtual Build Environment (VBE) can be found at in the Juniper Developer Portal (requires registration).

To build a Chef package for Junos you will need:

Code in this repository has been tested with the following versions of the above tools:

Prereqs

The VBE is based on FreeBSD 7. First let's install some useful development tools inside the VBE:

stall wget
usr/ports/ftp/wget
 install clean; rehash

stall bash
usr/ports/shells/bash
 install clean; rehash

stall curl
usr/ports/ftp/curl
 install clean; rehash

stall libxml2
 -O /usr/ports/distfiles/gnome2/libxml2-2.6.32.tar.gz http://xmlsoft.org/sources/old/libxml2-2.6.32.tar.gz
usr/ports/textproc/libxml2
 install clean; rehash

stall libxslt
usr/ports/textproc/libxslt
 install clean; rehash

date CA
 -O /etc/ssl/cert.pem http://curl.haxx.se/ca/cacert.pem
usr/local/share/curl/curl-ca-bundle.crt /usr/local/share/curl/curl-ca-bundle.crt.old
/etc/ssl/cert.pem /usr/local/share/curl/curl-ca-bundle.crt >> /usr/local/share/curl/curl-ca-bundle-new.crt
usr/local/share/curl/curl-ca-bundle-new.crt /usr/local/share/curl/curl-ca-bundle.crt

stall python (required for git compile)
usr/ports/lang/python
 install clean; rehash

stall modern git
tmp
 https://git-core.googlecode.com/files/git-1.8.3.3.tar.gz
xzvf git-1.8.3.3.tar.gz
it-1.8.3.3
nfigure --prefix=/usr/local --enable-pthreads=-pthread --with-openssl=/usr/local --with-curl=/usr/local
e install clean; rehash

nfigure NTP
<<'EOL' >> /etc/ntp.conf
tfile /var/db/ntp.drift

er 0.pool.ntp.org
er 1.pool.ntp.org
er 2.pool.ntp.org
er 3.pool.ntp.org
'

 'ntpd_enable="YES"' >> /etc/rc.conf
Ruby 1.9.3 (via rbenv)
clone https://github.com/sstephenson/rbenv.git /usr/local/rbenv

tmp
clone https://github.com/sstephenson/ruby-build.git
uby-build
stall.sh

sure all new users have a sane .profile
<<'EOL' >> /usr/share/skel/dot.profile

 begin rbenv configuration ####
emove these lines if you wish to use your own
lone of rbenv (with your own rubies)

rt RBENV_ROOT=/usr/local/rbenv
rt PATH="$RBENV_ROOT/bin:$PATH"
 "$(rbenv init -)"

low local Gem management
rt GEM_HOME="$HOME/.gem"
rt GEM_PATH="$HOME/.gem"
rt PATH="$HOME/.gem/bin:$PATH"
 end rbenv configuration ####
'

sure all new users have a sane .gemrc
 "gem: --no-ri --no-rdoc" >> /usr/share/skel/dot.gemrc

stall Ruby 1.9.3

rt RBENV_ROOT=/usr/local/rbenv
rt PATH="$RBENV_ROOT/bin:$PATH"
 "$(rbenv init -)"
rt MAKE=/usr/local/bin/gmake
rt CONFIGURE_OPTS="--with-opt-dir=/usr/local/rbenv/versions/1.9.3-p448"
v install 1.9.3-p448
v global 1.9.3-p448
Create a user and configure PROFILE
 sure to choose bash as default shell
ser 
Install Juniper SDK Backing Sandbox and Toolchain
add junos-sdk-sb-13.2X50-D10.2-signed.tgz
add junos-sdk-toolchain-13.2B2-signed.tgz

 'export PATH="$PATH:/usr/local/junos-sdk/13.2X50-D10.2/bin"' >> ~/.profile
Move your package signing key and certificate into place

Place your generated package signing key and the certificate assigned to your organization by Juniper in /usr/local/junos-sdk/certs. More information about the package signing key/certificate generation process can be found here.

License

See the LICENSE file for details.

Copyright (c) 2013 Opscode, Inc. License: Apache License, Version 2.0

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.


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.