improved
This commit is contained in:
parent
c8bd343697
commit
d50e4dedb2
37
HostProp.hs
37
HostProp.hs
|
@ -15,14 +15,34 @@ main = ensureProperties . getProperties =<< getHostName
|
||||||
- or one specified on the command line is converted into a list of
|
- or one specified on the command line is converted into a list of
|
||||||
- Properties for that system. -}
|
- Properties for that system. -}
|
||||||
getProperties :: HostName -> [Property]
|
getProperties :: HostName -> [Property]
|
||||||
getProperties "clam.kitenet.net" =
|
getProperties "clam.kitenet.net" = concat
|
||||||
|
[ cleanCloudAtCost
|
||||||
|
, standardSystem Apt.Unstable
|
||||||
|
-- Clam is a tor bridge.
|
||||||
|
, Tor.isBridge
|
||||||
|
-- This is not an important system so I don't want to need to
|
||||||
|
-- manually upgrade it.
|
||||||
|
, Apt.unattendedUpgrades True
|
||||||
|
-- Should come last as it reboots.
|
||||||
|
, Apt.installed ["systemd-sysv"] `onChange` Reboot.now
|
||||||
|
]
|
||||||
|
-- add more hosts here...
|
||||||
|
--getProperties "foo" =
|
||||||
|
getProperties h = error $ "Unknown host: " ++ h ++ " (perhaps you should specify the real hostname on the command line?)"
|
||||||
|
|
||||||
-- Clean up the system as installed by cloudatcost.com
|
-- Clean up the system as installed by cloudatcost.com
|
||||||
|
cleanCloudAtCost :: [Property]
|
||||||
|
cleanCloudAtCost =
|
||||||
[ User.nuked "user"
|
[ User.nuked "user"
|
||||||
, Apt.removed ["exim4"] `onChange` Apt.autoRemove
|
, Apt.removed ["exim4"] `onChange` Apt.autoRemove
|
||||||
, Hostname.set "clam.kitenet.net"
|
, Hostname.set "clam.kitenet.net"
|
||||||
, Ssh.uniqueHostKeys
|
, Ssh.uniqueHostKeys
|
||||||
|
]
|
||||||
|
|
||||||
-- This is my standard system setup
|
-- This is my standard system setup
|
||||||
, Apt.stdSourcesList Apt.Unstable `onChange` Apt.upgrade
|
standardSystem :: Suite -> [Property]
|
||||||
|
standardSystem suite =
|
||||||
|
[ Apt.stdSourcesList suite `onChange` Apt.upgrade
|
||||||
, Apt.installed ["etckeeper"]
|
, Apt.installed ["etckeeper"]
|
||||||
, Apt.installed ["ssh"]
|
, Apt.installed ["ssh"]
|
||||||
, GitHome.installedFor "root"
|
, GitHome.installedFor "root"
|
||||||
|
@ -35,16 +55,7 @@ getProperties "clam.kitenet.net" =
|
||||||
, Apt.installed ["vim"]
|
, Apt.installed ["vim"]
|
||||||
, User.nonsystem "joey"
|
, User.nonsystem "joey"
|
||||||
, Apt.installed ["sudo"]
|
, Apt.installed ["sudo"]
|
||||||
, lineInFile "/etc/sudoers" "joey ALL=(ALL:ALL) ALL"
|
-- nopasswd because no password is set up for joey.
|
||||||
|
, lineInFile "/etc/sudoers" "joey ALL=(ALL:ALL) NOPASSWD:ALL"
|
||||||
, GitHome.installedFor "joey"
|
, GitHome.installedFor "joey"
|
||||||
-- Clam is a tor bridge.
|
|
||||||
, Tor.isBridge
|
|
||||||
-- This is not an important system so I don't want to need to
|
|
||||||
-- manually upgrade it.
|
|
||||||
, Apt.unattendedUpgrades True
|
|
||||||
-- Should come last as it reboots.
|
|
||||||
, Apt.installed ["systemd-sysv"] `onChange` Reboot.scheduled "+10"
|
|
||||||
]
|
]
|
||||||
-- add more hosts here...
|
|
||||||
--getProperties "foo" =
|
|
||||||
getProperties h = error $ "Unknown host: " ++ h ++ " (perhaps you should specify the real hostname on the command line?)"
|
|
||||||
|
|
|
@ -3,6 +3,5 @@ module Property.Reboot where
|
||||||
import Property
|
import Property
|
||||||
import Utility.SafeCommand
|
import Utility.SafeCommand
|
||||||
|
|
||||||
{- Use eg, "+5" to reboot in 5 minutes. -}
|
now -> Property
|
||||||
scheduled :: String -> Property
|
now = cmdProperty "reboot" []
|
||||||
scheduled rebootwhen = cmdProperty "shutdown" [ Param "-r", Param rebootwhen ]
|
|
||||||
|
|
Loading…
Reference in New Issue