community.docker/tests/integration/targets/setup_docker_compose_v1/tasks/setup.yml
Felix Fontein 1e286852b2
[stable-2] Integration tests: split up Docker setup, move docker_compose tests into own group (#719)
* Rename setup role.

* Create new CI group 6, and move docker_compose v1 tests into there.

* Split up Docker setup in integration tests.

* Change setup_docker_compose_v1 to install its own Docker SDK for Python.

* Restrict Docker SDK for Python to < 7.0.0 in EE.
2023-12-09 18:38:54 +01:00

76 lines
3.2 KiB
YAML

---
- name: Include distribution specific variables
include_vars: "{{ lookup('first_found', params) }}"
vars:
params:
files:
- "{{ ansible_facts.distribution }}-{{ ansible_facts.distribution_major_version }}-py{{ ansible_python.version.major }}.yml"
- "{{ ansible_facts.os_family }}-{{ ansible_facts.distribution_major_version }}-py{{ ansible_python.version.major }}.yml"
- "{{ ansible_facts.distribution }}-{{ ansible_facts.distribution_major_version }}.yml"
- "{{ ansible_facts.os_family }}-{{ ansible_facts.distribution_major_version }}.yml"
- "{{ ansible_facts.distribution }}-py{{ ansible_python.version.major }}.yml"
- "{{ ansible_facts.os_family }}-py{{ ansible_python.version.major }}.yml"
- "{{ ansible_facts.distribution }}.yml"
- "{{ ansible_facts.os_family }}.yml"
- default.yml
paths:
- "{{ role_path }}/vars"
- block:
- name: Include distribution specific tasks
include_tasks: "{{ lookup('first_found', params) }}"
vars:
params:
files:
- "{{ ansible_facts.distribution }}-{{ ansible_facts.distribution_major_version }}-py{{ ansible_python.version.major }}.yml"
- "{{ ansible_facts.os_family }}-{{ ansible_facts.distribution_major_version }}-py{{ ansible_python.version.major }}.yml"
- "{{ ansible_facts.distribution }}-{{ ansible_facts.distribution_major_version }}.yml"
- "{{ ansible_facts.os_family }}-{{ ansible_facts.distribution_major_version }}.yml"
- "{{ ansible_facts.distribution }}-py{{ ansible_python.version.major }}.yml"
- "{{ ansible_facts.os_family }}-py{{ ansible_python.version.major }}.yml"
- "{{ ansible_facts.distribution }}.yml"
- "{{ ansible_facts.os_family }}.yml"
paths:
- "{{ role_path }}/tasks"
- name: Limit docker pypi package version to < 4.3.0
set_fact:
docker_pip_package_limit: '<4.3.0'
when: docker_api_version is version('1.39', '<')
- name: Install/upgrade Docker SDK for Python
pip:
name: "{{ [docker_pip_package ~ docker_pip_package_limit] + docker_pip_extra_packages }}"
extra_args: "-c {{ remote_constraints }}"
state: present
- name: Install docker-compose
pip:
state: present
name: "{{ docker_compose_pip_packages }}"
extra_args: "-c {{ remote_constraints }}"
- name: Check docker-py version
command: "{{ ansible_python.executable }} -c 'import docker; print(docker.__version__)'"
register: docker_py_version_stdout
ignore_errors: true
- name: Register docker-compose version
command: "{{ ansible_python.executable }} -c 'import compose; print(compose.__version__)'"
register: docker_compose_version
ignore_errors: true
- name: Declare docker-py and docker-compose version
set_fact:
docker_py_version: "{{ docker_py_version_stdout.stdout | default('0.0') }}"
docker_compose_version: "{{ docker_compose_version.stdout | default('0.0.0') }}"
- debug:
msg: "Docker SDK for Python version: {{ docker_py_version }}; Docker Compose version: {{ docker_compose_version }}"
- name: Declare docker-compose as existing
set_fact:
has_docker_compose: true
when: not skip_docker_compose