{"id":7244,"date":"2015-03-25T17:42:53","date_gmt":"2015-03-25T09:42:53","guid":{"rendered":"http:\/\/jpuyy.com\/?p=7244"},"modified":"2015-03-25T17:43:33","modified_gmt":"2015-03-25T09:43:33","slug":"ansible-tasks-one-host-in-group","status":"publish","type":"post","link":"https:\/\/jpuyy.com\/?p=7244","title":{"rendered":"ansible tasks\u5224\u65ad\u4e00\u4e2a\u4e3b\u673a\u662f\u4e0d\u662f\u5728\u67d0group"},"content":{"rendered":"<p>hosts\u6587\u4ef6\u91cc\u662f\u8fd9\u6837\u5199\u7684<\/p>\n<p>[backup_tar]<br \/>\nhost1<br \/>\nhost2<\/p>\n<p>[backup_notar]<br \/>\nhost3<br \/>\nhost4<\/p>\n<p>\u9488\u5bf9 backup_tar \u4e2d\u7684 hosts \u53ea\u6267\u884c\u67d0\u6761 task<\/p>\n<pre>\r\n- cron: name=\"backup\" minute=0 hour=4\r\n        user=\"root\" job=\"\/bin\/sh \/root\/mysql_backup.sh full >> \/dev\/null 2>&1\" backup=yes\r\n  when: inventory_hostname in groups['backup_tar']\r\n<\/pre>\n<p>\u53c2\u8003\uff1ahttps:\/\/groups.google.com\/forum\/#!topic\/ansible-project\/lr7nXyGw0UY<\/p>\n","protected":false},"excerpt":{"rendered":"<p>hosts\u6587\u4ef6\u91cc\u662f\u8fd9\u6837\u5199\u7684 [backup_tar] host1 host2 [backup_notar] host3 host4 \u9488\u5bf9 backup_tar \u4e2d\u7684 hosts \u53ea\u6267\u884c\u67d0\u6761 task &#8211; cron: name=&#8221;backup&#8221; minute=0 hour=4 user=&#8221;root&#8221; job=&#8221;\/bin\/sh \/root\/mysql_backup.sh full >> \/dev\/null 2>&#038;1&#8243; backup=yes when: inventory_hostname in groups[&#8216;backup_tar&#8217;] \u53c2\u8003\uff1ahttps:\/\/groups.google.com\/forum\/#!topic\/ansible-project\/lr7nXyGw0UY<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[166],"tags":[],"class_list":["post-7244","post","type-post","status-publish","format-standard","hentry","category-ansible"],"_links":{"self":[{"href":"https:\/\/jpuyy.com\/index.php?rest_route=\/wp\/v2\/posts\/7244","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/jpuyy.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/jpuyy.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/jpuyy.com\/index.php?rest_route=\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/jpuyy.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=7244"}],"version-history":[{"count":2,"href":"https:\/\/jpuyy.com\/index.php?rest_route=\/wp\/v2\/posts\/7244\/revisions"}],"predecessor-version":[{"id":7246,"href":"https:\/\/jpuyy.com\/index.php?rest_route=\/wp\/v2\/posts\/7244\/revisions\/7246"}],"wp:attachment":[{"href":"https:\/\/jpuyy.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=7244"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jpuyy.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=7244"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jpuyy.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=7244"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}