Safe Haskell | Safe-Inferred |
---|---|
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
- (&) :: (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
- class Semigroup a => Monoid a where
- newtype Any = Any {
- getAny :: Bool
- 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
- newtype All = All {
- getAll :: Bool
- newtype Alt (f :: k -> Type) (a :: k) = Alt {
- getAlt :: f a
- 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
- fromString :: IsString a => String -> a
- (<>) :: Semigroup a => a -> a -> 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
class Semigroup a => Monoid a where #
Minimal complete definition
Instances
Instances
Monoid Any | |
Semigroup Any | |
Bounded Any | |
Defined in Data.Semigroup.Internal | |
Generic Any | |
Read Any | |
Defined in Data.Semigroup.Internal | |
Show Any | |
NFData Any | |
Defined in Control.DeepSeq | |
Eq Any | |
Ord 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))) | |
type MEmpty | |
Defined in Fcf.Class.Monoid type MEmpty = 'Any 'False | |
type ('Any a :: Any) <> ('Any b :: Any) | |
newtype Ap (f :: k -> Type) (a :: k) #
Instances
Generic1 (Ap f :: k -> Type) | |
MonadFail f => MonadFail (Ap f) | |
Defined in Data.Monoid | |
MonadFix f => MonadFix (Ap f) | |
Defined in Control.Monad.Fix | |
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) | |
Applicative f => Applicative (Ap f) | |
Functor f => Functor (Ap f) | |
Monad f => Monad (Ap f) | |
MonadPlus f => MonadPlus (Ap f) | |
(Applicative f, Monoid a) => Monoid (Ap f a) | |
(Applicative f, Semigroup a) => Semigroup (Ap f a) | |
(Applicative f, Bounded a) => Bounded (Ap f a) | |
Defined in Data.Monoid | |
Enum (f a) => Enum (Ap f a) | |
Generic (Ap f a) | |
(Applicative f, Num a) => Num (Ap f a) | |
Read (f a) => Read (Ap f a) | |
Defined in Data.Monoid | |
Show (f a) => Show (Ap f a) | |
Eq (f a) => Eq (Ap f a) | |
Ord (f a) => Ord (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
MonadFix First | |
Defined in Control.Monad.Fix | |
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 | |
Applicative First | |
Functor First | |
Monad First | |
NFData1 First | |
Defined in Control.DeepSeq | |
Generic1 First | |
Monoid (First a) | |
Semigroup (First a) | |
Generic (First a) | |
Read a => Read (First a) | |
Defined in Data.Monoid | |
Show a => Show (First a) | |
NFData a => NFData (First a) | |
Defined in Control.DeepSeq | |
Eq a => Eq (First a) | |
Ord a => Ord (First 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))) | |
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)))) |
Instances
MonadFix Last | |
Defined in Control.Monad.Fix | |
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 | |
Applicative Last | |
Functor Last | |
Monad Last | |
NFData1 Last | |
Defined in Control.DeepSeq | |
Generic1 Last | |
Monoid (Last a) | |
Semigroup (Last a) | |
Generic (Last a) | |
Read a => Read (Last a) | |
Defined in Data.Monoid | |
Show a => Show (Last a) | |
NFData a => NFData (Last a) | |
Defined in Control.DeepSeq | |
Eq a => Eq (Last a) | |
Ord a => Ord (Last 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))) | |
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)))) |
Instances
Monoid All | |
Semigroup All | |
Bounded All | |
Defined in Data.Semigroup.Internal | |
Generic All | |
Read All | |
Defined in Data.Semigroup.Internal | |
Show All | |
NFData All | |
Defined in Control.DeepSeq | |
Eq All | |
Ord 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))) | |
type MEmpty | |
Defined in Fcf.Class.Monoid type MEmpty = 'All 'True | |
type ('All a :: All) <> ('All b :: All) | |
newtype Alt (f :: k -> Type) (a :: k) #
Instances
Generic1 (Alt f :: k -> Type) | |
MonadFix f => MonadFix (Alt f) | |
Defined in Control.Monad.Fix | |
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) | |
Applicative f => Applicative (Alt f) | |
Functor f => Functor (Alt f) | |
Monad f => Monad (Alt f) | |
MonadPlus f => MonadPlus (Alt f) | |
Alternative f => Monoid (Alt f a) | |
Alternative f => Semigroup (Alt f a) | |
Enum (f a) => Enum (Alt f a) | |
Defined in Data.Semigroup.Internal | |
Generic (Alt f a) | |
Num (f a) => Num (Alt f a) | |
Read (f a) => Read (Alt f a) | |
Defined in Data.Semigroup.Internal | |
Show (f a) => Show (Alt f a) | |
Eq (f a) => Eq (Alt f a) | |
Ord (f a) => Ord (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)))) |
Instances
MonadFix Dual | |
Defined in Control.Monad.Fix | |
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 | |
Applicative Dual | |
Functor Dual | |
Monad Dual | |
NFData1 Dual | |
Defined in Control.DeepSeq | |
Generic1 Dual | |
Monoid a => Monoid (Dual a) | |
Semigroup a => Semigroup (Dual a) | |
Bounded a => Bounded (Dual a) | |
Defined in Data.Semigroup.Internal | |
Generic (Dual a) | |
Read a => Read (Dual a) | |
Defined in Data.Semigroup.Internal | |
Show a => Show (Dual a) | |
NFData a => NFData (Dual a) | |
Defined in Control.DeepSeq | |
Eq a => Eq (Dual a) | |
Ord a => Ord (Dual 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)) | |
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))) |
Instances
Monoid (Endo a) | |
Semigroup (Endo a) | |
Generic (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
MonadFix Product | |
Defined in Control.Monad.Fix | |
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 | |
Applicative Product | |
Functor Product | |
Monad Product | |
NFData1 Product | |
Defined in Control.DeepSeq | |
Generic1 Product | |
Num a => Monoid (Product a) | |
Num a => Semigroup (Product a) | |
Bounded a => Bounded (Product a) | |
Defined in Data.Semigroup.Internal | |
Generic (Product a) | |
Num a => Num (Product a) | |
Read a => Read (Product a) | |
Defined in Data.Semigroup.Internal | |
Show a => Show (Product a) | |
NFData a => NFData (Product a) | |
Defined in Control.DeepSeq | |
Eq a => Eq (Product a) | |
Ord a => Ord (Product a) | |
Defined in Data.Semigroup.Internal | |
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)) | |
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))) |
Instances
MonadFix Sum | |
Defined in Control.Monad.Fix | |
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 | |
Applicative Sum | |
Functor Sum | |
Monad Sum | |
NFData1 Sum | |
Defined in Control.DeepSeq | |
Generic1 Sum | |
Num a => Monoid (Sum a) | |
Num a => Semigroup (Sum a) | |
Bounded a => Bounded (Sum a) | |
Defined in Data.Semigroup.Internal | |
Generic (Sum a) | |
Num a => Num (Sum a) | |
Read a => Read (Sum a) | |
Defined in Data.Semigroup.Internal | |
Show a => Show (Sum a) | |
NFData a => NFData (Sum a) | |
Defined in Control.DeepSeq | |
Eq a => Eq (Sum a) | |
Ord a => Ord (Sum 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)) | |
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))) |
fromString :: IsString a => String -> a #