-
Notifications
You must be signed in to change notification settings - Fork 19
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
remove_host module #174
Comments
Hi @cornim , I am interested in this proposal but having a hard time understanding a high level business use case for developing a module to remove hosts. The When it comes to removing hosts, typically I find that in most use cases that I have dealt with or seen we simply start a new Play targeting a limitation of hosts using patterns. Can you provide a good business or technical use case? In a simple sense, when would a set of Ansible tasks want to |
Hi @ansiblejunky, |
Why do you need to generate inventory files? Why not simply use dynamic inventory plugin to get the data from AWS to use as the target nodes. Then perform the actions and finish the playbook. For example: |
If my memory serves, the dynamic inventory does not show hosts when they are stopped and is therefore not usable to stop and at a later point start instances. For this you I created "offline" inventory files. |
@cornim that is probably due to the specific inventory source you are using, there are many plugins and scripts and they all have different behaviour. |
Because of ansible/ansible#77944, the Here's another use case: the process of creating a new OpenShift cluster involves a temporary bootstrap node. Since it's temporary, I don't want it in my inventory; instead I'm using add_host, then delete the temporary VM when it's not needed any more. But there are still operations to be performed which expect that all the known hosts be up and running. |
2.18 will introduce a good way to have a 'transactional update' to inventory. After that hits I'll be revamping how refresh_inventory works. Specifically to apply only to 'next play' .. right now it does a mix of adding data to current but not really altering current. That will also allow for 'remove_host' to be implemented in a sane manner (also to apply to 'next play' only). |
@bcoca I'm also in much need for removing hosts from a group. Or removing groups altogether. My scenario is that I want to run a play several times against a variable group of hosts. However, I can't use So I And defining
|
Same problem here |
Proposal: remove_host module
Author: Cornelius Mund <@cornim>
Date: 2019-20-22
Motivation
Allows to dynamically remove hosts from inventory and therefore also from all groups. This would all to better manage dynamically manage the hosts in a playbook. Basically this is the reverse functionality to the add_host module
Problems
What problems exist that this proposal will solve?
Currently the only way to dynamically remove a host is to edit the inventory file and run
meta: refresh_inventory
but complicated file modifications often times require os depended tools and make the ansible scripts less portable.Solution proposal
This removes the hosts dynamically while running the playbook.
Documentation (optional)
A module documentation would make sense
The text was updated successfully, but these errors were encountered: