<\/p>\n\r\ncompound = [\"(\"] expression [\")\"] {[\"(\"] expression [\")\"]}\r\nexpression = [!|not]statement [\"and\"|\"or\"] [!|not] statement\r\nchar = A-Z | a-z | < | > | => | =< | _ | - |* | \/ { A-Z | a-z | < | > | => | =< | _ | - | * | \/ | }\r\nint = 0|1|2|3|4|5|6|7|8|9{|0|1|2|3|4|5|6|7|8|9|0}\r\n<\/pre>\n<\/code><\/p>\n
It's been extended since but more on that below and in a future post.<\/p>\n
It's very easy to use this filter in your code, here's a Ruby script that sets the same compound filter and restarts apache:<\/p>\n
<\/p>\n\r\n#!\/usr\/bin\/ruby\r\n\r\nrequire \"mcollective\"\r\n\r\ninclude MCollective::RPC\r\n\r\nc = rpcclient(\"service\")\r\nc.compound_filter '((customer=acme and environment=staging) or environment=development) and \/apache\/'\r\n\r\nprintrpc c.restart(:service => \"httpd\")\r\n<\/pre>\n<\/code><\/p>\n
These filters are combined with other filters so you're welcome to mix in Identity filters etc using the other filter types and they will be evaluated additively.<\/p>\n
These filters also supports querying node data, a simple example of such a query can be seen here:<\/p>\n
<\/p>\n\r\n$ mco service restart httpd -S \"fstat('\/etc\/httpd\/conf\/httpd.conf').md5 = \/51b08b8\/\"\r\n<\/pre>\n<\/code><\/p>\n
This will match all machines with a certain MD5 hash for the apache config file and restart them. More on these plugins the next post where I'll show you how to write your own and use them.<\/p>\n","protected":false},"excerpt":{"rendered":"
This ia a post in a series of posts I am doing about MCollective 2.0 and later. In the past discovery was reasonably functional, certainly at the time I first demoed it around 2009 it was very unique. Now other discovery frameworks exist that does all sorts of interesting things and so we did 3 […]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_et_pb_use_builder":"","_et_pb_old_content":"","footnotes":""},"categories":[7],"tags":[121,85,78,106,13],"_links":{"self":[{"href":"https:\/\/www.devco.net\/wp-json\/wp\/v2\/posts\/2683"}],"collection":[{"href":"https:\/\/www.devco.net\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.devco.net\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.devco.net\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.devco.net\/wp-json\/wp\/v2\/comments?post=2683"}],"version-history":[{"count":13,"href":"https:\/\/www.devco.net\/wp-json\/wp\/v2\/posts\/2683\/revisions"}],"predecessor-version":[{"id":2882,"href":"https:\/\/www.devco.net\/wp-json\/wp\/v2\/posts\/2683\/revisions\/2882"}],"wp:attachment":[{"href":"https:\/\/www.devco.net\/wp-json\/wp\/v2\/media?parent=2683"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.devco.net\/wp-json\/wp\/v2\/categories?post=2683"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.devco.net\/wp-json\/wp\/v2\/tags?post=2683"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}