A simple provisioning tool
Project description
Prvsn
=================
`prvsn` is a simple provisioning tool.
[](https://travis-ci.org/acoomans/prvsn)
[](https://pypi.python.org/pypi/prvsn)
[](https://pypi.python.org/pypi/prvsn)


## Motivation
The motivation for this tool is too keep track of configuration steps and being able to rebuild a small setup (e.g. a raspberry pi) quickly and with minimal effort.
### Goals
Easy for quickly setup a machine for hacking:
- easy to provision a single machine
- works in python
- simple way to
- add a file, possibly a template
- install package
- run a command in bash
- works out of the box:
- python 2.7 & 3 compatibility
- no external dependencies
### Non-Goals
Large scale provisioning:
- provision thousands or more machines
- strict dependencies, complex dependency graph
- external recipes & supermarket/store support
If those are your goals, have a look at Puppet or Chef or others.
## Installation
### Install
python setup.py install
### Developing
python setup.py develop
python setup.py develop --uninstall
### Running tests
python setup.py test
## Usage
### Hierarchy
Configurations are called `roles` and are grouped into a `runbook`.
The file hierarchy looks like:
runbook
|- roles
|- web
|- ...
|- desktop
|- main.py
|- files
- `main.py` is the main python entry point
- `files` is to contain any files you want to use
### Tasks
A role's `main.py` can contain one or more `tasks` (also called `states` since they're mostly descriptive).
Common task options include:
- `secure`: no output will be shown on console nor logs.
#### Command Tasks
`command(interpreter, cmd)`
`bash(cmd)`:
Runs some code in bash. Hopefully this is never needed.
bash('echo "hello"')
bash('''
echo "hello"
ls
ps
''')
`ruby(cmd)`
Runs some code in ruby.
#### File Tasks
`file(source, file, replacements={})`:
`source` can either be a URL or a file's path relative to the role's `files` directory.
file('asound.conf', '/etc/asound.conf')
file(
'http://example.com/asound.conf',
'/etc/asound.conf'
)
replacements rules can be specified, so the file acts as a template.
file(
'resolv.conf',
'/etc/resolv.conf',
{
'MYIPADDRESS': '192.168.0.1'
}
)
#### Kernel Tasks
`module(name)` (linux only):
Adds and loads a module.
module('v4l')
#### Package Tasks
`package`:
Should automatically detect the package manager in presence.
If multiple managers are present, it is possible to explicitly specify which to use:
`homebrew_package`
`apt_package`
`yum_package`
package('vim')
### Command line
#### provision
Default command. Provisions the machine `prvsn` runs on.
prvsn provision -b path/to/runbook -r role1,role2
or alternatively, if running from the runbook directory:
prvsn -r role1,role2
#### init
Creates the hierarchy for a new runbook.
prvsn init -b path/to/runbook -r role1,role2
#### package
Creates an executable package with the runbook and the roles.
prvsn package -b path/to/runbook -r role1,role2 -o mypackage
The package can then be run individually:
python mypackage.pyz
#### remote
TODO
=================
`prvsn` is a simple provisioning tool.
[](https://travis-ci.org/acoomans/prvsn)
[](https://pypi.python.org/pypi/prvsn)
[](https://pypi.python.org/pypi/prvsn)


## Motivation
The motivation for this tool is too keep track of configuration steps and being able to rebuild a small setup (e.g. a raspberry pi) quickly and with minimal effort.
### Goals
Easy for quickly setup a machine for hacking:
- easy to provision a single machine
- works in python
- simple way to
- add a file, possibly a template
- install package
- run a command in bash
- works out of the box:
- python 2.7 & 3 compatibility
- no external dependencies
### Non-Goals
Large scale provisioning:
- provision thousands or more machines
- strict dependencies, complex dependency graph
- external recipes & supermarket/store support
If those are your goals, have a look at Puppet or Chef or others.
## Installation
### Install
python setup.py install
### Developing
python setup.py develop
python setup.py develop --uninstall
### Running tests
python setup.py test
## Usage
### Hierarchy
Configurations are called `roles` and are grouped into a `runbook`.
The file hierarchy looks like:
runbook
|- roles
|- web
|- ...
|- desktop
|- main.py
|- files
- `main.py` is the main python entry point
- `files` is to contain any files you want to use
### Tasks
A role's `main.py` can contain one or more `tasks` (also called `states` since they're mostly descriptive).
Common task options include:
- `secure`: no output will be shown on console nor logs.
#### Command Tasks
`command(interpreter, cmd)`
`bash(cmd)`:
Runs some code in bash. Hopefully this is never needed.
bash('echo "hello"')
bash('''
echo "hello"
ls
ps
''')
`ruby(cmd)`
Runs some code in ruby.
#### File Tasks
`file(source, file, replacements={})`:
`source` can either be a URL or a file's path relative to the role's `files` directory.
file('asound.conf', '/etc/asound.conf')
file(
'http://example.com/asound.conf',
'/etc/asound.conf'
)
replacements rules can be specified, so the file acts as a template.
file(
'resolv.conf',
'/etc/resolv.conf',
{
'MYIPADDRESS': '192.168.0.1'
}
)
#### Kernel Tasks
`module(name)` (linux only):
Adds and loads a module.
module('v4l')
#### Package Tasks
`package`:
Should automatically detect the package manager in presence.
If multiple managers are present, it is possible to explicitly specify which to use:
`homebrew_package`
`apt_package`
`yum_package`
package('vim')
### Command line
#### provision
Default command. Provisions the machine `prvsn` runs on.
prvsn provision -b path/to/runbook -r role1,role2
or alternatively, if running from the runbook directory:
prvsn -r role1,role2
#### init
Creates the hierarchy for a new runbook.
prvsn init -b path/to/runbook -r role1,role2
#### package
Creates an executable package with the runbook and the roles.
prvsn package -b path/to/runbook -r role1,role2 -o mypackage
The package can then be run individually:
python mypackage.pyz
#### remote
TODO
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
prvsn-0.1.tar.gz
(9.9 kB
view details)
File details
Details for the file prvsn-0.1.tar.gz
.
File metadata
- Download URL: prvsn-0.1.tar.gz
- Upload date:
- Size: 9.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: Python-urllib/3.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
86ac756b41d8c357e27f3239787f7c8688f81a5b29a4f61679a10157a5051eec
|
|
MD5 |
7c5557401e34ba91818b8968659d1282
|
|
BLAKE2b-256 |
7ef1e89631f19bc55c006afcd5d142a8a1b70b2fc6cc6f09d4a0546253147d7c
|