2018-08-09 17:37:03 +00:00
|
|
|
- vars:
|
|
|
|
is_rhel: "{{ ansible_os_family == 'RedHat' and ansible_distribution != 'Fedora' }}"
|
|
|
|
is_rhel6: "{{ is_rhel and ansible_distribution_major_version == '6' }}"
|
|
|
|
is_rhel7: "{{ is_rhel and ansible_distribution_major_version == '7' }}"
|
|
|
|
block:
|
|
|
|
- include_tasks: "{{ lookup('first_found', params) }}"
|
|
|
|
vars:
|
|
|
|
params:
|
|
|
|
- '{{ ansible_distribution }}.yml'
|
|
|
|
- '{{ ansible_os_family }}.yml'
|
|
|
|
when: not is_rhel6
|
|
|
|
|
|
|
|
- name: Install Python requirements
|
|
|
|
vars:
|
|
|
|
extra_packages: "{{ '' if not is_rhel7 else ',requests==2.6.0' }}"
|
|
|
|
pip:
|
|
|
|
state: present
|
|
|
|
name: 'docker{{ extra_packages }}'
|
2018-10-18 17:04:39 +00:00
|
|
|
extra_args: "-c {{ role_path }}/../../../runner/requirements/constraints.txt"
|
2018-11-05 00:25:11 +00:00
|
|
|
|
|
|
|
# Detect docker API and docker-py versions
|
|
|
|
- name: Check Docker API version
|
|
|
|
command: "{{ ansible_python.executable }} -c 'import docker; print(docker.from_env().version()[\"ApiVersion\"])'"
|
|
|
|
register: docker_api_version_stdout
|
|
|
|
ignore_errors: yes
|
|
|
|
|
|
|
|
- name: Check docker-py API version
|
|
|
|
command: "{{ ansible_python.executable }} -c 'import docker; print(docker.__version__)'"
|
|
|
|
register: docker_py_version_stdout
|
|
|
|
ignore_errors: yes
|
|
|
|
|
|
|
|
- set_fact:
|
|
|
|
docker_api_version: "{{ docker_api_version_stdout.stdout or '0.0' }}"
|
|
|
|
docker_py_version: "{{ docker_py_version_stdout.stdout or '0.0' }}"
|
|
|
|
|
|
|
|
- debug:
|
|
|
|
msg: "Docker API version: {{ docker_api_version }}; docker-py library version: {{ docker_py_version }}"
|