Execute task on the same host >1 time #633

Closed
bitprophet opened this Issue May 8, 2012 · 1 comment

Projects

None yet

1 participant

@bitprophet
Member

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.

@bitprophet
Member

Implemented in 9ca78a7.

@bitprophet bitprophet added a commit that referenced this issue May 9, 2012
@bitprophet bitprophet Changelog re #633 820a737
@bitprophet bitprophet closed this May 9, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment