2014-02-18 15:24:31 +00:00
|
|
|
# kickstart
|
2014-02-22 15:37:59 +00:00
|
|
|
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](https://github.com/bltavares/kickstart-baseline).
|
|
|
|
|
|
|
|
### Goal
|
|
|
|
|
|
|
|
* No installation on the target
|
|
|
|
* Over ssh, or local
|
|
|
|
* Portable (Mac, Linux, containers and so on)
|
|
|
|
|
2014-02-19 23:10:40 +00:00
|
|
|
|
|
|
|
### Installation
|
|
|
|
Add it to the path.
|
|
|
|
|
|
|
|
One options is to download it, and export the bin folder into your PATH
|
|
|
|
```bash
|
|
|
|
# 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
|
2014-02-23 15:24:06 +00:00
|
|
|
echo 'eval "$(kickstart autocomplete)"' >> $shell_configuration
|
2014-02-19 23:10:40 +00:00
|
|
|
```
|
|
|
|
|
2014-02-22 00:28:52 +00:00
|
|
|
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.
|
2014-02-19 23:10:40 +00:00
|
|
|
```bash
|
|
|
|
# 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
|
2014-02-23 15:24:06 +00:00
|
|
|
echo 'eval "$(kickstart autocomplete)"' >> $shell_configuration
|
2014-02-19 23:10:40 +00:00
|
|
|
```
|
|
|
|
|
2014-02-19 23:23:09 +00:00
|
|
|
### Usage
|
|
|
|
|
|
|
|
#### create
|
|
|
|
Creates a sample project structure
|
|
|
|
|
|
|
|
```bash
|
|
|
|
kickstart create [folder name or current folder]
|
|
|
|
```
|
|
|
|
|
2014-02-20 15:49:57 +00:00
|
|
|
#### docker-create
|
|
|
|
Creates a docker container with a running sshd to test recipes
|
|
|
|
|
|
|
|
```bash
|
|
|
|
kickstart docker-create
|
|
|
|
```
|
|
|
|
|
|
|
|
#### docker-ssh
|
|
|
|
Access the created docker container over ssh. A simple utility that looks up for the port the docker is bound.
|
|
|
|
|
|
|
|
```bash
|
|
|
|
kickstart docker-ssh
|
|
|
|
```
|
|
|
|
|
2014-02-19 23:23:09 +00:00
|
|
|
|
2014-02-20 15:53:24 +00:00
|
|
|
#### compile
|
|
|
|
Compile the current workspace into the folder to be packaged on deploy
|
|
|
|
|
|
|
|
```bash
|
|
|
|
kickstart compile
|
|
|
|
```
|
|
|
|
|
2014-02-20 16:19:43 +00:00
|
|
|
#### deploy
|
|
|
|
Takes an host target and deploy the compiled code on it.
|
|
|
|
|
|
|
|
```bash
|
2014-02-22 00:27:32 +00:00
|
|
|
kickstart deploy [--sudo] [--password PASSWORD] target [roles ...]
|
2014-02-20 16:19:43 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
##### Examples
|
|
|
|
Deploy a role on a host
|
|
|
|
|
|
|
|
```bash
|
|
|
|
kickstart deploy vagrant@localhost nodejs
|
|
|
|
```
|
|
|
|
|
|
|
|
Deploy two roles on a host with an alternative port
|
|
|
|
|
|
|
|
```bash
|
|
|
|
kickstart deploy "-p 2222 vagrant@localhost" nodejs redis
|
|
|
|
```
|
|
|
|
|
2014-02-22 00:27:32 +00:00
|
|
|
Deploy with sudo and send the password for sudo
|
|
|
|
|
|
|
|
```bash
|
|
|
|
kickstart deploy --sudo --password vagrant "-p 2222 vagrant@localhost" nodejs redis
|
|
|
|
```
|
|
|
|
|
2014-02-20 16:24:40 +00:00
|
|
|
#### local
|
|
|
|
Deploy localy a recipe that is not over ssh. It basicaly compile and run the install script
|
|
|
|
|
|
|
|
```bash
|
2014-02-21 18:59:46 +00:00
|
|
|
kickstart local [--sudo] [roles ...]
|
2014-02-20 16:24:40 +00:00
|
|
|
```
|
|
|
|
|
2014-02-20 19:53:59 +00:00
|
|
|
#### infect
|
|
|
|
Infect your shell with the kickstart utility functions
|
|
|
|
|
|
|
|
```bash
|
|
|
|
eval "$(kickstart infect)"
|
|
|
|
```
|
|
|
|
|
2014-02-21 20:00:16 +00:00
|
|
|
#### bootstrap
|
|
|
|
Install kickstart on the target
|
|
|
|
|
|
|
|
```bash
|
|
|
|
kickstart bootstratp [target]
|
|
|
|
```
|
|
|
|
|
|
|
|
##### Example
|
|
|
|
Using default ssh configurations
|
|
|
|
|
|
|
|
```bash
|
|
|
|
kickstart bootstrap vagrant@vagrant
|
|
|
|
```
|
|
|
|
|
|
|
|
Using alternate ssh port
|
|
|
|
```bash
|
|
|
|
kickstart bootstrap "-p 2222 vagrant@vagrant"
|
|
|
|
```
|
|
|
|
|
2014-02-21 22:30:18 +00:00
|
|
|
#### doc
|
|
|
|
Show documentation for a kickstart function
|
|
|
|
|
|
|
|
```bash
|
|
|
|
kickstart doc [function name]
|
|
|
|
```
|
|
|
|
|
|
|
|
##### Example
|
|
|
|
List all documented functions
|
|
|
|
|
|
|
|
```bash
|
|
|
|
kickstart doc
|
|
|
|
```
|
|
|
|
|
|
|
|
Show documentation for a function
|
|
|
|
|
|
|
|
```bash
|
|
|
|
kickstart doc kickstart.os
|
|
|
|
```
|
|
|
|
|
2014-02-21 22:43:24 +00:00
|
|
|
#### autocomplete
|
|
|
|
Enable autocompletion on your terminal
|
|
|
|
|
|
|
|
```bash
|
|
|
|
eval "$(kickstart autocomplete)"
|
|
|
|
```
|
2014-02-21 20:00:16 +00:00
|
|
|
|
2014-02-22 00:14:39 +00:00
|
|
|
### Debbuging
|
|
|
|
Prepend DEBUG=1 to the command and you will see massive ammount of commands on your screen
|
|
|
|
|
|
|
|
```bash
|
|
|
|
DEBUG=1 kickstart local nodejs
|
|
|
|
```
|
|
|
|
|
2014-02-19 23:10:40 +00:00
|
|
|
### Thanks
|
|
|
|
This project was inspired on [sunzi](https://github.com/kenn/sunzi)
|