News for hackers. Stuff that matters.
Re:Red Hat is buying Ansible by leg100 on Friday October 16, 2015 @04:05AM (#10398048)
This clearly is much more about Tower, consultancy, etc, than their main product, but their yaml encoded language is an abomination; masquerading as 'declarative' and easy to read, yet piling on loops and conditional statements and an unintuitive inheritance tree of global and local variables.
Re:Red Hat is buying Ansible by bryanlarsen on Friday October 16, 2015 @08:56AM (#10398926)
You missed the quoting mess, adding their own compact list and map grammar, the convention of having a comment on every line, and there's more I can't think of right now.

I hate ansible, it's just better than any of the alternatives for different reasons. Luckily we're moving away from needing any of them. Scripting an image build is a lot easier than updating a machine using CI: you start from a blank slate every time, and an out of date script isn't the catastrophe it is with CI since you have the images saved.

Re:Red Hat is buying Ansible by dorfsmay on Friday October 16, 2015 @10:04AM (#10399325)
I think when ansible started it wasn't obvious that logic (loops, conditional etc...) would be needed eventually. By the time it became obvious it was going to be required, it was too late to change.

Using jinja2 for markup compounded the issue in my opinion, as it has no loops and logic is less than obvious (compared to mako for example).

Still I find its agentless model, the idempotent model, being able to use it on machines where you don't have root access etc... gives it a place that nobody had fulfilled.

Re:Red Hat is buying Ansible by SEJeff on Friday October 16, 2015 @11:07AM (#10399793)
""" Using jinja2 for markup compounded the issue in my opinion, as it has no loops and logic is less than obvious """

This comment makes pretty much no sense at all. Example of a loop in jinja2:

{% for item in ("one", "two", "three") %}

    item is {{ item }}
{% endfor %}

The logic is pure python minus perhaps setting variables ie:

{% set name = "dorfsmay" %}

{% if name == "dorfsmay" or name.startswith("dorfs") %}

    You're spreading FUD about jinja2
{% endif %}
Re:Red Hat is buying Ansible by justingood on Friday October 16, 2015 @11:37AM (#10399998)
I'd agree that jinja2 has a perfectly fine way of handling loops, but the problem is that functionality only works in Ansible template files. The Ansible playbook can only make use jinja2 filters to act on variables: https://docs.ansible.com/ansible/playbooks_filters.html
Re:Red Hat is buying Ansible by SEJeff on Friday October 16, 2015 @11:54AM (#10400114)
Oh no disagreement there. I was just disagreeing with the GPs disparagement of jinja2, which is a limitation of how Ansible was implemented and has absolutely nothing to do with jinja2.

Ansible is great stuff, but some of those decisions were quite weird.

Re:Red Hat is buying Ansible by d23 on Friday October 16, 2015 @12:09PM (#10400247)
Jinja is great as a templating language. I find yaml by itself to be clean and readable. Cram all of it in to the same soup, mix in the global variables, and it quickly turns into a nightmare. It takes what's already a problem in a dynamically typed language and amplifies it.
Re:Red Hat is buying Ansible by X-Istence on Saturday October 17, 2015 @02:21AM (#10403568)
{% for x in y %}

isn't a loop?

Re:Red Hat is buying Ansible by anton_gogolev on Friday October 16, 2015 @05:13AM (#10398229)
Spot on. I'm constantly amazed at how many projects use _serialization formats_ as a "programming language". LiquiBase, NAnt, MSBuild, Ansible.
Re:Red Hat is buying Ansible by TeMPOraL on Friday October 16, 2015 @05:49AM (#10398336)
That's people constantly reinventing Lisp, refusing to use the right tool for the job. Greenspun's Tenth Rule also comes to mind.
Re:Red Hat is buying Ansible by Jweb_Guru on Friday October 16, 2015 @09:43AM (#10399163)
Lisp is not and has never been the right tool for configuration management.
Re:Red Hat is buying Ansible by zeveb on Friday October 16, 2015 @11:00AM (#10399749)
> Lisp is not and has never been the right tool for configuration management.

Why not? Configurations are collections of items, and among the things Lisp excels at is…lists of atoms.

Take a look at https://github.com/ansible/ansible-examples/tree/master/lamp... (a simple LAMP stack implemented in Ansible).

It uses a .ini-style file to manage lists of hosts, e.g.:

    [webservers]
    localhost

    [dbservers]
    bensible
    sensible
Why not put that in a list?

    (hosts
      (webservers localhost)
      (dbservers bensible sensible))
The Ansible playbooks are YAML lists. There's no particular reason that:

    ---
    # This playbook deploys the whole application stack in this site
    - name: apply common configuration to all nodes
      hosts: all
      remote_user: root
      
      roles:
      - common
    …
is more readable than:

    (playbook
      "This playbook deploys the whole application stack in this site"
      (play
        "apply common configuration to all nodes"
        (hosts all)
        (remote-user root)
        (roles common)
      …)
or:

    (playbook '((all '(common) :user root :comment "apply common configuration to all nodes") …)
      :comment "This playbook deploys the whole application stack in this site")
In fact, I'd argue that both Lispy representations are much more readable.
Re:Red Hat is buying Ansible by Jweb_Guru on Friday October 16, 2015 @12:22PM (#10400343)
Oh, I didn't mean to say that S-expressions can't be used for configuration. It's that in general you don't want a Turing-complete language to do configuration management, because you want to be able to reason about things like rollbacks, dependencies and diffs.
Re:Red Hat is buying Ansible by zeveb on Friday October 16, 2015 @02:01PM (#10400989)
Yeah, except that inevitably one does end up wanting some element of Turing-compleness, hence the Jinja templates used in Saltstack & Ansible.

In a S-expression-based configuration language, one would either embed an S-expression-based programming language, or generate the S-expressions with a programming language which can manipulate S-expressions.

I don't think that it's that easy to get away from needing Turing-completeness in general. No reason you can't still support rollbacks, dependencies and diffs anyway.

Re:Red Hat is buying Ansible by firstprimate on Friday October 16, 2015 @02:50PM (#10401325)
Can you elaborate on this?
Re:Red Hat is buying Ansible by TeMPOraL on Friday October 16, 2015 @02:57PM (#10401354)
I think this is something along the lines of what a friend once told me: "Compare the grammar of Java and C++. C++ has a very complex definition, whereas Java is brain-dead simple. And that fact enables all the powerful transformations IDE can do."

Also there's this school of thought that attributes most security problems to people accidentally using Turing-complete languages where they meant to use something less powerful. Consider vulnerability to arbitrary code execution through user input injection, which could be interpreted by your program being a "parser" (so-called "shotgun parser" - it's implicitly distributed throughout your code base) for a Turing-complete superset of what was supposed to be a list of accepted inputs. There are pretty good talks about this line of thought and I personally find it pretty interesting.

But none of this affects the fact that in complicated enough programs, you need "configuration" to be more code than data, which leads people not knowing of Lisp to reinvent a subset of it in XML or JSON or something similar.

Re:Red Hat is buying Ansible by firstprimate on Friday October 16, 2015 @04:15PM (#10401737)
Right. That addresses the point about mangling YAML into something that looks like a language. It was this that made be curious: "It's that in general you don't want a Turing-complete language to do configuration management, because you want to be able to reason about things like rollbacks, dependencies and diffs."
Re:Red Hat is buying Ansible by TeMPOraL on Friday October 16, 2015 @02:10PM (#10401060)
Probably because nobody called it 'configuration management' then. It's a very good tool from the job - because eventually all configuration formats end up getting Turing-complete and totally unreadable. Why not just start with something that supports code = data out of the box?
Re:Red Hat is buying Ansible by eviltwinskippy on Friday October 16, 2015 @01:59PM (#10400983)
True. That's why Tcl was invented.
Re:Red Hat is buying Ansible by crdoconnor on Friday October 16, 2015 @05:27AM (#10398273)
It can work but it works best when the language is kept dumb.

A dumb declarative language is easier to understand and easier to maintain. It can be used to help maintain a strict separation of concerns.

The smarter you try to make the language, the worse it becomes. Ant & MSBuild AFAIK are basically full programming languages in their own right so there was really no point to them actually being their own language.

Re:Red Hat is buying Ansible by gerbilly on Friday October 16, 2015 @08:06AM (#10398724)
It seems like parsing is becoming a lost art.

Maybe because it can't be easily approached by the iterative development style that is in fashion these days.

Re:Red Hat is buying Ansible by ufo on Friday October 16, 2015 @08:41AM (#10398853)
The real lost art here is scripting languages. Even if you parse things yourself, configuration files still have a natural tendency to evolve into a crappy programming language over time. So instead of writing your own config file format you should just make a couple a quick bindings for a scripting language like Lua, Python or Ruby.
Re:Red Hat is buying Ansible by raverbashing on Friday October 16, 2015 @05:21AM (#10398254)
Maven or pretty much anything XML based
Re:Red Hat is buying Ansible by reitanqild on Friday October 16, 2015 @05:24AM (#10398267)
In defense of maven it does provide neither branching nor looping statements so refering to it as a "programming language" is hard to justify.
Re:Red Hat is buying Ansible by collyw on Friday October 16, 2015 @06:32AM (#10398477)
Neither does HTML and the L stands for language.
Re:Red Hat is buying Ansible by executesorder66 on Friday October 16, 2015 @07:52AM (#10398669)
Notice how the M stands for "Markup" and not "Programming"
Re:Red Hat is buying Ansible by detaro on Friday October 16, 2015 @07:04AM (#10398554)
"language" != "programming language"
Re:Red Hat is buying Ansible by roma1n on Friday October 16, 2015 @05:25AM (#10398269)
I haven't seen conditionals or loops widely used within Maven's XML.
Re:Red Hat is buying Ansible by bbrazil on Friday October 16, 2015 @06:12AM (#10398421)
Syntax and semantics are separate, not having to learn a new syntax is handy.

Syntactically the problem I run into is that it's got it's own DSL in task definitions, so it can be hard to keep in mind what's YAML and what's the DSL.

Semantically loops and conditions are essential features so I don't have a problem with that. The inheritance could use some clarification, I was hit last year by a regression that remains unresolved.