{"id":42464,"date":"2023-06-24T00:14:48","date_gmt":"2023-10-08T04:25:29","guid":{"rendered":"https:\/\/www.silicloud.com\/zh\/blog\/ansible%ef%bc%9a%e5%9c%a8%e7%9b%ae%e6%a0%87%e8%8a%82%e7%82%b9%e4%b8%8a%e4%bd%bf%e7%94%a8python-3%e7%9a%84ansible-cfg%e9%85%8d%e7%bd%ae%e4%b8%8d%e6%98%af%e9%80%9a%e8%bf%87ansible_python_interpreter\/"},"modified":"2024-04-30T10:24:22","modified_gmt":"2024-04-30T02:24:22","slug":"ansible%ef%bc%9a%e5%9c%a8%e7%9b%ae%e6%a0%87%e8%8a%82%e7%82%b9%e4%b8%8a%e4%bd%bf%e7%94%a8python-3%e7%9a%84ansible-cfg%e9%85%8d%e7%bd%ae%e4%b8%8d%e6%98%af%e9%80%9a%e8%bf%87ansible_python_interpreter","status":"publish","type":"post","link":"https:\/\/www.silicloud.com\/zh\/blog\/ansible%ef%bc%9a%e5%9c%a8%e7%9b%ae%e6%a0%87%e8%8a%82%e7%82%b9%e4%b8%8a%e4%bd%bf%e7%94%a8python-3%e7%9a%84ansible-cfg%e9%85%8d%e7%bd%ae%e4%b8%8d%e6%98%af%e9%80%9a%e8%bf%87ansible_python_interpreter\/","title":{"rendered":"Ansible\uff1a\u5728\u76ee\u6807\u8282\u70b9\u4e0a\u4f7f\u7528Python 3\u7684ansible.cfg\u914d\u7f6e\u4e0d\u662f\u901a\u8fc7ansible_python_interpreter\uff0c\u800c\u662finterpreter_python"},"content":{"rendered":"<h1>\u5728\u76ee\u6807\u8282\u70b9\u4e0a\u4f7f\u7528Python3\u7684Ansible\u65b9\u5f0f<\/h1>\n<p>\u7531\u4e8e\u901a\u8fc7ansible.cfg\u6307\u5b9apython3\u65f6\u9047\u5230\u4e86\u9ebb\u70e6\uff0c\u6240\u4ee5\u6211\u8bb0\u5f55\u4e86\u5907\u5fd8\u3002<\/p>\n<h2>\u73af\u5883<\/h2>\n<p>Ansible 2.9.4\uff0c2.9.5\u3002<\/p>\n<h2>\u4f7f\u7528\u53d8\u91cf\u8fdb\u884c\u8bbe\u7f6e<\/h2>\n<p>\u5982\u679c\u8981\u901a\u8fc7\u53d8\u91cf\u8fdb\u884c\u8bbe\u7f6e\uff0c\u53ef\u4ee5\u4f7f\u7528ansible_python_interpreter\u3002<\/p>\n<ul class=\"post-ul\">ansible-playbook\u30b3\u30de\u30f3\u30c9\u306b\u5bfe\u3059\u308b-e\u30aa\u30d7\u30b7\u30e7\u30f3\u306b\u3088\u308b\u8a2d\u5b9a\u4f8b<\/ul>\n<pre class=\"post-pre\"><code>$ ansible-playbook -e ansible_python_interpreter=\/usr\/bin\/python3 site.yml\r\n<\/code><\/pre>\n<ul class=\"post-ul\">inventory\u306b\u304a\u3051\u308b\u8a2d\u5b9a\u4f8b<\/ul>\n<pre class=\"post-pre\"><code><span class=\"nn\">[all:vars]<\/span>\r\n<span class=\"py\">ansible_python_interpreter<\/span><span class=\"p\">=<\/span><span class=\"s\">\/usr\/bin\/python3<\/span>\r\n<\/code><\/pre>\n<ul class=\"post-ul\">play vars, task vars\u306a\u3069\u306b\u304a\u3051\u308b\u8a2d\u5b9a\u4f8b<\/ul>\n<pre class=\"post-pre\"><code><span class=\"na\">vars<\/span><span class=\"pi\">:<\/span>\r\n  <span class=\"na\">ansible_python_interpreter<\/span><span class=\"pi\">:<\/span> <span class=\"s\">\/usr\/bin\/python3<\/span>\r\n<\/code><\/pre>\n<p>\u516c\u5f0f\uff1a\u4f7f\u7528\u547d\u4ee4\u548cplaybooks\u5728\u53d7\u7ba1\u7406\u7684\u673a\u5668\u4e0a\u652f\u6301Python 3.<\/p>\n<h2>\u901a\u8fc7ansible.cfg\u8fdb\u884c\u914d\u7f6e<\/h2>\n<p>\u5728ansible.cfg\u4e2d\u8fdb\u884c\u8bbe\u7f6e\u65f6\uff0c\u8bf7\u6ce8\u610f\u4f7f\u7528interpreter_python\u800c\u4e0d\u662fansible_python_interpreter\u3002<\/p>\n<pre class=\"post-pre\"><code><span class=\"nn\">[defaults]<\/span>\r\n<span class=\"py\">interpreter_python<\/span><span class=\"p\">=<\/span><span class=\"s\">\/usr\/bin\/python3<\/span>\r\n<\/code><\/pre>\n<p>\u516c\u5f0f\uff1aAnsible\u914d\u7f6e\u8bbe\u7f6e &gt; \u89e3\u91ca\u5668- Python<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5728\u76ee\u6807\u8282\u70b9\u4e0a\u4f7f\u7528Python3\u7684Ansible\u65b9\u5f0f \u7531\u4e8e\u901a\u8fc7ansible.cfg\u6307\u5b9apython3\u65f6\u9047\u5230\u4e86\u9ebb [&hellip;]<\/p>\n","protected":false},"author":5,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-42464","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v21.5 (Yoast SEO v21.5) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Ansible\uff1a\u5728\u76ee\u6807\u8282\u70b9\u4e0a\u4f7f\u7528Python 3\u7684ansible.cfg\u914d\u7f6e\u4e0d\u662f\u901a\u8fc7ansible_python_interpreter\uff0c\u800c\u662finterpreter_python - Blog - Silicon Cloud<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.silicloud.com\/zh\/blog\/ansible\uff1a\u5728\u76ee\u6807\u8282\u70b9\u4e0a\u4f7f\u7528python-3\u7684ansible-cfg\u914d\u7f6e\u4e0d\u662f\u901a\u8fc7ansible_python_interpreter\/\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Ansible\uff1a\u5728\u76ee\u6807\u8282\u70b9\u4e0a\u4f7f\u7528Python 3\u7684ansible.cfg\u914d\u7f6e\u4e0d\u662f\u901a\u8fc7ansible_python_interpreter\uff0c\u800c\u662finterpreter_python\" \/>\n<meta property=\"og:description\" content=\"\u5728\u76ee\u6807\u8282\u70b9\u4e0a\u4f7f\u7528Python3\u7684Ansible\u65b9\u5f0f \u7531\u4e8e\u901a\u8fc7ansible.cfg\u6307\u5b9apython3\u65f6\u9047\u5230\u4e86\u9ebb [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.silicloud.com\/zh\/blog\/ansible\uff1a\u5728\u76ee\u6807\u8282\u70b9\u4e0a\u4f7f\u7528python-3\u7684ansible-cfg\u914d\u7f6e\u4e0d\u662f\u901a\u8fc7ansible_python_interpreter\/\" \/>\n<meta property=\"og:site_name\" content=\"Blog - Silicon Cloud\" \/>\n<meta property=\"article:published_time\" content=\"2023-10-08T04:25:29+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-04-30T02:24:22+00:00\" \/>\n<meta name=\"author\" content=\"\u6e05, \u5b87\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"\u6e05, \u5b87\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/ansible%ef%bc%9a%e5%9c%a8%e7%9b%ae%e6%a0%87%e8%8a%82%e7%82%b9%e4%b8%8a%e4%bd%bf%e7%94%a8python-3%e7%9a%84ansible-cfg%e9%85%8d%e7%bd%ae%e4%b8%8d%e6%98%af%e9%80%9a%e8%bf%87ansible_python_interpreter\/\",\"url\":\"https:\/\/www.silicloud.com\/zh\/blog\/ansible%ef%bc%9a%e5%9c%a8%e7%9b%ae%e6%a0%87%e8%8a%82%e7%82%b9%e4%b8%8a%e4%bd%bf%e7%94%a8python-3%e7%9a%84ansible-cfg%e9%85%8d%e7%bd%ae%e4%b8%8d%e6%98%af%e9%80%9a%e8%bf%87ansible_python_interpreter\/\",\"name\":\"Ansible\uff1a\u5728\u76ee\u6807\u8282\u70b9\u4e0a\u4f7f\u7528Python 3\u7684ansible.cfg\u914d\u7f6e\u4e0d\u662f\u901a\u8fc7ansible_python_interpreter\uff0c\u800c\u662finterpreter_python - Blog - Silicon Cloud\",\"isPartOf\":{\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#website\"},\"datePublished\":\"2023-10-08T04:25:29+00:00\",\"dateModified\":\"2024-04-30T02:24:22+00:00\",\"author\":{\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/1a6ecd3d914d22a5ac32791ffc1fbd8e\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/ansible%ef%bc%9a%e5%9c%a8%e7%9b%ae%e6%a0%87%e8%8a%82%e7%82%b9%e4%b8%8a%e4%bd%bf%e7%94%a8python-3%e7%9a%84ansible-cfg%e9%85%8d%e7%bd%ae%e4%b8%8d%e6%98%af%e9%80%9a%e8%bf%87ansible_python_interpreter\/#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.silicloud.com\/zh\/blog\/ansible%ef%bc%9a%e5%9c%a8%e7%9b%ae%e6%a0%87%e8%8a%82%e7%82%b9%e4%b8%8a%e4%bd%bf%e7%94%a8python-3%e7%9a%84ansible-cfg%e9%85%8d%e7%bd%ae%e4%b8%8d%e6%98%af%e9%80%9a%e8%bf%87ansible_python_interpreter\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/ansible%ef%bc%9a%e5%9c%a8%e7%9b%ae%e6%a0%87%e8%8a%82%e7%82%b9%e4%b8%8a%e4%bd%bf%e7%94%a8python-3%e7%9a%84ansible-cfg%e9%85%8d%e7%bd%ae%e4%b8%8d%e6%98%af%e9%80%9a%e8%bf%87ansible_python_interpreter\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.silicloud.com\/zh\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Ansible\uff1a\u5728\u76ee\u6807\u8282\u70b9\u4e0a\u4f7f\u7528Python 3\u7684ansible.cfg\u914d\u7f6e\u4e0d\u662f\u901a\u8fc7ansible_python_interpreter\uff0c\u800c\u662finterpreter_python\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#website\",\"url\":\"https:\/\/www.silicloud.com\/zh\/blog\/\",\"name\":\"Blog - Silicon Cloud\",\"description\":\"\",\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/1a6ecd3d914d22a5ac32791ffc1fbd8e\",\"name\":\"\u6e05, \u5b87\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/4b2016c18459a605fc469c7566608f5686491baa112d0871ee613f61b7210565?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/4b2016c18459a605fc469c7566608f5686491baa112d0871ee613f61b7210565?s=96&d=mm&r=g\",\"caption\":\"\u6e05, \u5b87\"},\"url\":\"https:\/\/www.silicloud.com\/zh\/blog\/author\/qingyu\/\"},{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/ansible%ef%bc%9a%e5%9c%a8%e7%9b%ae%e6%a0%87%e8%8a%82%e7%82%b9%e4%b8%8a%e4%bd%bf%e7%94%a8python-3%e7%9a%84ansible-cfg%e9%85%8d%e7%bd%ae%e4%b8%8d%e6%98%af%e9%80%9a%e8%bf%87ansible_python_interpreter\/#local-main-organization-logo\",\"url\":\"\",\"contentUrl\":\"\",\"caption\":\"Blog - Silicon Cloud\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Ansible\uff1a\u5728\u76ee\u6807\u8282\u70b9\u4e0a\u4f7f\u7528Python 3\u7684ansible.cfg\u914d\u7f6e\u4e0d\u662f\u901a\u8fc7ansible_python_interpreter\uff0c\u800c\u662finterpreter_python - Blog - Silicon Cloud","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.silicloud.com\/zh\/blog\/ansible\uff1a\u5728\u76ee\u6807\u8282\u70b9\u4e0a\u4f7f\u7528python-3\u7684ansible-cfg\u914d\u7f6e\u4e0d\u662f\u901a\u8fc7ansible_python_interpreter\/","og_locale":"zh_CN","og_type":"article","og_title":"Ansible\uff1a\u5728\u76ee\u6807\u8282\u70b9\u4e0a\u4f7f\u7528Python 3\u7684ansible.cfg\u914d\u7f6e\u4e0d\u662f\u901a\u8fc7ansible_python_interpreter\uff0c\u800c\u662finterpreter_python","og_description":"\u5728\u76ee\u6807\u8282\u70b9\u4e0a\u4f7f\u7528Python3\u7684Ansible\u65b9\u5f0f \u7531\u4e8e\u901a\u8fc7ansible.cfg\u6307\u5b9apython3\u65f6\u9047\u5230\u4e86\u9ebb [&hellip;]","og_url":"https:\/\/www.silicloud.com\/zh\/blog\/ansible\uff1a\u5728\u76ee\u6807\u8282\u70b9\u4e0a\u4f7f\u7528python-3\u7684ansible-cfg\u914d\u7f6e\u4e0d\u662f\u901a\u8fc7ansible_python_interpreter\/","og_site_name":"Blog - Silicon Cloud","article_published_time":"2023-10-08T04:25:29+00:00","article_modified_time":"2024-04-30T02:24:22+00:00","author":"\u6e05, \u5b87","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"\u6e05, \u5b87"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.silicloud.com\/zh\/blog\/ansible%ef%bc%9a%e5%9c%a8%e7%9b%ae%e6%a0%87%e8%8a%82%e7%82%b9%e4%b8%8a%e4%bd%bf%e7%94%a8python-3%e7%9a%84ansible-cfg%e9%85%8d%e7%bd%ae%e4%b8%8d%e6%98%af%e9%80%9a%e8%bf%87ansible_python_interpreter\/","url":"https:\/\/www.silicloud.com\/zh\/blog\/ansible%ef%bc%9a%e5%9c%a8%e7%9b%ae%e6%a0%87%e8%8a%82%e7%82%b9%e4%b8%8a%e4%bd%bf%e7%94%a8python-3%e7%9a%84ansible-cfg%e9%85%8d%e7%bd%ae%e4%b8%8d%e6%98%af%e9%80%9a%e8%bf%87ansible_python_interpreter\/","name":"Ansible\uff1a\u5728\u76ee\u6807\u8282\u70b9\u4e0a\u4f7f\u7528Python 3\u7684ansible.cfg\u914d\u7f6e\u4e0d\u662f\u901a\u8fc7ansible_python_interpreter\uff0c\u800c\u662finterpreter_python - Blog - Silicon Cloud","isPartOf":{"@id":"https:\/\/www.silicloud.com\/zh\/blog\/#website"},"datePublished":"2023-10-08T04:25:29+00:00","dateModified":"2024-04-30T02:24:22+00:00","author":{"@id":"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/1a6ecd3d914d22a5ac32791ffc1fbd8e"},"breadcrumb":{"@id":"https:\/\/www.silicloud.com\/zh\/blog\/ansible%ef%bc%9a%e5%9c%a8%e7%9b%ae%e6%a0%87%e8%8a%82%e7%82%b9%e4%b8%8a%e4%bd%bf%e7%94%a8python-3%e7%9a%84ansible-cfg%e9%85%8d%e7%bd%ae%e4%b8%8d%e6%98%af%e9%80%9a%e8%bf%87ansible_python_interpreter\/#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.silicloud.com\/zh\/blog\/ansible%ef%bc%9a%e5%9c%a8%e7%9b%ae%e6%a0%87%e8%8a%82%e7%82%b9%e4%b8%8a%e4%bd%bf%e7%94%a8python-3%e7%9a%84ansible-cfg%e9%85%8d%e7%bd%ae%e4%b8%8d%e6%98%af%e9%80%9a%e8%bf%87ansible_python_interpreter\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.silicloud.com\/zh\/blog\/ansible%ef%bc%9a%e5%9c%a8%e7%9b%ae%e6%a0%87%e8%8a%82%e7%82%b9%e4%b8%8a%e4%bd%bf%e7%94%a8python-3%e7%9a%84ansible-cfg%e9%85%8d%e7%bd%ae%e4%b8%8d%e6%98%af%e9%80%9a%e8%bf%87ansible_python_interpreter\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.silicloud.com\/zh\/blog\/"},{"@type":"ListItem","position":2,"name":"Ansible\uff1a\u5728\u76ee\u6807\u8282\u70b9\u4e0a\u4f7f\u7528Python 3\u7684ansible.cfg\u914d\u7f6e\u4e0d\u662f\u901a\u8fc7ansible_python_interpreter\uff0c\u800c\u662finterpreter_python"}]},{"@type":"WebSite","@id":"https:\/\/www.silicloud.com\/zh\/blog\/#website","url":"https:\/\/www.silicloud.com\/zh\/blog\/","name":"Blog - Silicon Cloud","description":"","inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/1a6ecd3d914d22a5ac32791ffc1fbd8e","name":"\u6e05, \u5b87","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/4b2016c18459a605fc469c7566608f5686491baa112d0871ee613f61b7210565?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/4b2016c18459a605fc469c7566608f5686491baa112d0871ee613f61b7210565?s=96&d=mm&r=g","caption":"\u6e05, \u5b87"},"url":"https:\/\/www.silicloud.com\/zh\/blog\/author\/qingyu\/"},{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.silicloud.com\/zh\/blog\/ansible%ef%bc%9a%e5%9c%a8%e7%9b%ae%e6%a0%87%e8%8a%82%e7%82%b9%e4%b8%8a%e4%bd%bf%e7%94%a8python-3%e7%9a%84ansible-cfg%e9%85%8d%e7%bd%ae%e4%b8%8d%e6%98%af%e9%80%9a%e8%bf%87ansible_python_interpreter\/#local-main-organization-logo","url":"","contentUrl":"","caption":"Blog - Silicon Cloud"}]}},"_links":{"self":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts\/42464","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/comments?post=42464"}],"version-history":[{"count":2,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts\/42464\/revisions"}],"predecessor-version":[{"id":91341,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts\/42464\/revisions\/91341"}],"wp:attachment":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/media?parent=42464"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/categories?post=42464"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/tags?post=42464"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}