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

Execute task on the same host >1 time #633

bitprophet opened this Issue May 8, 2012 · 1 comment


None yet
1 participant

bitprophet commented May 8, 2012

Currently host lists are fully deduped in order to prevent unwanted duplicity when merging different host list sources. E.g. specifying a role containing host1 and at the same time also using a @hosts('host1') decorator would, without deduping, run twice on host1, which is not usually the desired effect.

However, this protective feature disables any wanted duplicity, i.e. running a task multiple times on the same server on purpose. (This has become especially important for some folks with the advent of parallelism.)

I see two solutions:

  • Simply add another global option that is tested in the host merging method (currently Task.get_hosts IIRC) and if set, does not do any deduping, but simply adds all sources together.
    • Simplest/easiest, fills the need, while staying off by default to protect newbies from unexpected/odd behavior.
  • Try to be "smart" and dedupe inter-source but not intra-source, i.e. two examples of the same host string from two different sources (say, -H and @hosts) would get deduped, but identical host strings in the same source (e.g. env.hosts = ['host1', 'host1', 'host1']) would not get deduped.
    • Harder to implement, but "cleaner", in that it would not require an option to be activated, and instead would try to determine what the user's actual intent was.

I don't see any serious downsides to going with the simpler approach. Users wanting this feature are more likely to be advanced enough that they know to search for and activate nondefault options; and they're also more likely to understand the tradeoff and/or not specify multiple sources simultaneously.


This comment has been minimized.


bitprophet commented May 9, 2012

Implemented in 9ca78a7.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment