I want to install some packages on a server. Additionally, if a certain
condition is true, I want to add an extra package to the list of packages
to be installed. What I would love is have this:
- name: install packages
yum: name={{ item }}
with_items:
- package1
- package2
{% if condition %}
- package3
{% endif %}
Now, I know that ansible doesn't parse playbooks with the full Jinja engine
(though that would be so cool). I could of course achieve this with 2 tasks:
- name: install packages
yum: name={{ item }}
with_items:
- package1
- package2
- name: install packages
yum: name=package3
when: condition
But my question is: how can I achieve this with just one task?
--
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/52253b21-5c97-422a-9e07-25b927b5d404%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.