colmena
colmena copied to clipboard
Tag selector improvements
Hi,
are you open to a pull request that implements more advanced tag handling for use with the --on
option? This is relevant to #67.
I am thinking about something like:
-
@foo | @bar
to select hosts matching eitherfoo
orbar
- keeping
@foo,@bar
which is identical to@foo | @bar
for backwards compatibility, so basically aliasing,
and|
-
@foo & @bar
to select hosts matching both -
@foo & !@bar
to select hosts matchingfoo
but notbar
A more sophisticated example might be @env:prod & @role:webserver & !@ha-group:a
which selects host matching @env:prod
and @role:webserver
but not @ha-group:a
.
Globbing should be allowed just as before. I would evaluate these statements in order, no special precedence. While nesting such statements using braces could be implemented I am not seeing enough benefit, so I would skip that.
Please let me know what you think. Any input is appreciated!
It would be great to implement this idea, but it's important to keep in mind that in the Linux shell, the characters |
and &
have specific meanings. So, to avoid any confusion, it might be better to use and
, or
, and not
instead.
I thought about that but did not like the verbosity. Also I assumed the input string would be quoted anyways, so it gets passed as a single argument.