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.
On 2 February 2015 at 11:10, Giovanni Tirloni <[email protected]> wrote:
> On Mon, 02 Feb 2015 10:58 +0100, Anand Buddhdev <[email protected]>
> wrote:
> > Hi Tom,
> >
> > I just tried the syntax you suggested.
> >
> > My very simple playbook is:
> >
> > - hosts: myhost
> > tasks:
> > - name: install packages
> > yum:
> > name:
> > - screen
> > - tmux
> > state: installed
> >
>
> - hosts: myhost
> tasks:
> - name: install packages
> yum:
> name: "{{ item }}"
> state: latest
> with_items:
> - screen
> - tmux
>
>
> Useful reading:
> http://docs.ansible.com/playbooks_loops.html
>
> Giovanni
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Ansible Project" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/ansible-project/dGJRlrohfmY/unsubscribe.
> To unsubscribe from this group and all its topics, 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/1422871831.2610733.221884249.32774E87%40webmail.messagingengine.com
> .
> For more options, visit https://groups.google.com/d/optout.
>
--
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/CANbPJFn3ZbnsGfm05q1ZqCYPtpOQGyzPL9qTumhgOGhgcezZHw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.