docker_container: simplify minimal required version per option handling (#47711)

* Store parsed docker-py / docker API versions in client.

* Began refactoring 'minimal required version' for docker_container options.

* Removing some fake defaults.

* Added changelog.

* Improve tests (check older docker versions).

* Fix comparison. The breaking point is not docker-py 2.0.0, but 1.10.0.

(Verified by testing with these versions.)

* Move docker-py/API version detection to setup_docker.

* Add YAML document starter.

* docker_network requirement for docker-py was bumped to 1.10.0 in #47492.
This commit is contained in:
Felix Fontein
2018-11-05 01:25:11 +01:00
committed by Will Thames
parent 788247583b
commit 3cca4185be
8 changed files with 410 additions and 230 deletions

View File

@@ -1,7 +1,3 @@
- name: Check Docker API version
command: "{{ ansible_python.executable }} -c 'import docker; print(docker.from_env().version()[\"ApiVersion\"])'"
register: docker_api_version
ignore_errors: yes
---
- include_tasks: test_docker_config.yml
when: docker_api_version.rc == 0 and docker_api_version.stdout is version('1.30', '>=')
when: docker_api_version is version('1.30', '>=')

View File

@@ -1,3 +1,4 @@
---
- name: Make sure we're not already using Docker swarm
docker_swarm:
state: absent