/ config-freebsd.hs
config-freebsd.hs
1 -- This is the main configuration file for Propellor, and is used to build 2 -- the propellor program. 3 -- 4 -- This shows how to set up a FreeBSD host (and a Linux host too). 5 6 import Propellor 7 import qualified Propellor.Property.File as File 8 import qualified Propellor.Property.Apt as Apt 9 import qualified Propellor.Property.Network as Network 10 import qualified Propellor.Property.Cron as Cron 11 import Propellor.Property.Scheduled 12 import qualified Propellor.Property.User as User 13 import qualified Propellor.Property.Docker as Docker 14 import qualified Propellor.Property.FreeBSD.Pkg as Pkg 15 import qualified Propellor.Property.ZFS as ZFS 16 import qualified Propellor.Property.FreeBSD.Poudriere as Poudriere 17 18 main :: IO () 19 main = defaultMain hosts 20 21 -- The hosts propellor knows about. 22 hosts :: [Host] 23 hosts = 24 [ freebsdbox 25 , linuxbox 26 ] 27 28 -- An example freebsd host. 29 freebsdbox :: Host 30 freebsdbox = host "freebsdbox.example.com" $ props 31 & osFreeBSD (FBSDProduction FBSD102) X86_64 32 & Pkg.update 33 & Pkg.upgrade 34 & Poudriere.poudriere poudriereZFS 35 & Poudriere.jail (Poudriere.Jail "formail" (fromString "10.2-RELEASE") (fromArchitecture X86_64)) 36 37 poudriereZFS :: Poudriere.Poudriere 38 poudriereZFS = Poudriere.defaultConfig 39 { Poudriere._zfs = Just $ Poudriere.PoudriereZFS 40 (ZFS.ZFS (fromString "zroot") (fromString "poudriere")) 41 (ZFS.fromList [ZFS.Mountpoint (fromString "/poudriere"), ZFS.ACLInherit ZFS.AIPassthrough]) 42 } 43 44 -- An example linux host. 45 linuxbox :: Host 46 linuxbox = host "linuxbox.example.com" $ props 47 & osDebian' KFreeBSD Unstable X86_64 48 & Apt.stdSourcesList 49 & Apt.unattendedUpgrades 50 & Apt.installed ["etckeeper"] 51 & Apt.installed ["ssh"] 52 & User.hasSomePassword (User "root") 53 & Network.ipv6to4 54 & File.dirExists "/var/www" 55 & Docker.docked webserverContainer 56 & Docker.garbageCollected `period` Daily 57 & Cron.runPropellor (Cron.Times "30 * * * *") 58 59 -- A generic webserver in a Docker container. 60 webserverContainer :: Docker.Container 61 webserverContainer = Docker.container "webserver" (Docker.latestImage "debian") $ props 62 & osDebian' KFreeBSD (Stable "trixie") X86_64 63 & Apt.stdSourcesList 64 & Docker.publish "80:80" 65 & Docker.volume "/var/www:/var/www" 66 & Apt.serviceInstalledRunning "apache2"