---
- name: Update apt cache
  apt: update_cache=yes

- name: Install initrd kernel dependencies
  apt: name=linux-image-{{ initrd_kernel_version }}

- name: Install required packages
  apt: name="{{ item.package }}={{ item.version }}"
  with_items: initrd_package_manifest

- name: Add hook scripts to copy package binaries into the initramfs
  template: src="{{ playbook_dir }}/templates/initramfs_hook.j2"
            dest=/etc/initramfs-tools/hooks/{{ item }} mode=0755
  with_items: initrd_include_binaries

- name: Add 1_network script to local-top
  copy: src=1_network dest=/etc/initramfs-tools/scripts/local-top/ mode=0755

- name: Replace local script
  copy: src=local dest=/etc/initramfs-tools/scripts/local mode=0755

- name: Enable extra modules
  shell: "echo {{ item }} >> /etc/initramfs-tools/modules"
  with_items: 
    - squashfs
    - overlayfs

---
- name: Update apt cache
  apt: update_cache=yes

- name: Install initrd kernel dependencies
  apt: name=linux-image-{{ initrd_kernel_version }}

- name: Install linux image extras for physical machine support
  apt: name=linux-image-extra-{{ initrd_kernel_version }}

- name: Install required packages
  apt: name="{{ item.package }}={{ item.version }}"
  with_items: initrd_package_manifest

- name: Add hook scripts to copy package binaries into the initramfs
  template: src="{{ playbook_dir }}/templates/initramfs_hook.j2"
            dest=/etc/initramfs-tools/hooks/{{ item }} mode=0755
  with_items: initrd_include_binaries

- name: Add 1_network script to local-top
  copy: src=1_network dest=/etc/initramfs-tools/scripts/local-top/ mode=0755

- name: Replace local script
  copy: src=local dest=/etc/initramfs-tools/scripts/local mode=0755

- name: Enable extra modules
  shell: "echo {{ item }} >> /etc/initramfs-tools/modules"
  with_items: 
    - squashfs
    - overlayfs

Add linux-image-extras package to initrd build environment
Add linux-image-extras package to initrd build environment
