Dynamic Package Installs?

28 views
Skip to first unread message

Joaquin Menchaca

unread,
Jul 7, 2015, 2:08:52 PM7/7/15
to ansible...@googlegroups.com
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....





Joaquin Menchaca

unread,
Jul 7, 2015, 2:26:17 PM7/7/15
to ansible...@googlegroups.com
Would it be possible to do something like this?

  tasks:
    - include: "tasks/{{ ansible_os_family }}.yml"


I get this error

ERROR: file could not read: /Users/testuser/testarea/provisioning/tasks/{{ ansible_os_family }}.yml
Ansible failed to complete successfully. Any error output should be
visible above. Please fix these errors and try again.


Reply all
Reply to author
Forward
0 new messages