--- - block: - name: 'DEBIAN | install {{ service_name }}' apt: pkg: '{{ service_packages }}' state: 'present' update_cache: true cache_valid_time: 3600 install_recommends: '{{ install_recommends | default("no") }}' tags: - 'packages' - name: 'DEBIAN | start {{ service_name }} at boot' service: name: '{{ service_name }}' enabled: true when: ansible_distribution != 'openwrt' - block: - name: 'OPENWRT | install {{ service_name }}' opkg: name: '{{ item }}' state: 'present' update_cache: true loop: '{{ service_packages|flatten(levels=1) }}' tags: - 'packages' - name: 'OPENWRT | start {{ service_name }} at boot' openwrt_init: name: '{{ service_name }}{{ "d" if service_name=="ssh" }}' enabled: true when: ansible_distribution == 'openwrt'