Having taken the inital hurdle of getting propellor running (cf. my last post in this forum), I am beginning to like propellor quite a lot. - This comes not too much as a surprise, as I am a Haskeller really. - I would love to use it for all my configuration needs, and to that end ditch ansible.
Propellor's biggest show stopper for me is this (maybe I am misunderstanding propellor?):
I can run
propellor --spin myhost
from the command line, and all the tasks/properties that I have defined myhost to have beforehand will be executed/realized/configured.
Say eg. I haved defined (sorry for the bad formatting, seems I have to do it line by line to get the markdown look nice)
myhost :: Host
myhost = host "myhost"
& os (System (Debian Testing) "amd64")
& emacs
& apt
emacs :: Property HasInfo
emacs = propertyList "install & configure emacs" $ props
& Apt.installed ["emacs"
, "auto-complete-el"]
apt :: Property HasInfo
apt = propertyList "apt update + upgrade" $ props
& Apt.update
& Apt.upgrade
Then running
propellor --spin myhost
will make sure, that emacs is installed, and all my packages on myhost are up to date.
It does so every time I run propellor, but normally I install emacs only once (and I know it's installed), whereas the apt update+upgrade combo I would want to run every other day.
So what I would like is this: have just a minimal config for myhost, like this:
myhost :: Host
myhost = host "myhost"
& os (System (Debian Testing) "amd64")
and then run a task (require a property ?) on myhost, somehow from the command line, like this
propellor --spin myhost --task apt
Many other properties / installation steps I could run in this manner, like installing emacs initially
propellor --spin myhost --task emacs
In ansible I can do this with playbooks:
ansible-playbook -l myhost apt.yml
with some preconfigured playbook apt.yml that does just the apt update + upgrade task and nothing else. But I would have other tasks in other playbooks of course: I can install & configure emacs on myhost
ansible-playbook -l myhost emacs.yml
etc.
Related to that (but maybe not strictly the same question):
I wouldn't mind writing my own haskell script that does the command line parsing (with optparse applicative eg): I could have options for
--host (myhost/...)
and
--task (emacs/apt/...)
and then just call into propellor. Unfortunately propellor's defaultMain does more than I want: gets the command line from processCmdLine.
So I tried to create my own otherMain (similar to defaultMain, but would let me do my own command line parsing):
otherMain :: [Host] -> CmdLine -> IO ()
but then at some point just gave up: for one thing: things were getting complicated, because of all the indirection: the propellor command line tool recompiles itself (?), does all this git stuff etc.
And then: maybe I am approaching things in the wrong direction: maybe it's just not meant to be used that way (but ansible works fine for me in this regard)?
And I thought: I don't really want to start a major programming task just to get this thing working, the way that seems reasonable to me. Or maybe it's possible already, and I just don't know how to use it? (So I am stuck with ansible for the time being).
Still more or less related:
Say this otherMain function existed, that allowed me to to do my own command line parsing and just call propellor on some host with the one or the other task, I am not 100% what's the right way to ensure/require/execute such a task on a host:
above I am just using
host & property
(from PropAccum), but maybe ensureProperty is better suited for that?
Also for the wish list: some CONFIG_FILE env variable that would allow me to keep my config.hs somewhere other than in ~/.propellor/config.hs
Anyway, thanks so far I would certainly want to switch to propellor completely.
Andreas
By composing these things at the command-line, you're using the command-line, rather than haskell, for describing your system. I don't think that's a win.
As far as properties that you don't want to have run every time, see
Propellor.Property.Scheduled.period
. For example:using the command line: well yes, that's right. Still: I can configure a lot of details in haskell (ansible playbooks):
my emacs task eg. is not only ensuring that emacs is installed (as in the example above), but I also set some links to my elisp config files, ensure that cask installed etc.
another task for me is installing X windows: again lots of details: not only the xorg packages, but some links to .xsession files, window manager config files etc.
and yes: I am happy, that I can spell out the details of these tasks in propellor/haskell.
I just don't see the point of ensuring them again and again with every spin of propellor, and I would want to be able to run just this one task on the command line.
concerning
Apt.update `period` Daily
thanks, will have a look. but I guess this is cron job (will see), in general I think I will want to stick to my habit, that I want to see what's going on (what is upgraded), thus prefer to not run any cron jobs for apt upgradesMy overall message / concern is: I don't want to completly change my habits, just because I am using propellor
I had the habit of installing my computers task by task
I had the habit of logging in to one of my systems, and doing apt-get update && apt-get upgrade
I want my config tool to help me achieve things in my way that I am used to.
period is not a cron job, it just modifies the Property to only do anything every so often.
It's also possible to modify a Property so it only runs once. flagFile can be used to do that.
But there are good reasons for propellor to default to checking all Properties of a system each time:
Well thanks a lot, and yes I am learning: propellor has a lot of powerful features under the hood already.
I still remain sceptical for the time being:
Propellor's overall approach seems: one spin of propellor does ensure that a complete systems is properly installed (and then one can declare exceptions: don't check this every time...). I can even see how this is useful: if I where a sys admin with a huge farm of systems, I wouldn't want to deal with half installed systems, but just have propellor do a complete job.
As far as I am only concerned with a few personal computers of mine, I prefer to stick to my task by task approach, though, and for tasks that come up reapeatedly (like keeping my apt cache + installed packages up to date) that seems reasonable to me as well. - having only a minimal required configuration for a host, and then building upon that (I think/hope, you got the idea by now). The fact, that this model is nicely supported by ansible, seems to suggest at least, that this kind of reasoning/approach is not completely flawed.
What is not 100% clear to me: if propellor could be bent to support my kind of workflow: I would think that it's possible? (even though I might not have the time to bend it that way myself). Or are there any fundamental issues with it?
What I am suggesting is: that propellor be at my disposal, more as a library, and would not also impose a certain command line interface / workflow on me.
Anyway, you would certainly win me as a user (don't know how much that counts, and cannot speak for other people's needs).
Thanks anyway. Andreas