On Mon, 02 Feb 2015 11:34 +0100, Anand Buddhdev <[email protected]> wrote: > Hi Giovanni, > > Your suggestion works. But I think what I was trying to say is that > Ansible's playbook syntax is mixed. Wouldn't it be cool if it were pure > YAML, with Jinja templating? Then it would allow something like: > > - hosts: myhost > tasks: > - name: install packages > yum: > name: > - tmux > - screen > {% if ansible_distribution_major_version == '6' %} > - lsof > {% endif %} > > Instead of inventing ansible-specific loops, we could just use the power > of > Jinja templating.
As an Ansible newbie, I have struggled with understanding where it's Ansible or Jinja2 doing the parsing. So I can surely related to that. On the other hand, Ansible tries to be simple and the looping constructs, IMHO, are easy to work with and have a concise syntax. I don't have enough experience with Ansible to suggest where it should go next. In my so far very limited knowledge of Ansible, I would suggest encapsulating these things in different roles (e.g. common_debian, common_centos6, common_centos7). It seems more idiomatic in Ansible, based on the examples I've seen so far. Giovanni -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/1422875948.2632340.221904057.7C4B5D3D%40webmail.messagingengine.com. For more options, visit https://groups.google.com/d/optout.
