Currently I have the following.
tasks:
-
name: install the Debian packages
apt: name={{ item }} state=latest
with_items: “{{ packages }}”
when: ansible_os_family == “Debian” -
name: install the RedHat packages
yum: pkg={{ item }} state=latest
with_items: “{{ packages }}”
when: ansible_os_family == “RedHat”
Is there anyway to have one task? I have packages array dynamically created. I wish at least I can just have tasks completely ignored if it is on the wrong OS, so it won’t be included…