diff options
| author | Joey Hess <joeyh@joeyh.name> | 2018-04-08 18:13:17 -0400 |
|---|---|---|
| committer | Joey Hess <joeyh@joeyh.name> | 2018-04-08 18:13:17 -0400 |
| commit | 3cba277a166da90d3cceabb144562ec7491f9a6d (patch) | |
| tree | eb164ff5dec39b7e6587cf13573a883be3727274 /src/Propellor | |
| parent | 2bb007ea36e0f65942626a6dcd5d237a5e409fd6 (diff) | |
propellor spin
Diffstat (limited to 'src/Propellor')
| -rw-r--r-- | src/Propellor/Property/SiteSpecific/JoeySites.hs | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/Propellor/Property/SiteSpecific/JoeySites.hs b/src/Propellor/Property/SiteSpecific/JoeySites.hs index 8aa2f3bd..dbee7b0a 100644 --- a/src/Propellor/Property/SiteSpecific/JoeySites.hs +++ b/src/Propellor/Property/SiteSpecific/JoeySites.hs @@ -15,6 +15,7 @@ import qualified Propellor.Property.Git as Git import qualified Propellor.Property.Cron as Cron import qualified Propellor.Property.Service as Service import qualified Propellor.Property.User as User +import qualified Propellor.Property.Group as Group import qualified Propellor.Property.Borg as Borg import qualified Propellor.Property.Apache as Apache import qualified Propellor.Property.Postfix as Postfix @@ -916,10 +917,15 @@ homePowerMonitor user hosts ctx sshkey = propertyList "home power monitor" $ pro & File.ownerGroup "/var/www/html" user (userGroup user) & Git.cloned user "git://git.kitenet.net/joey/homepower" d Nothing & buildpoller + & Systemd.enabled setupservicename + `requires` setupserviceinstalled + `onChange` Systemd.started setupservicename & Systemd.enabled servicename `requires` serviceinstalled `onChange` Systemd.started servicename & User.hasGroup user (Group "dialout") + & Group.exists (Group "gpio") Nothing + & User.hasGroup user (Group "gpio") & Cron.niceJob "homepower upload" (Cron.Times "1 * * * *") user d rsynccommand `requires` Ssh.userKeyAt (Just sshkeyfile) user ctx sshkey @@ -951,6 +957,23 @@ homePowerMonitor user hosts ctx sshkey = propertyList "home power monitor" $ pro , "[Install]" , "WantedBy=multi-user.target" ] + setupservicename = "homepower-setup" + setupservicefile = "/etc/systemd/system/" ++ setupservicename ++ ".service" + setupserviceinstalled = servicefile `File.hasContent` + [ "[Unit]" + , "Description=home power monitor setup" + , "" + , "[Service]" + , "ExecStart=" ++ d ++ "/setup" + , "WorkingDirectory=" ++ d + , "User=root" + , "Group=root" + , "Type=oneshot" + , "" + , "[Install]" + , "WantedBy=multi-user.target" + , "WantedBy=homepower.target" + ] -- Any changes to the rsync command will need my .authorized_keys -- rsync server command to be updated too. rsynccommand = "rsync -e 'ssh -i" ++ sshkeyfile ++ "' -avz rrds/recent/ joey@kitenet.net:/srv/web/homepower.joeyh.name/rrds/recent/" |
