Safe Haskell | None |
---|---|
Language | Haskell98 |
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
- (&) :: (IsProp p, MetaTypes y ~ GetMetaTypes p, CheckCombinableNote x y (NoteFor ('Text "&"))) => Props (MetaTypes x) -> p -> Props (MetaTypes (Combine x y))
- (!) :: 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
- fromString :: IsString a => String -> a
- (<>) :: Semigroup a => a -> a -> a
- class Semigroup a => Monoid a where
- newtype Any = Any {
- getAny :: Bool
- newtype Dual a = Dual {
- getDual :: a
- newtype Endo a = Endo {
- appEndo :: a -> a
- newtype Product a = Product {
- getProduct :: a
- newtype Sum a = Sum {
- getSum :: a
- newtype All = All {
- getAll :: Bool
- newtype Alt (f :: k -> Type) (a :: k) = Alt {
- getAlt :: f a
- newtype Ap (f :: k -> Type) (a :: k) = Ap {
- getAp :: f a
- newtype First a = First {
- getFirst :: Maybe a
- newtype Last a = Last {
- getLast :: Maybe 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
(&) :: (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
(!) :: 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
fromString :: IsString a => String -> a #
class Semigroup a => Monoid a where #
Minimal complete definition
Instances
Instances
Bounded Any | |
Defined in Data.Semigroup.Internal | |
Eq Any | |
Ord Any | |
Read Any | |
Defined in Data.Semigroup.Internal | |
Show Any | |
Generic Any | |
Semigroup Any | |
Monoid Any | |
type Rep Any | |
Defined in Data.Semigroup.Internal type Rep Any = D1 ('MetaData "Any" "Data.Semigroup.Internal" "base" 'True) (C1 ('MetaCons "Any" 'PrefixI 'True) (S1 ('MetaSel ('Just "getAny") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Bool))) |
Instances
Monad Dual | |
Functor Dual | |
MonadFix Dual | |
Defined in Control.Monad.Fix | |
Applicative Dual | |
Foldable Dual | |
Defined in Data.Foldable Methods fold :: Monoid m => Dual m -> m foldMap :: Monoid m => (a -> m) -> Dual a -> m foldMap' :: Monoid m => (a -> m) -> Dual a -> m foldr :: (a -> b -> b) -> b -> Dual a -> b foldr' :: (a -> b -> b) -> b -> Dual a -> b foldl :: (b -> a -> b) -> b -> Dual a -> b foldl' :: (b -> a -> b) -> b -> Dual a -> b foldr1 :: (a -> a -> a) -> Dual a -> a foldl1 :: (a -> a -> a) -> Dual a -> a elem :: Eq a => a -> Dual a -> Bool maximum :: Ord a => Dual a -> a | |
Traversable Dual | |
Bounded a => Bounded (Dual a) | |
Defined in Data.Semigroup.Internal | |
Eq a => Eq (Dual a) | |
Ord a => Ord (Dual a) | |
Read a => Read (Dual a) | |
Defined in Data.Semigroup.Internal | |
Show a => Show (Dual a) | |
Generic (Dual a) | |
Semigroup a => Semigroup (Dual a) | |
Monoid a => Monoid (Dual a) | |
Generic1 Dual | |
type Rep (Dual a) | |
Defined in Data.Semigroup.Internal type Rep (Dual a) = D1 ('MetaData "Dual" "Data.Semigroup.Internal" "base" 'True) (C1 ('MetaCons "Dual" 'PrefixI 'True) (S1 ('MetaSel ('Just "getDual") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 a))) | |
type Rep1 Dual | |
Defined in Data.Semigroup.Internal type Rep1 Dual = D1 ('MetaData "Dual" "Data.Semigroup.Internal" "base" 'True) (C1 ('MetaCons "Dual" 'PrefixI 'True) (S1 ('MetaSel ('Just "getDual") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) Par1)) |
Instances
Generic (Endo a) | |
Semigroup (Endo a) | |
Monoid (Endo a) | |
type Rep (Endo a) | |
Defined in Data.Semigroup.Internal type Rep (Endo a) = D1 ('MetaData "Endo" "Data.Semigroup.Internal" "base" 'True) (C1 ('MetaCons "Endo" 'PrefixI 'True) (S1 ('MetaSel ('Just "appEndo") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (a -> a)))) |
Constructors
Product | |
Fields
|
Instances
Monad Product | |
Functor Product | |
MonadFix Product | |
Defined in Control.Monad.Fix | |
Applicative Product | |
Foldable Product | |
Defined in Data.Foldable Methods fold :: Monoid m => Product m -> m foldMap :: Monoid m => (a -> m) -> Product a -> m foldMap' :: Monoid m => (a -> m) -> Product a -> m foldr :: (a -> b -> b) -> b -> Product a -> b foldr' :: (a -> b -> b) -> b -> Product a -> b foldl :: (b -> a -> b) -> b -> Product a -> b foldl' :: (b -> a -> b) -> b -> Product a -> b foldr1 :: (a -> a -> a) -> Product a -> a foldl1 :: (a -> a -> a) -> Product a -> a elem :: Eq a => a -> Product a -> Bool maximum :: Ord a => Product a -> a minimum :: Ord a => Product a -> a | |
Traversable Product | |
Bounded a => Bounded (Product a) | |
Defined in Data.Semigroup.Internal | |
Eq a => Eq (Product a) | |
Num a => Num (Product a) | |
Ord a => Ord (Product a) | |
Defined in Data.Semigroup.Internal | |
Read a => Read (Product a) | |
Defined in Data.Semigroup.Internal | |
Show a => Show (Product a) | |
Generic (Product a) | |
Num a => Semigroup (Product a) | |
Num a => Monoid (Product a) | |
Generic1 Product | |
type Rep (Product a) | |
Defined in Data.Semigroup.Internal type Rep (Product a) = D1 ('MetaData "Product" "Data.Semigroup.Internal" "base" 'True) (C1 ('MetaCons "Product" 'PrefixI 'True) (S1 ('MetaSel ('Just "getProduct") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 a))) | |
type Rep1 Product | |
Defined in Data.Semigroup.Internal type Rep1 Product = D1 ('MetaData "Product" "Data.Semigroup.Internal" "base" 'True) (C1 ('MetaCons "Product" 'PrefixI 'True) (S1 ('MetaSel ('Just "getProduct") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) Par1)) |
Instances
Monad Sum | |
Functor Sum | |
MonadFix Sum | |
Defined in Control.Monad.Fix | |
Applicative Sum | |
Foldable Sum | |
Defined in Data.Foldable Methods fold :: Monoid m => Sum m -> m foldMap :: Monoid m => (a -> m) -> Sum a -> m foldMap' :: Monoid m => (a -> m) -> Sum a -> m foldr :: (a -> b -> b) -> b -> Sum a -> b foldr' :: (a -> b -> b) -> b -> Sum a -> b foldl :: (b -> a -> b) -> b -> Sum a -> b foldl' :: (b -> a -> b) -> b -> Sum a -> b foldr1 :: (a -> a -> a) -> Sum a -> a foldl1 :: (a -> a -> a) -> Sum a -> a elem :: Eq a => a -> Sum a -> Bool maximum :: Ord a => Sum a -> a | |
Traversable Sum | |
Bounded a => Bounded (Sum a) | |
Defined in Data.Semigroup.Internal | |
Eq a => Eq (Sum a) | |
Num a => Num (Sum a) | |
Ord a => Ord (Sum a) | |
Read a => Read (Sum a) | |
Defined in Data.Semigroup.Internal | |
Show a => Show (Sum a) | |
Generic (Sum a) | |
Num a => Semigroup (Sum a) | |
Num a => Monoid (Sum a) | |
Generic1 Sum | |
type Rep (Sum a) | |
Defined in Data.Semigroup.Internal type Rep (Sum a) = D1 ('MetaData "Sum" "Data.Semigroup.Internal" "base" 'True) (C1 ('MetaCons "Sum" 'PrefixI 'True) (S1 ('MetaSel ('Just "getSum") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 a))) | |
type Rep1 Sum | |
Defined in Data.Semigroup.Internal type Rep1 Sum = D1 ('MetaData "Sum" "Data.Semigroup.Internal" "base" 'True) (C1 ('MetaCons "Sum" 'PrefixI 'True) (S1 ('MetaSel ('Just "getSum") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) Par1)) |
Instances
Bounded All | |
Defined in Data.Semigroup.Internal | |
Eq All | |
Ord All | |
Read All | |
Defined in Data.Semigroup.Internal | |
Show All | |
Generic All | |
Semigroup All | |
Monoid All | |
type Rep All | |
Defined in Data.Semigroup.Internal type Rep All = D1 ('MetaData "All" "Data.Semigroup.Internal" "base" 'True) (C1 ('MetaCons "All" 'PrefixI 'True) (S1 ('MetaSel ('Just "getAll") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Bool))) |
newtype Alt (f :: k -> Type) (a :: k) #
Instances
Generic1 (Alt f :: k -> Type) | |
Monad f => Monad (Alt f) | |
Functor f => Functor (Alt f) | |
MonadFix f => MonadFix (Alt f) | |
Defined in Control.Monad.Fix | |
Applicative f => Applicative (Alt f) | |
Foldable f => Foldable (Alt f) | |
Defined in Data.Foldable Methods fold :: Monoid m => Alt f m -> m foldMap :: Monoid m => (a -> m) -> Alt f a -> m foldMap' :: Monoid m => (a -> m) -> Alt f a -> m foldr :: (a -> b -> b) -> b -> Alt f a -> b foldr' :: (a -> b -> b) -> b -> Alt f a -> b foldl :: (b -> a -> b) -> b -> Alt f a -> b foldl' :: (b -> a -> b) -> b -> Alt f a -> b foldr1 :: (a -> a -> a) -> Alt f a -> a foldl1 :: (a -> a -> a) -> Alt f a -> a elem :: Eq a => a -> Alt f a -> Bool maximum :: Ord a => Alt f a -> a | |
Traversable f => Traversable (Alt f) | |
Alternative f => Alternative (Alt f) | |
MonadPlus f => MonadPlus (Alt f) | |
Enum (f a) => Enum (Alt f a) | |
Defined in Data.Semigroup.Internal | |
Eq (f a) => Eq (Alt f a) | |
Num (f a) => Num (Alt f a) | |
Ord (f a) => Ord (Alt f a) | |
Read (f a) => Read (Alt f a) | |
Defined in Data.Semigroup.Internal | |
Show (f a) => Show (Alt f a) | |
Generic (Alt f a) | |
Alternative f => Semigroup (Alt f a) | |
Alternative f => Monoid (Alt f a) | |
type Rep1 (Alt f :: k -> Type) | |
Defined in Data.Semigroup.Internal type Rep1 (Alt f :: k -> Type) = D1 ('MetaData "Alt" "Data.Semigroup.Internal" "base" 'True) (C1 ('MetaCons "Alt" 'PrefixI 'True) (S1 ('MetaSel ('Just "getAlt") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec1 f))) | |
type Rep (Alt f a) | |
Defined in Data.Semigroup.Internal type Rep (Alt f a) = D1 ('MetaData "Alt" "Data.Semigroup.Internal" "base" 'True) (C1 ('MetaCons "Alt" 'PrefixI 'True) (S1 ('MetaSel ('Just "getAlt") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (f a)))) |
newtype Ap (f :: k -> Type) (a :: k) #
Instances
Generic1 (Ap f :: k -> Type) | |
Monad f => Monad (Ap f) | |
Functor f => Functor (Ap f) | |
MonadFix f => MonadFix (Ap f) | |
Defined in Control.Monad.Fix | |
MonadFail f => MonadFail (Ap f) | |
Defined in Data.Monoid | |
Applicative f => Applicative (Ap f) | |
Foldable f => Foldable (Ap f) | |
Defined in Data.Foldable Methods fold :: Monoid m => Ap f m -> m foldMap :: Monoid m => (a -> m) -> Ap f a -> m foldMap' :: Monoid m => (a -> m) -> Ap f a -> m foldr :: (a -> b -> b) -> b -> Ap f a -> b foldr' :: (a -> b -> b) -> b -> Ap f a -> b foldl :: (b -> a -> b) -> b -> Ap f a -> b foldl' :: (b -> a -> b) -> b -> Ap f a -> b foldr1 :: (a -> a -> a) -> Ap f a -> a foldl1 :: (a -> a -> a) -> Ap f a -> a elem :: Eq a => a -> Ap f a -> Bool maximum :: Ord a => Ap f a -> a | |
Traversable f => Traversable (Ap f) | |
Alternative f => Alternative (Ap f) | |
MonadPlus f => MonadPlus (Ap f) | |
(Applicative f, Bounded a) => Bounded (Ap f a) | |
Defined in Data.Monoid | |
Enum (f a) => Enum (Ap f a) | |
Eq (f a) => Eq (Ap f a) | |
(Applicative f, Num a) => Num (Ap f a) | |
Ord (f a) => Ord (Ap f a) | |
Read (f a) => Read (Ap f a) | |
Defined in Data.Monoid | |
Show (f a) => Show (Ap f a) | |
Generic (Ap f a) | |
(Applicative f, Semigroup a) => Semigroup (Ap f a) | |
(Applicative f, Monoid a) => Monoid (Ap f a) | |
type Rep1 (Ap f :: k -> Type) | |
Defined in Data.Monoid type Rep1 (Ap f :: k -> Type) = D1 ('MetaData "Ap" "Data.Monoid" "base" 'True) (C1 ('MetaCons "Ap" 'PrefixI 'True) (S1 ('MetaSel ('Just "getAp") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec1 f))) | |
type Rep (Ap f a) | |
Defined in Data.Monoid type Rep (Ap f a) = D1 ('MetaData "Ap" "Data.Monoid" "base" 'True) (C1 ('MetaCons "Ap" 'PrefixI 'True) (S1 ('MetaSel ('Just "getAp") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (f a)))) |
Instances
Monad First | |
Functor First | |
MonadFix First | |
Defined in Control.Monad.Fix | |
Applicative First | |
Foldable First | |
Defined in Data.Foldable Methods fold :: Monoid m => First m -> m foldMap :: Monoid m => (a -> m) -> First a -> m foldMap' :: Monoid m => (a -> m) -> First a -> m foldr :: (a -> b -> b) -> b -> First a -> b foldr' :: (a -> b -> b) -> b -> First a -> b foldl :: (b -> a -> b) -> b -> First a -> b foldl' :: (b -> a -> b) -> b -> First a -> b foldr1 :: (a -> a -> a) -> First a -> a foldl1 :: (a -> a -> a) -> First a -> a elem :: Eq a => a -> First a -> Bool maximum :: Ord a => First a -> a | |
Traversable First | |
Eq a => Eq (First a) | |
Ord a => Ord (First a) | |
Read a => Read (First a) | |
Defined in Data.Monoid | |
Show a => Show (First a) | |
Generic (First a) | |
Semigroup (First a) | |
Monoid (First a) | |
Generic1 First | |
type Rep (First a) | |
Defined in Data.Monoid type Rep (First a) = D1 ('MetaData "First" "Data.Monoid" "base" 'True) (C1 ('MetaCons "First" 'PrefixI 'True) (S1 ('MetaSel ('Just "getFirst") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe a)))) | |
type Rep1 First | |
Defined in Data.Monoid type Rep1 First = D1 ('MetaData "First" "Data.Monoid" "base" 'True) (C1 ('MetaCons "First" 'PrefixI 'True) (S1 ('MetaSel ('Just "getFirst") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec1 Maybe))) |
Instances
Monad Last | |
Functor Last | |
MonadFix Last | |
Defined in Control.Monad.Fix | |
Applicative Last | |
Foldable Last | |
Defined in Data.Foldable Methods fold :: Monoid m => Last m -> m foldMap :: Monoid m => (a -> m) -> Last a -> m foldMap' :: Monoid m => (a -> m) -> Last a -> m foldr :: (a -> b -> b) -> b -> Last a -> b foldr' :: (a -> b -> b) -> b -> Last a -> b foldl :: (b -> a -> b) -> b -> Last a -> b foldl' :: (b -> a -> b) -> b -> Last a -> b foldr1 :: (a -> a -> a) -> Last a -> a foldl1 :: (a -> a -> a) -> Last a -> a elem :: Eq a => a -> Last a -> Bool maximum :: Ord a => Last a -> a | |
Traversable Last | |
Eq a => Eq (Last a) | |
Ord a => Ord (Last a) | |
Read a => Read (Last a) | |
Defined in Data.Monoid | |
Show a => Show (Last a) | |
Generic (Last a) | |
Semigroup (Last a) | |
Monoid (Last a) | |
Generic1 Last | |
type Rep (Last a) | |
Defined in Data.Monoid type Rep (Last a) = D1 ('MetaData "Last" "Data.Monoid" "base" 'True) (C1 ('MetaCons "Last" 'PrefixI 'True) (S1 ('MetaSel ('Just "getLast") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe a)))) | |
type Rep1 Last | |
Defined in Data.Monoid type Rep1 Last = D1 ('MetaData "Last" "Data.Monoid" "base" 'True) (C1 ('MetaCons "Last" 'PrefixI 'True) (S1 ('MetaSel ('Just "getLast") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec1 Maybe))) |