| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Propellor
Description
When propellor runs on a Host, it ensures that its Properties are satisfied, taking action as necessary when a Property is not currently satisfied.
A simple propellor program example:
import Propellor
import qualified Propellor.Property.File as File
import qualified Propellor.Property.Apt as Apt
main :: IO ()
main = defaultMain hosts
hosts :: [Host]
hosts = [example]
example :: Host
example = host "example.com" $ props
& Apt.installed ["mydaemon"]
& "/etc/mydaemon.conf" `File.containsLine` "secure=1"
`onChange` cmdProperty "service" ["mydaemon", "restart"]
! Apt.installed ["unwantedpackage"]See config.hs for a more complete example, and clone Propellor's git repository for a deployable system using Propellor: git clone git://git.joeyh.name/propellor
Synopsis
- data Host = Host {
- hostName :: HostName
- hostProperties :: [ChildProperty]
- hostInfo :: Info
- data Property metatypes
- data RevertableProperty setupmetatypes undometatypes
- module Propellor.Types
- defaultMain :: [Host] -> IO ()
- host :: HostName -> Props metatypes -> Host
- (&) :: forall {a} p (y :: [a]) (x :: [a]). (IsProp p, MetaTypes y ~ GetMetaTypes p, CheckCombinableNote x y (NoteFor ('Text "&"))) => Props (MetaTypes x) -> p -> Props (MetaTypes (Combine x y))
- (!) :: forall {a} {k} (x :: [a]) (z :: [a]) (y :: k). CheckCombinableNote x z (NoteFor ('Text "!")) => Props (MetaTypes x) -> RevertableProperty (MetaTypes y) (MetaTypes z) -> Props (MetaTypes (Combine x z))
- requires :: Combines x y => x -> y -> CombinedType x y
- before :: Combines x y => x -> y -> CombinedType x y
- onChange :: Combines x y => x -> y -> CombinedType x y
- describe :: IsProp p => p -> Desc -> p
- module Propellor.Property
- module Propellor.Property.Cmd
- module Propellor.Info
- module Propellor.Property.List
- module Propellor.Types.PrivData
- module Data.Monoid
- fromString :: IsString a => String -> a
Core data types
Everything Propellor knows about a system: Its hostname, properties and their collected info.
Constructors
| Host | |
Fields
| |
Instances
| Show Host Source # | |
| IsContainer Host Source # | |
Defined in Propellor.Container Methods containerProperties :: Host -> [ChildProperty] Source # containerInfo :: Host -> Info Source # setContainerProperties :: Host -> [ChildProperty] -> Host Source # | |
| Conductable Host Source # | |
| MonadReader Host Propellor Source # | |
| Conductable [Host] Source # | |
data Property metatypes Source #
The core data type of Propellor, this represents a property that the system should have, with a description, and an action to ensure it has the property.
There are different types of properties that target different OS's, and so have different metatypes. For example: "Property DebianLike" and "Property FreeBSD".
Also, some properties have associated Info, which is indicated in
their type: "Property (HasInfo + DebianLike)"
There are many associated type families, which are mostly used internally, so you needn't worry about them.
Instances
data RevertableProperty setupmetatypes undometatypes Source #
A property that can be reverted. The first Property is run normally and the second is run when it's reverted.
See Versioned
for a way to use RevertableProperty to define different
versions of a host.
Instances
module Propellor.Types
Config file
defaultMain :: [Host] -> IO () Source #
Runs propellor on hosts, as controlled by command-line options.
host :: HostName -> Props metatypes -> Host Source #
Defines a host and its properties.
host "example.com" $ props & someproperty ! oldproperty & otherproperty
(&) :: forall {a} p (y :: [a]) (x :: [a]). (IsProp p, MetaTypes y ~ GetMetaTypes p, CheckCombinableNote x y (NoteFor ('Text "&"))) => Props (MetaTypes x) -> p -> Props (MetaTypes (Combine x y)) infixl 1 Source #
Adds a property to a Props.
Can add Properties and RevertableProperties
(!) :: forall {a} {k} (x :: [a]) (z :: [a]) (y :: k). CheckCombinableNote x z (NoteFor ('Text "!")) => Props (MetaTypes x) -> RevertableProperty (MetaTypes y) (MetaTypes z) -> Props (MetaTypes (Combine x z)) infixl 1 Source #
Adds a property in reverted form.
Propertries
Properties are often combined together in your propellor configuration. For example:
"/etc/foo/config" `File.containsLine` "bar=1" `requires` File.dirExists "/etc/foo"
requires :: Combines x y => x -> y -> CombinedType x y Source #
Indicates that the first property depends on the second, so before the first is ensured, the second must be ensured.
The combined property uses the description of the first property.
before :: Combines x y => x -> y -> CombinedType x y Source #
Combines together two properties, resulting in one property that ensures the first, and if the first succeeds, ensures the second.
The combined property uses the description of the first property.
onChange :: Combines x y => x -> y -> CombinedType x y Source #
Whenever a change has to be made for a Property, causes a hook Property to also be run, but not otherwise.
module Propellor.Property
Everything you need to build your own properties, and useful property combinators
module Propellor.Property.Cmd
Properties to run shell commands
module Propellor.Info
Properties that set Info
module Propellor.Property.List
Combining a list of properties into a single property
module Propellor.Types.PrivData
Private data access for properties
module Data.Monoid
fromString :: IsString a => String -> a #