-
Notifications
You must be signed in to change notification settings - Fork 40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support to install Docker Ansible module dependencies #48
Comments
Thanks for the suggestion @ndusart. I have actually been thinking about this from time to time but has hesitated a bit because of incompatibilities in docker-py etc and what to use to install it: pip or OS package manager. Want to have an easy config so users does not need to think too much. 😄 Question: when you install Ansible do you use pip or OS pkg mgr? If you use pip, do you use virtualenv? Cheers! |
I totally understand your concern. I am not quite into python development and not very used with the pip package manager and all that stuff so I maybe overlooked the complexity of it for a broad compatibility. I simply do this on my playbooks: - name: Ensure pip is installed
package:
name: python-pip
state: present
- name: Ensure docker library for python is installed
pip:
name: docker
state: present For your question about the installation of Ansible, I'm using a local clone of their git repository and use the Maybe a boolean role variable to opt-in on this feature with other variables letting the user define which docker python sdk to install and how, with default values that are likely to fit most of the people ? |
As you say I see this as an opt-in feature to ease use of docker module in Ansible. Hopefully the packages are called the same in the different distributions this role supports and might be a good also to have a variable to say if pip shall be used or not because mixing pip and stuff from the apt/yum/dnf then you can get into trouble with dependency problems. Hopefully I will take a deeper look into it later this week. |
@ndusart I have now implemented that I hope is what you are looking for. If you can please try it out on the master before I do a release if you can and if you got some feedback please let me know. 😄 These are the variables you can use to get dependencies: # Ensures 'docker_container' Ansible module dependencies are installed
docker_container_deps: false
# Ensures 'docker_service' Ansible module dependencies are installed
docker_service_deps: false
# Ensures 'docker_stack' Ansible module dependencies are installed
docker_stack_deps: false Cheers! |
Example to use it can be found here: https://github.com/haxorof/ansible-role-docker-ce/blob/master/tests/test_postinstall.yml |
@haxorof sorry about the delay, I was quite busy these days. I just tested it with success in my playbooks ! 😃 Maybe there should be a comment that Thanks for the good work ! 👍 |
Thanks @ndusart! Will do a release today if I got time to update the documentation. Cheers! |
btw, would you @ndusart have some suggestion for better variable names for this? Was looking through the Ansible docs and maybe change to something like docker_core_deps and then document what modules it will cover. Cheers! |
# Ensures dependencies are installed so that most of the 'docker' Ansible modules will work
docker_sdk: false
# Ensures dependencies are installed so that 'docker_service' Ansible module will work
docker_compose: false
# Ensures dependencies are installed so that 'docker_stack' Ansible module will work
docker_stack: false |
The new terms are good to me ! |
Ansible
docker_container
module requires that eitherdocker
ordocker-py
python library is installed in order to work.I think this would be a good thing to install these from this role as this is always required for use in dependent roles. Maybe through a variable to enable that ?
The text was updated successfully, but these errors were encountered: