Go to file
Bruno Tavares 43ec3c569e Use release files to identify distro
Docker can run a different distro from the host. For example, Ubuntu
host with CentOS docker image.

The container uses the same kernel as the host tho. On a CentOS
container under Ubuntu, `uname -a` will report it to be an Ubuntu
kernel.

Linux distros comes with configuration files under `/etc` that helps
identify the family it is. An example of configuration files to help
identify is on http://linuxmafia.com/faq/Admin/release-files.html
2014-03-02 20:17:47 -03:00
bin Add kickstart binary command with instalation instructions 2014-02-19 20:25:41 -03:00
completions Add autocomplete 2014-02-21 19:43:24 -03:00
docs Introduce kickstart.stream.contains and kickstart.file.contains 2014-02-27 14:55:29 -03:00
kickstart Use release files to identify distro 2014-03-02 20:17:47 -03:00
lib Add kickstart to PATH under ~/.bash_profile to work with systems that does not use ~/.bashrc by default 2014-03-02 20:13:57 -03:00
.gitignore Add kickstart binary command with instalation instructions 2014-02-19 20:25:41 -03:00
Dockerfile Add docker container that comes with kickstart installed 2014-02-23 12:25:01 -03:00
README.md Add support for using different docker images 2014-03-02 20:09:25 -03:00

kickstart

Bash only provisioning tool.

The idea is to use bash scripts to provision machines over ssh, with no client installation on the target. It provides some abstractions and functions that help you structure and write more readable bash scripts. For an example project, check kickstart-baseline.

Goal

  • No installation on the target
  • Over ssh, or local
  • Portable (Mac, Linux, containers and so on)

Installation

Add it to the path.

One options is to download it, and export the bin folder into your PATH

# Adjust the paths to your preferred location
installation_path=/opt/kickstart
shell_configuration=$HOME/.bashrc

git clone https://github.com/bltavares/kickstart.git $installation_path
echo 'export PATH=$PATH:'$installation_path'/bin' >> $shell_configuration
echo 'eval "$(kickstart autocomplete)"' >> $shell_configuration

The other is to link the bin/kickstart into a place that is already on your path. This will allow sudo to see the kickstart command.

# Adjust the paths to your preferred location
installation_path=/opt/kickstart
shell_configuration=$HOME/.bashrc

git clone https://github.com/bltavares/kickstart.git $installation_path
sudo ln -s $installation_path/bin/kickstart /usr/local/bin/kickstart
echo 'eval "$(kickstart autocomplete)"' >> $shell_configuration

Usage

create

Creates a sample project structure

kickstart create [folder name or current folder]

docker-create

Creates a docker container with a running sshd to test recipes

kickstart docker-create [image-name]

docker-ssh

Access the created docker container over ssh. A simple utility that looks up for the port the docker is bound.

kickstart docker-ssh [image-name]

compile

Compile the current workspace into the folder to be packaged on deploy

kickstart compile

deploy

Takes an host target and deploy the compiled code on it.

kickstart deploy [--sudo] [--password PASSWORD] target [roles ...]
Examples

Deploy a role on a host

kickstart deploy vagrant@localhost nodejs

Deploy two roles on a host with an alternative port

kickstart deploy "-p 2222 vagrant@localhost" nodejs redis

Deploy with sudo and send the password for sudo

kickstart deploy --sudo --password vagrant "-p 2222 vagrant@localhost" nodejs redis

local

Deploy localy a recipe that is not over ssh. It basicaly compile and run the install script

kickstart local [--sudo] [roles ...]

infect

Infect your shell with the kickstart utility functions

eval "$(kickstart infect)"

bootstrap

Install kickstart on the target

kickstart bootstratp [target]
Example

Using default ssh configurations

kickstart bootstrap vagrant@vagrant

Using alternate ssh port

kickstart bootstrap "-p 2222 vagrant@vagrant"

doc

Show documentation for a kickstart function

kickstart doc [function name]
Example

List all documented functions

kickstart doc

Show documentation for a function

kickstart doc kickstart.os

autocomplete

Enable autocompletion on your terminal

eval "$(kickstart autocomplete)"

Debbuging

Prepend DEBUG=1 to the command and you will see massive ammount of commands on your screen

DEBUG=1 kickstart local nodejs

Choosing the docker image to use

You can choose an specific image to use on the docker-* commands. On order, it looks up for an image as an argument, on the KICKSTART_DOCKER_IMAGE env variable or defaults to moul/sshd. You can use any image that is on the index, you probably want it to have an sshd running by default.

Docker images tested:

Thanks

This project was inspired on sunzi