propellor/config-simple.hs

52 lines
1.6 KiB
Haskell
Raw Normal View History

2014-04-01 22:56:56 +00:00
import Propellor
import Propellor.CmdLine
import qualified Propellor.Property.Apt as Apt
2015-08-15 08:30:42 +00:00
import qualified Propellor.Property.Cmd as Cmd
2014-04-01 22:56:56 +00:00
import qualified Propellor.Property.Cron as Cron
2015-08-15 07:48:39 +00:00
import qualified Propellor.Property.Docker as Docker
2014-04-01 22:56:56 +00:00
2014-04-19 21:08:20 +00:00
main :: IO ()
main = defaultMain hosts
2014-04-11 03:20:12 +00:00
hosts :: [Host]
hosts =
2015-08-15 08:30:42 +00:00
[ baseHost "hermit"
, baseHost "empress"
2015-08-15 05:27:47 +00:00
]
2015-08-15 07:48:39 +00:00
2015-08-15 08:30:42 +00:00
nimInstall :: Cmd.Script
nimInstall =
[ "mkdir /tmp/niminstall -p"
, "cd /tmp/niminstall"
, "wget http://nim-lang.org/download/nim-0.11.2.tar.xz"
, "tar xf nim-0.11.2.tar.xz"
, "mv nim-0.11.2 /usr/local/nim"
, "cd /usr/local/nim"
, "./build.sh"
]
2015-08-15 08:30:42 +00:00
baseHost :: HostName -> Host
baseHost name = host name
& os (System (Debian (Stable "jessie")) "amd64")
& Apt.stdSourcesList
& Apt.installed ["ssh", "build-essential"]
& Cron.runPropellor (Cron.Times "30 * * * *")
& Docker.configured
& Cmd.scriptProperty nimInstall
2015-08-15 07:48:39 +00:00
standardStableContainer :: Docker.ContainerName -> Docker.Container
standardStableContainer name = standardContainer name (Stable "jessie") "amd64"
standardContainer :: Docker.ContainerName -> DebianSuite -> Architecture -> Docker.Container
standardContainer name suite arch = Docker.container name (dockerImage system)
& os system
& Apt.stdSourcesList `onChange` Apt.upgrade
& Apt.unattendedUpgrades
& Apt.cacheCleaned
& Docker.tweaked
where
system = System (Debian suite) arch
2015-08-15 07:48:39 +00:00
dockerImage :: System -> Docker.Image
dockerImage _ = Docker.latestImage "debian"