Skip to content

Commit

Permalink
Retry linux-image-extra if first install fails due to a non-standard …
Browse files Browse the repository at this point in the history
…kernel version name, fixes #161, addresses #148, #138
  • Loading branch information
Paul Durivage committed Apr 27, 2017
1 parent 735d484 commit 238e338
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,22 +32,26 @@
register: dmsetup_result
when: ansible_distribution_version|version_compare('16.04', '=')

- name: Read uname
shell: uname -r
register: uname_output
changed_when: false
always_run: yes

- name: Install linux-image-extra-* packages to enable AuFS driver
apt:
pkg: "{{ item }}"
state: present
update_cache: yes
cache_valid_time: "{{ docker_apt_cache_valid_time }}"
with_items:
- linux-image-extra-{{ uname_output.stdout }}
- linux-image-extra-{{ ansible_kernel }}
- linux-image-extra-virtual
when: docker_aufs_enabled and ansible_distribution_version|version_compare('14.04', '>=')
register: linux_image_extra_install
ignore_errors: yes

- name: Try again to install linux-image-extra if previous attempt failed
apt:
pkg: "linux-image-extra-{{ ansible_kernel.split('-')[:-1]|join('-') }}*"
state: present
update_cache: yes
cache_valid_time: "{{ docker_apt_cache_valid_time }}"
when: linux_image_extra_install|failed

- name: Run dmsetup for Ubuntu 16.04
command: dmsetup mknodes
Expand Down

0 comments on commit 238e338

Please sign in to comment.