{"id":6542,"date":"2014-07-31T23:54:32","date_gmt":"2014-07-31T15:54:32","guid":{"rendered":"http:\/\/jpuyy.com\/?p=6542"},"modified":"2014-07-31T23:55:24","modified_gmt":"2014-07-31T15:55:24","slug":"ansible-fetch-files","status":"publish","type":"post","link":"https:\/\/jpuyy.com\/?p=6542","title":{"rendered":"ansible-fetch\u83b7\u53d6\u670d\u52a1\u5668\u4e0a\u7684\u6587\u4ef6"},"content":{"rendered":"<p>\u76ee\u6807\u662f\u83b7\u53d6\u4e24\u53f0\u670d\u52a1\u5668\u4e0broot,www\u7528\u6237\u7684crontab\u6587\u4ef6\uff0c\u5e76\u4fdd\u5b58\u5728\u672c\u5730\u7684fetched\u76ee\u5f55\u3002<\/p>\n<p>main.yml\u6587\u4ef6\u5982\u4e0b<\/p>\n<p>&#8211; hosts: all<br \/>\n  tasks:<br \/>\n    &#8211; fetch: src=\/var\/spool\/cron\/www dest=fetched\/cron-www-{{ ansible_hostname }} flat=yes<\/p>\n<p>    &#8211; fetch: src=\/var\/spool\/cron\/root dest=fetched\/cron-root-{{ ansible_hostname }} flat=yes<\/p>\n<p>\u6267\u884c\u5b8c\u4e4b\u540e\u7684\u76ee\u5f55\u7ed3\u6784\u5982\u4e0b<\/p>\n<p>[root@jpuyy.com fetch-crontab]# tree<br \/>\n.<br \/>\n\u251c\u2500\u2500 fetched<br \/>\n\u2502\u00a0\u00a0 \u251c\u2500\u2500 cron-root-2.jpuyy.com<br \/>\n\u2502\u00a0\u00a0 \u2514\u2500\u2500 cron-www-1.jpuyy.com<br \/>\n\u251c\u2500\u2500 hosts<br \/>\n\u2514\u2500\u2500 main.yml<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u76ee\u6807\u662f\u83b7\u53d6\u4e24\u53f0\u670d\u52a1\u5668\u4e0broot,www\u7528\u6237\u7684crontab\u6587\u4ef6\uff0c\u5e76\u4fdd\u5b58\u5728\u672c\u5730\u7684fetched\u76ee\u5f55\u3002 main.yml\u6587\u4ef6\u5982\u4e0b &#8211; hosts: all tasks: &#8211; fetch: src=\/var\/spool\/cron\/www dest=fetched\/cron-www-{{ ansible_hostname }} flat=yes &#8211; fetch: src=\/var\/spool\/cron\/root dest=fetched\/cron-root-{{ ansible_hostname }} flat=yes \u6267\u884c\u5b8c\u4e4b\u540e\u7684\u76ee\u5f55\u7ed3\u6784\u5982\u4e0b [root@jpuyy.com fetch-crontab]# tree . \u251c\u2500\u2500 fetched \u2502\u00a0\u00a0 \u251c\u2500\u2500 cron-root-2.jpuyy.com \u2502\u00a0\u00a0 \u2514\u2500\u2500 cron-www-1.jpuyy.com \u251c\u2500\u2500 hosts \u2514\u2500\u2500 main.yml<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[165],"tags":[175],"class_list":["post-6542","post","type-post","status-publish","format-standard","hentry","category-ops","tag-ansible"],"_links":{"self":[{"href":"https:\/\/jpuyy.com\/index.php?rest_route=\/wp\/v2\/posts\/6542","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=6542"}],"version-history":[{"count":2,"href":"https:\/\/jpuyy.com\/index.php?rest_route=\/wp\/v2\/posts\/6542\/revisions"}],"predecessor-version":[{"id":6551,"href":"https:\/\/jpuyy.com\/index.php?rest_route=\/wp\/v2\/posts\/6542\/revisions\/6551"}],"wp:attachment":[{"href":"https:\/\/jpuyy.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=6542"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jpuyy.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=6542"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jpuyy.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=6542"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}