Skip to content

Commit

Permalink
Pass lists to package modules instead of with_items
Browse files Browse the repository at this point in the history
* Do not use loop on package module with squash_actions

* Replace with_items with loop

* Revert "Replace with_items with loop"

This reverts commit e30627f.

* Bump Ansible version to 2.3
  • Loading branch information
Varun Priolkar authored and angstwad committed Oct 24, 2018
1 parent cfd6a3d commit 55f7dca
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 24 deletions.
2 changes: 1 addition & 1 deletion meta/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ galaxy_info:
author: Paul Durivage
description: A comprehensive and (ideally) sane way to install Docker on Ubuntu 14.04+
license: Apache v2.0
min_ansible_version: 2.2
min_ansible_version: 2.3
platforms:
- name: Debian
versions:
Expand Down
21 changes: 9 additions & 12 deletions tasks/kernel_check_and_update.yml
Original file line number Diff line number Diff line change
@@ -1,36 +1,33 @@
- name: Install backported trusty kernel onto 12.04
apt:
pkg: "{{ item }}"
pkg:
- linux-image-generic-lts-trusty
- linux-headers-generic-lts-trusty
state: "{{ kernel_pkg_state }}"
update_cache: yes
cache_valid_time: 600
with_items:
- linux-image-generic-lts-trusty
- linux-headers-generic-lts-trusty
register: kernel_result
when: "ansible_distribution_version is version_compare('12.04', '=')"

- name: Install Xorg packages for backported kernels (very optional)
apt:
pkg: "{{ item }}"
pkg:
- xserver-xorg-lts-trusty
- libgl1-mesa-glx-lts-trusty
state: installed
update_cache: yes
cache_valid_time: 600
with_items:
- xserver-xorg-lts-trusty
- libgl1-mesa-glx-lts-trusty
register: xorg_pkg_result
when: "install_xorg_pkgs and (kernel_result is changed or kernel_result is succeeded)"

- name: Install latest kernel for Ubuntu 13.04+
apt:
pkg: "{{ item }}"
pkg:
- "linux-image-extra-{{ ansible_kernel }}"
- linux-image-extra-virtual
state: "{{ kernel_pkg_state }}"
update_cache: yes
cache_valid_time: 600
with_items:
- "linux-image-extra-{{ ansible_kernel }}"
- linux-image-extra-virtual
when: "ansible_distribution_version is version_compare('13.04', '=')
or ansible_distribution_version is version_compare('13.10', '=')
or install_kernel_extras"
Expand Down
19 changes: 8 additions & 11 deletions tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,23 +24,21 @@

- name: Uninstall old versions of Docker
apt:
name: "{{ item }}"
name:
- docker
- docker-engine
- docker.io
state: absent
with_items:
- docker
- docker-engine
- docker.io
when: uninstall_previous_docker_versions

- name: Install linux-image-extra-* packages to enable AuFS driver
apt:
pkg: "{{ item }}"
pkg:
- linux-image-extra-{{ ansible_kernel }}
- linux-image-extra-virtual
state: present
update_cache: yes
cache_valid_time: "{{ docker_apt_cache_valid_time }}"
with_items:
- linux-image-extra-{{ ansible_kernel }}
- linux-image-extra-virtual
when: docker_aufs_enabled and ansible_distribution_version is version_compare('14.04', '==') and ansible_kernel is version_compare('4.4', '<')

register: linux_image_extra_install
Expand Down Expand Up @@ -184,11 +182,10 @@
# We must install pip via apt before we can use the pip module below
- name: "Install {{ _python_packages | join(', ') }} packages with apt"
apt:
pkg: "{{ item }}"
pkg: "{{ _python_packages }}"
state: latest
update_cache: yes
cache_valid_time: "{{ docker_apt_cache_valid_time }}"
with_items: "{{ _python_packages }}"

# Display an informative message if the docker-compose version needs to be downgraded
- name: Docker-compose version downgrade
Expand Down

0 comments on commit 55f7dca

Please sign in to comment.