azubi- A simple DevOps tool which will never "reach" enterprice level.

Copyright(c) Ingolf Wagner 2017
Safe HaskellSafe




import Azubi

main :: IO ()
main = azubiMain $ []
       & installed (Ebuild "vim")
       & uptodate (Git "" "/dev/shm/azubi")
       & installed (Git "" "/dev/shm/azubi-config")
       & run (Always "touch" ["devshm/run.test"])
       & link "/dev/shm/" "/dev/shm/azubi"



data State Source #

The low level element to formulate a state on a machine. If the check returns No the Commands will run. So the author should make sure the Command will result in a Yes the next time this state will run.

All Checks have to return Yes to avoid the Commands to be run.

If a Command returns a Failure the following commands will not be called. Same holdes for States if one of the states fail, the following States will not be run.


State [Check] [Command] (Maybe Comment)

State contains checks and commands if one command failed the following commands will not be executed.

States [Check] [State] (Maybe Comment)

To create depended states which should stop being executed when a previous state fails


Eq State Source # 


(==) :: State -> State -> Bool #

(/=) :: State -> State -> Bool #

Show State Source # 


showsPrec :: Int -> State -> ShowS #

show :: State -> String #

showList :: [State] -> ShowS #

data Ebuild Source #

Ebuild is a Portage package (used by Gentoo and Funtoo).

See installed.


Ebuild String 

data Git Source #

Git is a version control system.

See installed.


Git RepoUrl Path [GitOption] 

data GitOption Source #



data RunCommand Source #

The way a command should be run. See run


Always String [Argument]

run command every time

Once String [Argument] Path

run command and creates a file to prevent to run again

installed :: Installable a => a -> State Source #

install a piece of software on the system. The piece of software should be typed of course.

class Installable a where Source #

To install Software you have to instance the Installable class.

Minimal complete definition



installed :: a -> State Source #

install a piece of software on the system. The piece of software should be typed of course.

uptodate :: Updatable a => a -> State Source #

make sure something is installed and up to date.

class Updatable a where Source #

Same like Installable but will also make sure there you have the newest version.

Minimal complete definition



uptodate :: a -> State Source #

make sure something is installed and up to date.

run :: RunCommand -> State Source #

creates a State that will run a command of your choice.

link :: Path -> Path -> State Source #

ensure there is a link file -> target


link "~/file" "~/target"

will create a link at ~/file/ pointing to ~/target/

folderExists :: Path -> State Source #

make sure a folder exists

content :: Path -> [String] -> State Source #

Create a state that ensures that a file in Path will have the content of the String List.

Every String in the List will be a Line in the File.

requires :: State -> State -> State Source #

Creates a state out of two states. When the first State fails the second State will not be checked nor enforced.

This can also be achieved using submodule:

stateA requires stateB == submodule [stateB, stateA]

submodule :: [State] -> State Source #

Create a state containing of sub-states, which have to be fulfilled in order.

If one state is not fulfilled, the following will be ignored.

(&) :: [State] -> State -> [State] Source #

State combinator.

& folderExists "/tmp/foo"
& folderExists "/tmp/bar"

azubiMain :: [State] -> IO () Source #

The function you should use to get you commands running.

data Command Source #

A command is something that will be run. In a normal case you put a Check before using a State

When a Command get executed, it will create a CommandResult.

 command -> exit code -> CommandResult


Run String [Argument] (Maybe Comment) 
FileContent Path [String] 
CreateSymlink Path Target 
CreateFolder Path 
Remove Path 

data Check Source #

Gather information about a situation.

check -> success/failure
check -> exit code -> success/failure


Check String [Argument] (Maybe Comment)

Check if command returns exit status

0 -> Yes
_ -> No
Not Check

Opposite result of a Check

HasFileContent Path [String]

Check if Path has content

SymlinkExists Path Target

Check if a Symbolic link exists to a specific target

FolderExists Path

Check if a folder exists

DoesExist Path

Check if something exists at path


Eq Check Source # 


(==) :: Check -> Check -> Bool #

(/=) :: Check -> Check -> Bool #

Show Check Source # 


showsPrec :: Int -> Check -> ShowS #

show :: Check -> String #

showList :: [Check] -> ShowS #