3 ms·
Good points. Ansible playbooks are not always declarative. There is often stuff that looks like this: --- --- # Launch Job to count occurance of a wor
by rdtsc 12y ago
Good points.
Ansible playbooks are not always declarative. There is often stuff that looks like this:
---
---
# Launch Job to count occurance of a word.
- hosts: $server
user: root
tasks:
- name: copy the file
copy: src=inputfile dest=/tmp/inputfile
- name: upload the file
shell: ...
<more names and shell pairs ...>
---
That is just specifying a set of steps. So then it calls for for loops, if conditions, and so on.
I noticed that pattern in examples when looking at Ansible and kind of shook my head.
But oh well, I guess, it depends on how you arrived at Ansible. I think if you view it as "better than SSH-ing and running shell scripts". Ok it looks nice. But if you want a more mature declarative based configuration system, then maybe you'll start to see various flaws or design issues with it.
Chef seems more powerful. Also played with saltstack. I like saltstack better so far but aside from playing with it still use shell scripts and OS packaging pre-/post- install scripts to handle tasks like these.
- btgeekboy 12y agoYou say that they're not always declarative like it's a bad thing. Personally, I find it nice that we have the playbooks to build out our infrastructure and the playbooks that perform a rolling upgrade of our application using the same syntax, variables, and inventories. If you keep your declarative playbooks separate from your procedural ones, you get more power than a declarative system alone can provide. (FWIW, we chose it not just for this, but because of its lack of an agent - we can use our configuration management to deploy software to customers' infrastructure without colliding with their own CM.) Further, this (using a data language as a programming language) isn't without precedent. Both XSL and Ant have standard conditionals, loops, etc available for use.
- jimbokun 12y agoXSL and Ant are the poster children for why this is a bad idea.
- dj-wonk 12y ago> Both XSL and Ant have standard conditionals, loops, etc available for use. Yes, XSL and Ant got there first, but what fraction of us would like to see the same decision made again? :)
- vertex-four 12y agoSalt implements its declarative language as a separate thing (States) from its more imperative parts (Modules, Runners, and the like). That's probably a better abstraction.
- krakensden 12y agoThings that take serious logic and state should be re-written as modules (or ActionModules, which are awesome & underdocumented). I feel like people are far too scared of writing their own modules- it's not very hard.