--- - name: Install packages package: name={{ item }} state=present update_cache=yes with_items: - ca-certificates - curl - include_tasks: ubuntu.yml when: ansible_pkg_mgr == 'apt' - include_tasks: centos.yml when: ansible_pkg_mgr == 'yum'