-
Notifications
You must be signed in to change notification settings - Fork 201
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Handle docker python packages to support Ansible2.3+ (#151)
* Add an editorconfig file * Revert "disable install of docker-py on 16.04+" The issue is related to docker-compose/docker-py/docker packages messup not to the Ubuntu version. See: ansible/ansible#20492 The #136 PR partially fixed it. * Revert "Change ansible version check" Ansible 2.3 will handle both docker and docker-py python packages. See: ansible/ansible@e2a1ce2 and ansible/ansible#20492 (comment) * Add a gitignore file * Handle Docker Python packages for Ansible 2.3+ * Clean Docker Python packages When updating to Ansible 2.3+ docker-py might no longer be needed. * Add container tasks into the Vagrant playbook To ensure docker modules actually work after the role installation.
- Loading branch information
Showing
7 changed files
with
86 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
root = true | ||
|
||
# default configuration | ||
[*] | ||
indent_style = space | ||
indent_size = 2 | ||
end_of_line = lf | ||
charset = utf-8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
.vagrant/ | ||
*.log | ||
env/ | ||
venv/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,33 @@ | ||
--- | ||
# Downgrade docker-compose version if ansible version < 2.3 and docker-compose > 1.9.0 | ||
# Because of docker-compose 1.10+ requires docker python package (instead of the docker-py one) | ||
# which is incompatible with the docker_container module in Ansible < 2.3 | ||
# To use Docker Ansible modules, managed nodes require some Docker Python packages : | ||
# * `docker-py` (renamed into `docker` since the 2.0.0 version); | ||
# * `docker-compose` which is required by the docker_service Ansible module. | ||
# | ||
# The `docker` python package introduces some backward incompatible changes is version 2.0.0. | ||
# Ansible 2.3+ is required to run this new version. Previous Ansible versions have to use docker-py<=1.10.6. | ||
# The `docker-compose` python package has a dependency over the docker/docker-py package. | ||
# The `docker-compose` 1.9.0 is the latest version to be compatible with the docker<2.0.0. | ||
# | ||
# To sum up: | ||
# * with Ansible < 2.3: | ||
# * you have to use docker-py<=1.10.6 due to backward incompatibilities of next versions | ||
# * you have to use docker-compose<=1.9.0 due to docker-compose>1.9.0 using newer versions of docker-py. | ||
|
||
# Compute the `docker` Python package's version to use. | ||
_pip_version_docker: >- | ||
{{ '1.10.6' if ansible_version.full | version_compare('2.3', '<') | ||
and (pip_version_docker=='latest' or pip_version_docker | version_compare('1.10.6', '>')) | ||
else pip_version_docker }} | ||
# Compute the `docker` Python package's name according to its version. | ||
_pip_docker_package_name: "{{ 'docker-py' if pip_version_docker | version_compare('1.10.6', '<=') else 'docker' }}" | ||
|
||
# Determine whether to install the `docker` package or not. The `docker-compose` Python package has a dependency over the `docker` Python package. | ||
# So when installing the `docker-compose` package we'd rather let it handle the `docker` package version to prevent version mismatches. | ||
_pip_install_docker: "{{ not pip_install_docker_compose and pip_install_docker }}" | ||
|
||
# Compute the `docker-compose` Python package's version to use. | ||
_pip_version_docker_compose: >- | ||
{{ '1.9.0' if ansible_version.full | version_compare('2.3', '<=') | ||
{{ '1.9.0' if ansible_version.full | version_compare('2.3', '<') | ||
and (pip_version_docker_compose=='latest' or pip_version_docker_compose | version_compare('1.9.0', '>')) | ||
else pip_version_docker_compose }} |