--- - name: Update apt cache. apt: update_cache=yes cache_valid_time=86400 - name: Ensure common_node packages are installed. apt: "name={{ common_node_packages }} state=present" - name: Install linux headers when: ansible_virtualization_role == "host" or (ansible_virtualization_role == "guest" and ansible_virtualization_type == "kvm") block: - name: Install i386 linux headers Debian when: ansible_architecture == 'i386' and ansible_distribution == 'Debian' apt: name: ['linux-headers-686', 'linux-headers-686-pae'] - name: Install amd64 linux headers Debian when: ansible_architecture == 'x86_64' and ansible_distribution == 'Debian' apt: name: ['linux-headers-amd64'] - name: Install linux headers Ubuntu when: ansible_distribution == 'Ubuntu' apt: name: linux-headers-generic