--- - name: Install the epel packages for EL distributions package: name=epel-release state=present when: nginx_is_el|bool and nginx_install_epel_repo|bool - name: Install the nginx packages from official repo for EL distributions yum: name={{ item }} state=present enablerepo="nginx" with_items: "{{ nginx_pkgs }}" when: nginx_is_el|bool and nginx_official_repo - name: Install the nginx packages for all other distributions package: name={{ item }} state=present with_items: "{{ nginx_pkgs }}" environment: "{{ nginx_env }}" when: not nginx_is_el|bool or not nginx_official_repo