--- - name: install build deps and dkms apt: name: - build-essential - libssl-dev - dkms state: present - name: install (sadly missing) script to fetch kernel sources copy: src: my_scw-fetch-kernel-sources dest: /usr/local/sbin/ mode: 0755 notify: fetch scaleway kernel sources - name: check if sources are already initialized stat: path: "/lib/modules/{{ ansible_kernel }}/build" follow: yes get_mime: no get_checksum: no get_md5: no register: build_directory changed_when: build_directory.stat.exists == False notify: fetch scaleway kernel sources - name: fetch kernel sources meta: flush_handlers