{"id":10136,"date":"2017-01-25T12:08:13","date_gmt":"2017-01-25T03:08:13","guid":{"rendered":"http:\/\/www.skyarch.net\/blog\/?p=10136"},"modified":"2017-01-25T12:08:13","modified_gmt":"2017-01-25T03:08:13","slug":"packer%e3%81%aeansible-local-provisioner%e3%81%ae%e4%bb%95%e6%a7%98%e3%81%a8ansible%e3%81%aebest-practice%e3%81%ae%e8%a8%ad%e8%a8%88%e3%81%ae%e7%ab%b6%e5%90%88%e3%82%92%e5%9b%9e%e9%81%bf%e3%81%99","status":"publish","type":"post","link":"https:\/\/www.skyarch.net\/blog\/packer%e3%81%aeansible-local-provisioner%e3%81%ae%e4%bb%95%e6%a7%98%e3%81%a8ansible%e3%81%aebest-practice%e3%81%ae%e8%a8%ad%e8%a8%88%e3%81%ae%e7%ab%b6%e5%90%88%e3%82%92%e5%9b%9e%e9%81%bf%e3%81%99\/","title":{"rendered":"Packer\u306eAnsible Local provisioner\u306e\u4ed5\u69d8\u3068Ansible\u306eBest Practice\u306e\u8a2d\u8a08\u306e\u7af6\u5408\u3092\u56de\u907f\u3059\u308b\u65b9\u6cd5"},"content":{"rendered":"<p>Ansible\u516c\u5f0fDoc\u3067\u306f\u3001\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u30fc\u30ec\u30a4\u30a2\u30a6\u30c8\u306eBest practice\u306f\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u5b9a\u7fa9\u3055\u308c\u3066\u3044\u308b\u3002<\/p>\n<p><a href=\"http:\/\/docs.ansible.com\/ansible\/playbooks_best_practices.html#alternative-directory-layout\">Best Practices \u2014 Ansible Documentation<\/a><\/p>\n<p>\u307e\u305f\u3001\u516c\u5f0fDoc\u306b\u306f\u660e\u78ba\u306a\u8a18\u8ff0\u304c\u306a\u3044\u304c\u3001\u4ee5\u4e0b\u306e\u8a18\u4e8b\u3067\u306fAnsible\u306e\u958b\u767a\u8005\u304c\u3001<br \/>\nansible-playbook\u30b3\u30de\u30f3\u30c9\u306e-i\u30aa\u30d7\u30b7\u30e7\u30f3\u3067\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u30fc\u3092\u6307\u5b9a\u3067\u304d\u308b\u3053\u3068\u3092\u8a8d\u3081\u3066\u3044\u308b\u3002<\/p>\n<p><a href=\"https:\/\/github.com\/ansible\/ansible\/issues\/18686\">Alternative Directory Structure requires complete file path with -i \u00b7 Issue #18686 \u00b7 ansible\/ansible \u00b7 GitHub<\/a><\/p>\n<p>\u3068\u3053\u308d\u304c\u3001Packer(\u78ba\u8a8d\u30d0\u30fc\u30b8\u30e7\u30f3: 0.12.2)\u306eAnsible Local provisioner\u3067\u306f<br \/>\n\u30b3\u30f3\u30d5\u30a3\u30ae\u30e5\u30ec\u30fc\u30b7\u30e7\u30f3\u306e\"inventory_file\"\u3067\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u30fc\u3092\u6307\u5b9a\u3059\u308b\u3068\u30a8\u30e9\u30fc\u3068\u306a\u308b\u3002<\/p>\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\r\n{\r\n&quot;type&quot;: &quot;ansible-local&quot;,\r\n&quot;playbook_file&quot;: &quot;playbook.yml&quot;,\r\n&quot;inventory_file&quot;: &quot;inventories\/test&quot;\r\n}\r\n<\/pre>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n1 error(s) occurred:\r\n\r\n* inventory_file: inventories\/test must point to a file\r\n<\/pre>\n<p>\u307e\u305f\u3001\"inventory_file\"\u306e\u6307\u5b9a\u3092\u3084\u3081\u3001<br \/>\n\"extra_arguments\"\u3067-i\u30aa\u30d7\u30b7\u30e7\u30f3\u3067\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u30fc\u3092\u6307\u5b9a\u3057\u3066\u3082\u3001<br \/>\nPacker\u304c\u81ea\u52d5\u7684\u306binventory\u30d5\u30a1\u30a4\u30eb\u3092\u751f\u6210\u3057\u3066-i\u30aa\u30d7\u30b7\u30e7\u30f3\u3092\u91cd\u8907\u6307\u5b9a\u3057\u3066\u3057\u307e\u3044\u3001<br \/>\ninventory\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u30fc\u5185\u306ehost_vars, group_vars\u306a\u3069\u304c\u6b63\u3057\u304f\u8aad\u307f\u8fbc\u307e\u308c\u306a\u3044\u3002<\/p>\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\r\n{\r\n&quot;type&quot;: &quot;ansible-local&quot;,\r\n&quot;playbook_file&quot;: &quot;playbook_dummy.yml&quot;,\r\n&quot;extra_arguments&quot;: &#x5B;\r\n&quot;-i&quot;,\r\n&quot;inventories\/test&quot;\r\n]\r\n}\r\n<\/pre>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\ncd \/tmp\/packer-provisioner-ansible-local &amp;amp;&amp;amp; ANSIBLE_FORCE_COLOR=1 PYTHONUNBUFFERED=1 ansible-playbook \/tmp\/packer-provisioner-ansible-local\/playbook.yml -i inventories\/test -c local -i \/tmp\/packer-provisioner-ansible-local\/packer-provisioner-ansible-local138537763\r\n<\/pre>\n<p>\u3053\u3053\u3067Ansible Local provisioner\u306e\u30b3\u30f3\u30d5\u30a3\u30ae\u30e5\u30ec\u30fc\u30b7\u30e7\u30f3\u3067\"host_vars\"\u3084\"group_vars\"\u3092\u6307\u5b9a\u3059\u308b\u3068\u3001<br \/>\nPacker\u306f\u6307\u5b9a\u3055\u308c\u305fhost_vars\u3084group_vars\u306e\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u30fc\u3092<br \/>\n\/tmp\/packer-provisioner-ansible-local\u76f4\u4e0b\u306b\u8907\u88fd\u3059\u308b\u52d5\u304d\u306b\u306a\u308b\u3088\u3046\u3060\u3002<\/p>\n<p>\u3057\u304b\u3057\u3001\u5148\u307b\u3069\u306eAnsible\u516c\u5f0fDoc\u306e<br \/>\n\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u30fc\u30ec\u30a4\u30a2\u30a6\u30c8\u306eBest practice\u3092\u898b\u308c\u3070\u5206\u304b\u308b\u3088\u3046\u306b\u3001<br \/>\nAnsible\u306e\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u30fc\u76f4\u4e0b\u306b\u306f<br \/>\nplaybook\u306e\"host_vars\"\u3084\"group_vars\"\u304c\u65e2\u306b\u5b58\u5728\u3057\u3066\u304a\u308a\u3001<br \/>\n\u958b\u767a\u8005\u306e\u610f\u56f3\u3068\u7570\u306a\u308b\u52d5\u4f5c\u3068\u306a\u308b\u3002<\/p>\n<p><a href=\"https:\/\/github.com\/mitchellh\/packer\/issues\/3863\">ansible-local provisioner with aws: vars_files are not found when provisioning AMI \u00b7 Issue #3316 \u00b7 mitchellh\/packer \u00b7 GitHub<\/a><\/p>\n<p>Ansible\u306e\u516c\u5f0fDoc\u3067\u306f\u5909\u6570\u306e\u8aad\u307f\u8fbc\u307f\u512a\u5148\u5ea6\u304c\u660e\u78ba\u306b\u793a\u3055\u308c\u3066\u304a\u308a\u3001<br \/>\nAnsible\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u306e\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u30fc\u69cb\u6210\u306f\u958b\u767a\u8005\u304c\u610f\u56f3\u3092\u3082\u3063\u3066\u8a2d\u8a08\u3057\u3066\u3044\u308b\u3082\u306e\u3060\u3002<\/p>\n<p><a href=\"http:\/\/docs.ansible.com\/ansible\/playbooks_variables.html#variable-precedence-where-should-i-put-a-variable\">Variables \u2014 Ansible Documentation<\/a><\/p>\n<p>\u3057\u304b\u3057\u3001\u306a\u305c\u304bPacker\u306eAnsible Local provisioner\u306f<br \/>\nAnsible\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u306e\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u30fc\u69cb\u6210\u3092\u5909\u66f4\u3057\u305f\u304c\u308b\u5b9f\u88c5\u306b\u306a\u3063\u3066\u3044\u308b\u306e\u3067\u3001<br \/>\n\u5f53\u9762\u306e\u9593\u306f\u4ee5\u4e0b\u306e\u65b9\u6cd5\u3067\u554f\u984c\u3092\u56de\u907f\u3059\u308b\u3053\u3068\u306b\u3057\u305f\u3002<\/p>\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\r\n{\r\n&quot;type&quot;: &quot;ansible-local&quot;,\r\n&quot;playbook_file&quot;: &quot;playbook_dummy.yml&quot;,\r\n&quot;playbook_dir&quot;: &quot;.\/&quot;\r\n},{\r\n&quot;type&quot;: &quot;shell&quot;,\r\n&quot;inline&quot;: &#x5B;\r\n&quot;cd \/tmp\/packer-provisioner-ansible-local &amp;amp;&amp;amp; ANSIBLE_FORCE_COLOR=1 PYTHONUNBUFFERED=1 ansible-playbook \/tmp\/packer-provisioner-ansible-local\/playbook.yml -c local -i \/tmp\/packer-provisioner-ansible-local\/inventories\/test&quot;\r\n]\r\n}\r\n<\/pre>\n<p>\u3061\u306a\u307f\u306bplaybook_dummy.yml\u306e\u4e2d\u8eab\u306f\u4ee5\u4e0b\u306e\u901a\u308a\u3002<\/p>\n<pre class=\"brush: xml; title: ; notranslate\" title=\"\">\r\n- hosts: localhost\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Ansible\u516c\u5f0fDoc\u3067\u306f\u3001\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u30fc\u30ec\u30a4\u30a2\u30a6\u30c8\u306eBest practice\u306f\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u5b9a\u7fa9\u3055\u308c\u3066\u3044\u308b\u3002 Best Practices \u2014 Ansible Documentation \u307e\u305f\u3001\u516c\u5f0fDoc\u306b\u306f\u660e\u78ba\u306a\u8a18&#8230;<\/p>\n","protected":false},"author":1,"featured_media":10145,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_locale":"ja","_original_post":"10136","footnotes":""},"categories":[16,83,9],"tags":[],"class_list":{"0":"post-10136","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"has-post-thumbnail","7":"category-ci-","8":"category-devops","9":"category-dev","10":"ja"},"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.skyarch.net\/blog\/wp-json\/wp\/v2\/posts\/10136","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.skyarch.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.skyarch.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.skyarch.net\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.skyarch.net\/blog\/wp-json\/wp\/v2\/comments?post=10136"}],"version-history":[{"count":8,"href":"https:\/\/www.skyarch.net\/blog\/wp-json\/wp\/v2\/posts\/10136\/revisions"}],"predecessor-version":[{"id":10153,"href":"https:\/\/www.skyarch.net\/blog\/wp-json\/wp\/v2\/posts\/10136\/revisions\/10153"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.skyarch.net\/blog\/wp-json\/wp\/v2\/media\/10145"}],"wp:attachment":[{"href":"https:\/\/www.skyarch.net\/blog\/wp-json\/wp\/v2\/media?parent=10136"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.skyarch.net\/blog\/wp-json\/wp\/v2\/categories?post=10136"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.skyarch.net\/blog\/wp-json\/wp\/v2\/tags?post=10136"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}