--- - name: Repository and packages, deb/ubuntu block: - name: Install the repository apt: deb={{ zabbix_agent_ubuntu_repo }} state=present register: update_apt_cache when: "'zabbix-release' not in ansible_facts.packages" - name: Update the apt cache if we just installed the repository apt: update_cache=yes when: update_apt_cache is defined and update_apt_cache is changed - name: Install the Zabbix agent package apt: pkg={{ zabbix_agent_packages }} state=latest cache_valid_time=1800 tags: [ 'zabbix', 'zabbix_agent' ]