-
Notifications
You must be signed in to change notification settings - Fork 23.9k
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
Docker inventory service/stack groups for docker swarm #48021
Conversation
Hi @sosheskaz, thank you for submitting this pull-request! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks great, but you're missing a changelog fragment explaining the change in functionality. See https://docs.ansible.com/ansible/latest/reference_appendices/release_and_maintenance.html#creating-new-fragments. Once you get that added in (which should also trigger another CI run, clearing that label), I can come back and approve this.
The documentation linked does not mention a type for inventory scripts or a sample format; I made the assumption of |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Whoever ends up reviewing this for merge: I know we're done with inventory scripts, but I figure that this modification to an existing one is alright. Let me know if that assumption is incorrect.
Also, thank you @sosheskaz for the detailed test instructions. It made it much easier to verify this change! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The changes look good to me, though I cannot say anything specific about inventory scripts.
shipit
bot_status |
Componentschangelogs/fragments/inventory-docker-service-stack-groups.yaml contrib/inventory/docker.py Metadatawaiting_on: maintainer |
@sosheskaz Thank you, merged into |
@sosheskaz thanks for your PR! |
* Adding service and stack grouping to docker inventory * Updating documentation * Adding changelog fragment for docker.py inventory script
SUMMARY
This adds host grouping based on "service" and "stack" to the docker.py inventory script.
ISSUE TYPE
COMPONENT NAME
docker.py inventory
ANSIBLE VERSION
ADDITIONAL INFORMATION
This makes no change to existing functionality but extends the grouping of containers based on image to group on stack and service as well. This is done by conditionally keying the a host's groups off of the labels
com.docker.stack.namespace
andcom.docker.swarm.service.name
.The derived groups are in the format
service_<service_name>
andstack_<stack_name>
You can find the docker-compose file I used to create these groups here.
Excerpt from "pretty" docker.py output: