{"id":42361,"date":"2023-11-10T15:13:40","date_gmt":"2023-12-30T18:41:47","guid":{"rendered":"https:\/\/www.silicloud.com\/zh\/blog\/ansible-%e5%88%b6%e4%bd%9c%e5%b9%b6%e5%9c%a8galaxy%e4%b8%8a%e5%8f%91%e5%b8%83%e8%87%aa%e5%ae%9a%e4%b9%89%e7%9a%84%e9%9b%86%e5%90%88\/"},"modified":"2024-05-04T08:21:13","modified_gmt":"2024-05-04T00:21:13","slug":"ansible-%e5%88%b6%e4%bd%9c%e5%b9%b6%e5%9c%a8galaxy%e4%b8%8a%e5%8f%91%e5%b8%83%e8%87%aa%e5%ae%9a%e4%b9%89%e7%9a%84%e9%9b%86%e5%90%88","status":"publish","type":"post","link":"https:\/\/www.silicloud.com\/zh\/blog\/ansible-%e5%88%b6%e4%bd%9c%e5%b9%b6%e5%9c%a8galaxy%e4%b8%8a%e5%8f%91%e5%b8%83%e8%87%aa%e5%ae%9a%e4%b9%89%e7%9a%84%e9%9b%86%e5%90%88\/","title":{"rendered":"[Ansible] \u5236\u4f5c\u5e76\u5728Galaxy\u4e0a\u53d1\u5e03\u81ea\u5b9a\u4e49\u7684\u96c6\u5408"},"content":{"rendered":"<p>\u672c\u6587\u662f\u300cAnsible Advent Calendar 2020\u300d\u7b2c16\u5929\u7684\u4ecb\u7ecd\u3002<br \/>\n\u8fd9\u7bc7\u6587\u7ae0\u5c06\u8bb2\u8ff0\u6211\u5728\u4e4b\u524d\u7684\u53e6\u4e00\u4e2a\u5723\u8bde\u65e5\u5386\u4e0a\u53d1\u5e03\u7684\u300c\u4f7f\u7528vim-cmd\u5728ESXi\u4e0a\u64cd\u4f5c\u865a\u62df\u673a\u7684Ansible\u96c6\u5408\uff08\u53ef\u514d\u8d39\u4f7f\u7528\u8bb8\u53ef\u8bc1\uff09\u300d\u662f\u5982\u4f55\u521b\u5efa\u548c\u53d1\u5e03\u7684\u3002<\/p>\n<h1>\u5e8f\u6587 (Qianzhu\u00ec)<\/h1>\n<p>\u5728\u672c\u6587\u4e2d\uff0c\u6211\u4eec\u4e0d\u4f1a\u89e3\u91ca&#8221;\u5982\u4f55\u5236\u4f5c\u6a21\u5757&#8221;\u672c\u8eab\uff0c\u57fa\u672c\u4e0a\u5185\u5bb9\u4e3b\u8981\u5173\u6ce8\u7684\u662f&#8221;\u5982\u4f55\u5c06\u5df2\u521b\u5efa\u7684\u81ea\u5236\u6a21\u5757\u6536\u96c6\u8d77\u6765&#8221;\u7684\u89c6\u89d2\u3002<\/p>\n<p>\u53e6\u5916\uff0c\u9002\u7528\u8303\u56f4\u4ec5\u9650\u4e8e\u6a21\u5757\u63d2\u4ef6\u3002(\u4e0d\u5305\u62ec\u56de\u8c03\u51fd\u6570\u548c\u67e5\u627e\u529f\u80fd\u7b49)<\/p>\n<h1>\u521b\u5efa\u4e00\u4e2a Ansible Galaxy \u5e10\u6237 (\u51c6\u5907)<\/h1>\n<p>\u53ea\u8981\u4e0d\u516c\u5f00\u521b\u5efa\u7684\u6536\u85cf\u54c1\uff0c\u5c31\u4e0d\u9700\u8981Galaxy\u8d26\u6237\u3002<\/p>\n<p>Ansible Galaxy<br \/>\n\u5b89\u745f\u5e03\u5c14\u94f6\u6cb3<\/p>\n<p>\u9700\u8981\u4e00\u4e2aGitHub\u8d26\u53f7\u3002<\/p>\n<p>\u4ece\u753b\u9762\u53f3\u4e0a\u65b9\u7684\u300cLogin\u300d\u5f00\u59cb\u3002<br \/>\n\u70b9\u51fb\u540e\u4f1a\u8981\u6c42\u4e0eGitHub\u8fdb\u884c\u8fde\u63a5\uff0c\u56e0\u6b64\u8981\u70b9\u51fb\u56fe\u6807\u8fdb\u884c\u8fde\u63a5\u3002<\/p>\n<div><img decoding=\"async\" class=\"post-images\" title=\"\" src=\"https:\/\/cdn.silicloud.com\/blog-img\/blog\/img\/657d4c4937434c4406cb9ebd\/9-0.png\" alt=\"image.png\" \/><\/div>\n<p>\u5982\u679c\u4e0d\u6253\u7b97\u516c\u5f00\u7684\u8bdd\u5c31\u6ca1\u6709\u5fc5\u8981\u521b\u5efa\u8d26\u6237\uff0c\u4f46\u5982\u679c\u6709\u53ef\u80fd\u4f1a\u516c\u5f00\u7684\u8bdd\uff0c\u521b\u5efa\u8d26\u6237\u53ef\u4ee5\u7acb\u5373\u4e86\u89e3\u5982\u4f55\u51b3\u5b9a\u547d\u540d\u7a7a\u95f4\uff0c\u6240\u4ee5\u6700\u597d\u8fd8\u662f\u521b\u5efa\u3002<\/p>\n<p>\u7b80\u5355\u6765\u8bf4\uff0c\u4e2a\u4eba\u521b\u5efa\u65f6\uff0cGitHub\u8d26\u6237\u540d\u548c\u96c6\u5408\u540d\u4f1a\u7ec4\u6210\u4e00\u4e2a\u6574\u4f53\u3002<br \/>\n\uff08\u96c6\u5408\u540d\u53ef\u4ee5\u6839\u636e\u529f\u80fd\u7b49\u81ea\u7531\u9009\u62e9\uff09<\/p>\n<h1>\u547d\u540d\u7a7a\u95f4\u7684\u9009\u62e9\u65b9\u6cd5<\/h1>\n<p>Ansible 2.10\u8d77\uff0c\u5f15\u5165\u4e86\u547d\u540d\u7a7a\u95f4\u7684\u6982\u5ff5\u4f5c\u4e3a\u6807\u51c6\u529f\u80fd\uff0c\u5176\u4e2d\u6a21\u5757\u7b49\u90fd\u7ecf\u8fc7\u4e86\u5206\u7c7b\u3002<\/p>\n<p>\u6240\u4ee5\uff0c\u5728\u8bbe\u8ba1\u81ea\u5b9a\u4e49\u96c6\u5408\u7684\u547d\u540d\u7a7a\u95f4\u65f6\uff0c\u53ef\u4ee5\u81ea\u7531\u51b3\u5b9a\uff0c\u4f46\u5982\u679c\u8981\u5728Ansible Galaxy\u4e0a\u53d1\u5e03\uff0c\u5219\u5fc5\u987b\u4e0eGalaxy\u7684\u547d\u540d\u7a7a\u95f4\u76f8\u540c\u3002<br \/>\n\u56e0\u6b64\uff0c\u60a8\u9700\u8981\u4f7f\u7528GitHub\u5e10\u6237\u521b\u5efa\u4e00\u4e2aGalaxy\u5e10\u6237\uff08\u4e2a\u4eba\u60c5\u51b5\u5f88\u5c11\uff09\uff0c\u57fa\u672c\u4e0a\u4f7f\u7528GitHub\u5e10\u6237\u540d.\u96c6\u5408\u540d\u79f0\u6765\u521b\u5efa\u4f1a\u66f4\u65b9\u4fbf\u3002<\/p>\n<blockquote><p>\u5982\u679cGitHub\uff08\u6216\u5176\u4ed6\u5730\u65b9\uff09\u4e0a\u7684\u7ec4\u7ec7\u548c\u4ee3\u7801\u5e93\u540d\u79f0\u4e0eAnsible Galaxy\u4e0a\u7684\u547d\u540d\u7a7a\u95f4\u548c\u6536\u85cf\u540d\u79f0\u76f8\u5339\u914d\uff0c\u90a3\u5c06\u975e\u5e38\u65b9\u4fbf\uff0c\u4f46\u4e0d\u662f\u5fc5\u9700\u7684\u3002\u7136\u800c\uff0c\u60a8\u5728\u4ee3\u7801\u5e93\u548cGalaxy\u6536\u85cf\u54c1\u4e2d\u9009\u62e9\u7684\u63d2\u4ef6\u540d\u79f0\u59cb\u7ec8\u662f\u76f8\u540c\u7684\u3002<\/p>\n<p>https:\/\/docs.ansible.com\/ansible\/latest\/dev_guide\/developing_modules_in_groups.html#naming-conventions<\/p><\/blockquote>\n<p>\u987a\u4fbf\u63d0\u4e00\u4e0b\uff0c\u6211\u5728GitHub\u7684\u8d26\u6237\u540d\u662fzaki-lknr\uff0c\u5176\u4e2d\u5305\u542b\u4e86\u4e00\u4e2a\u8fde\u5b57\u7b26\u3002\u4f46\u662f\uff0c\u5728\u96c6\u5408\u7684\u547d\u540d\u7a7a\u95f4\u4e2d\uff0c\u53ea\u80fd\u4f7f\u7528m\/[a-zA-Z0-9_]\u4e2d\u7684\u5b57\u7b26\uff0c\u6240\u4ee5\u6211\u4f1a\u5c06\u8fde\u5b57\u7b26\u8f6c\u6362\u4e3a\u4e0b\u5212\u7ebf\u3002<br \/>\n\u800c\u4e14\u5982\u679c\u6211\u4f7f\u7528\u8fd9\u4e2aGitHub\u8d26\u6237\u540d\u5728Ansible Galaxy\u4e0a\u521b\u5efa\u8d26\u6237\uff0c\u90a3\u4e48\u5728Ansible Galaxy\u4e0a\uff0c\u6211\u7684\u7528\u6237\u540d\u5c06\u53d8\u4e3azaki_lknr\u3002<\/p>\n<p>\u5982\u679c\u60a8\u60f3\u521b\u5efa\u4e00\u4e2a\u4e13\u7528\u7684\u547d\u540d\u7a7a\u95f4\uff08\u4f8b\u5982\u5171\u540c\u5f00\u53d1\u7684\u4ea7\u54c1\u540d\u79f0\uff09\uff0c\u800c\u4e0d\u662f\u4f7f\u7528GitHub\u5e10\u6237\u540d\uff0c\u5219\u4f3c\u4e4e\u9700\u8981\u5728Galaxy\u7684\u95ee\u9898\uff08Issue\uff09\u4e2d\u63d0\u51fa\u8bf7\u6c42\u3002<\/p>\n<h1>\u521b\u5efa\u6536\u85cf\u5939<\/h1>\n<h2>\u521b\u5efa\u5de5\u4f5c\u76ee\u5f55<\/h2>\n<p>\u9996\u5148\uff0c\u5728\u62e5\u6709Playbook\u7684\u4f4d\u7f6e\u4e0a\u521b\u5efa\u4e00\u4e2a\u540d\u4e3acollections\/ansible_collections\u7684\u76ee\u5f55\u3002<br \/>\n\u867d\u7136\u521b\u5efa\u7684\u96c6\u5408\u7684\u8def\u5f84\u662f\u4efb\u610f\u7684\uff0c\u4f46\u5c06\u6b64\u76ee\u5f55\u7ed3\u6784\u7528\u4e8e\u4f7f\u624b\u5934\u7684Playbook\u80fd\u591f\u8f7b\u677e\u4f7f\u7528\u6240\u521b\u5efa\u7684\u96c6\u5408\u3002(\u4ee5\u4fbf\u5728\u6267\u884c\u65f6\u80fd\u591f\u8bc6\u522b\u4f4d\u4e8e&#8221;\u96c6\u5408\u8def\u5f84&#8221;\u4e0b\u7684ansible_collections\/&lt;\u547d\u540d\u7a7a\u95f4&gt;\/&lt;\u96c6\u5408&gt;\u8def\u5f84)<\/p>\n<pre class=\"post-pre\"><code>(2.10) [zaki@cloud-dev esxi-ansible]$ mkdir -p collections\/ansible_collections\r\n<\/code><\/pre>\n<p>\u203b\u7531\u4e8e\u201ccollections\u201d\u76ee\u5f55\u4e0d\u662f\u9ed8\u8ba4\u7684\uff0c\u6240\u4ee5\u53ef\u4ee5\u968f\u610f\u547d\u540d\u3002<\/p>\n<h2>\u521b\u5efa\u6536\u85cf\u54c1\u6a21\u677f<\/h2>\n<p>\u53ef\u4ee5\u901a\u8fc7ansible-galaxy collection init\u547d\u4ee4\u81ea\u52a8\u751f\u6210\u3002<br \/>\n\u4f7f\u7528\u683c\u5f0f\u4e3a\u6307\u5b9a\u53c2\u6570.\u3002<br \/>\n\u4f7f\u7528\u9009\u9879&#8211;init-path collections\uff0c\u5e76\u5728\u524d\u9762\u7684collections\/ansible_collections\u76ee\u5f55\u4e0b\u521b\u5efa\u3002<\/p>\n<pre class=\"post-pre\"><code>(2.10) [zaki@cloud-dev esxi-ansible]$ ansible-galaxy collection init zaki_lknr.esxissh --init-path collections\/ansible_collections\r\n- Collection zaki_lknr.esxissh was created successfully\r\n<\/code><\/pre>\n<p>\u5982\u679c\u6ca1\u6709\u6307\u5b9a`collections`\uff0c\u5219\u5728\u8fd0\u884c\u65f6\u7684\u5f53\u524d\u76ee\u5f55\u4e0b\u521b\u5efa\u3002<\/p>\n<p>\u751f\u6210\u7684\u6587\u4ef6\u7ec4\u5927\u81f4\u5982\u4e0b\u3002<\/p>\n<pre class=\"post-pre\"><code>(2.10) [zaki@cloud-dev esxi-ansible]$ find collections\/\r\ncollections\/\r\ncollections\/ansible_collections\r\ncollections\/ansible_collections\/zaki_lknr\r\ncollections\/ansible_collections\/zaki_lknr\/esxissh\r\ncollections\/ansible_collections\/zaki_lknr\/esxissh\/README.md\r\ncollections\/ansible_collections\/zaki_lknr\/esxissh\/galaxy.yml\r\ncollections\/ansible_collections\/zaki_lknr\/esxissh\/docs\r\ncollections\/ansible_collections\/zaki_lknr\/esxissh\/plugins\r\ncollections\/ansible_collections\/zaki_lknr\/esxissh\/plugins\/README.md\r\ncollections\/ansible_collections\/zaki_lknr\/esxissh\/roles\r\n<\/code><\/pre>\n<p>\u73b0\u5728\u6211\u4eec\u5df2\u7ecf\u521b\u5efa\u4e86\u4e00\u4e2a\u540d\u4e3azaki_lknr.esxissh.hogehoge\u548czaki_lknr.esxissh.foobar\u7684\u6a21\u5757\u7684\u6a21\u677f\u3002<\/p>\n<h2>\u521b\u5efa Ansible \u6a21\u5757<\/h2>\n<p>\u8fd9\u6b21\u6211\u4eec\u5c06\u5728\u96c6\u5408\u4e0b\u521b\u5efa\u6a21\u5757\u3002<br \/>\n\u96c6\u5408\u4e0d\u4ec5\u4ec5\u662f\u6a21\u5757\uff0c\u8fd8\u5305\u62ec\u56de\u8c03\u63d2\u4ef6\u3001\u67e5\u627e\u63d2\u4ef6\u7b49\u5404\u79cd\u63d2\u4ef6\u7684\u96c6\u5408\u3002<\/p>\n<p>\u5982\u679c\u4ece\u5f53\u524d\u7684Ansible\u6587\u6863\u7f51\u7ad9\u7684\u201cCollection Index\u201d\u4e2d\u9009\u62e9\u4e00\u9879\uff0c\u4f60\u4f1a\u53d1\u73b0\u5b83\u53d8\u6210\u4e86\u201cPlugin Index\u201d\uff0c\u8fd9\u6837\u4f60\u5c31\u5bb9\u6613\u5730\u7406\u89e3\u5230\u5c42\u6b21\u7ed3\u6784\u7684\u6982\u5ff5\u3002<br \/>\n\u4e3e\u4e2a\u4f8b\u5b50\uff0c\u5982\u679c\u67e5\u770b\u6807\u51c6\u7684\u201cansible.builtin collection\u201d\uff0c\u5b83\u88ab\u5206\u7c7b\u5982\u4e0b\uff1a<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">Become Plugins<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">Cache Plugins<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">Callback Plugins<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">Connection Plugins<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">Inventory Plugins<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">Lookup Plugins<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">Modules<\/ul>\n<\/li>\n<\/ul>\n<p>\u4eca\u56de\u3053\u308c\u3092\u4f5c\u308a\u307e\u3059\u2606\u5f61<\/p>\n<p>Shell Plugins<br \/>\nStrategy Plugins<br \/>\nVars Plugins<\/p>\n<p>\u8bf7\u67e5\u9605\u8be6\u7ec6\u4fe1\u606f\uff0c\u53ef\u53c2\u8003\u5df2\u521b\u5efa\u7684plugins\/README.md\u6587\u4ef6\u548c\u300a\u4e0e\u63d2\u4ef6\u4e00\u8d77\u4f7f\u7528 \u2014 Ansible\u6587\u6863\u300b\u3002<\/p>\n<p>\u6240\u4ee5\uff0c\u8ba9\u6211\u4eec\u56de\u5230\u8bdd\u9898\uff0c\u6211\u4eec\u5c06\u521b\u5efa\u4e00\u4e2a\u540d\u4e3azaki_lknr.esxissh\u7684\u96c6\u5408\uff0c\u5728ESXi\u4e0a\u521b\u5efaesxissh_guest_power Ansible\u6a21\u5757\uff0c\u7528\u4e8e\u6253\u5f00\/\u5173\u95ed\u865a\u62df\u673a\u7684\u7535\u6e90\u3002<\/p>\n<p>Ansible\u6a21\u5757\u7684\u6e90\u4ee3\u7801\u4f4d\u4e8etemplates\u6587\u4ef6\u5939\u4e0b\u7684plugins\u6587\u4ef6\u5939\u4e2d\u7684\u5b50\u6587\u4ef6\u5939modules\u4e2d\uff0c\u5e76\u901a\u8fc7\u5728\u8be5\u6587\u4ef6\u5939\u4e0b\u521b\u5efa\u6a21\u5757\u63d2\u4ef6\u6765\u5b9e\u73b0\u529f\u80fd\u3002<br \/>\n\u5728\u8fd9\u4e2a\u4f8b\u5b50\u4e2d\uff0c\u521b\u5efa\u4e86collections\/zaki_lknr\/esxissh\/plugins\/modules\u6587\u4ef6\u5939\u5e76\u5728\u5176\u4e2d\u521b\u5efa\u4e86esxissh_guest_power.py\u4f5c\u4e3a\u6a21\u5757\u63d2\u4ef6\u3002<\/p>\n<pre class=\"post-pre\"><code>\/home\/zaki\/src\/esxi-ansible\/collections\/\r\n\u2514\u2500\u2500 ansible_collections\r\n    \u2514\u2500\u2500 zaki_lknr\r\n        \u2514\u2500\u2500 esxissh\r\n            \u251c\u2500\u2500 README.md\r\n            \u251c\u2500\u2500 docs\r\n            \u251c\u2500\u2500 galaxy.yml\r\n            \u251c\u2500\u2500 plugins\r\n            \u2502   \u251c\u2500\u2500 README.md\r\n            \u2502   \u251c\u2500\u2500 module_utils\r\n            \u2502   \u2502   \u2514\u2500\u2500 esxissh.py\r\n            \u2502   \u2514\u2500\u2500 modules\r\n            \u2502       \u251c\u2500\u2500 esxissh_guest.py\r\n            \u2502       \u2514\u2500\u2500 esxissh_guest_power.py      &lt;- \u3053\u308c\r\n            \u2514\u2500\u2500 roles\r\n<\/code><\/pre>\n<p>\u5728\u8fd9\u91cc\uff0c\u6211\u4eec\u5c06\u628a\u9884\u5148\u521b\u5efa\u7684\u6a21\u5757library\/esxissh_guest_power.py\u653e\u7f6e\u5728\u975e\u6536\u96c6\u73af\u5883\u4e2d\u3002<\/p>\n<pre class=\"post-pre\"><code>(2.10) [zaki@cloud-dev esxi-ansible]$ mkdir collections\/ansible_collections\/zaki_lknr\/esxissh\/plugins\/modules\r\n(2.10) [zaki@cloud-dev esxi-ansible]$ cp sample-playbook\/library\/esxissh_guest_power.py collections\/ansible_collections\/zaki_lknr\/esxissh\/plugins\/modules\/\r\n<\/code><\/pre>\n<p>\u653e\u7f6e\u5728\u8fd9\u91cc\u7684\u6e90\u6587\u4ef6\u5c06\u6210\u4e3a\u6a21\u5757\u7684\u6587\u4ef6\u540d\u3002<\/p>\n<h2>\u88ab\u6a21\u5757\u5bfc\u5165\u7684Python\u5305<\/h2>\n<p>\u5982\u679c\u8981\u5728\u4eceAnsible\u6a21\u5757\u4e2d\u5f15\u5165\u7684\u5916\u90e8\u6587\u4ef6\u4e2d\u5b9e\u73b0\u5904\u7406\uff08\u4f8b\u5982\u521b\u5efa\u591a\u4e2aAnsible\u6a21\u5757\u5e76\u5c06\u516c\u5171\u5904\u7406\u5b9e\u73b0\u5728\u5916\u90e8\u6e90\u4ee3\u7801\u6587\u4ef6\u4e2d\u7b49\uff09\uff0c\u53ef\u4ee5\u50cf\u4f20\u7edf\u7684Ansible\u6a21\u5757\u4e00\u6837\uff0c\u5728modules\u7684\u540c\u4e00\u5c42\u7ea7\u4e0b\u521b\u5efa\u4e00\u4e2a\u540d\u4e3amodule_utils\u7684\u76ee\u5f55\uff0c\u5e76\u5c06\u6e90\u6587\u4ef6\u653e\u7f6e\u5728\u90a3\u91cc\u4ee5\u8fdb\u884c\u5bfc\u5165\u3002<\/p>\n<pre class=\"post-pre\"><code>\/home\/zaki\/src\/esxi-ansible\/collections\/\r\n\u2514\u2500\u2500 ansible_collections\r\n    \u2514\u2500\u2500 zaki_lknr\r\n        \u2514\u2500\u2500 esxissh\r\n            \u251c\u2500\u2500 README.md\r\n            \u251c\u2500\u2500 docs\r\n            \u251c\u2500\u2500 galaxy.yml\r\n            \u251c\u2500\u2500 plugins\r\n            \u2502   \u251c\u2500\u2500 README.md\r\n            \u2502   \u251c\u2500\u2500 module_utils\r\n            \u2502   \u2502   \u2514\u2500\u2500 esxissh.py                 &lt;- \u3053\u308c\r\n            \u2502   \u2514\u2500\u2500 modules\r\n            \u2502       \u251c\u2500\u2500 esxissh_guest.py\r\n            \u2502       \u2514\u2500\u2500 esxissh_guest_power.py\r\n            \u2514\u2500\u2500 roles\r\n<\/code><\/pre>\n<pre class=\"post-pre\"><code>(2.10) [zaki@cloud-dev esxi-ansible]$ mkdir collections\/ansible_collections\/zaki_lknr\/esxissh\/plugins\/module_utils\r\n(2.10) [zaki@cloud-dev esxi-ansible]$ cp sample-playbook\/module_utils\/esxissh.py collections\/ansible_collections\/zaki_lknr\/esxissh\/plugins\/module_utils\/\r\n<\/code><\/pre>\n<p>\u7136\u540e\uff0c\u5bfc\u5165\u7684\u8def\u5f84\u548c\u683c\u5f0f\u5e94\u4e3afrom ansible_collections&#8230;plugins.module_utils import \u3002<br \/>\n(\u5c06\u4eceansible.module_utils\u5bfc\u5165\u7684\u90e8\u5206\u6539\u4e3a\u2192 \u4fee\u6539\u793a\u4f8b)<\/p>\n<pre class=\"post-pre\"><code><span class=\"kn\">from<\/span> <span class=\"nn\">ansible_collections.zaki_lknr.esxissh.plugins.module_utils<\/span> <span class=\"kn\">import<\/span> <span class=\"n\">esxissh<\/span>\r\n<\/code><\/pre>\n<p>\u8fd9\u6837\u4e00\u6765\uff0c\u4ee3\u7801\u90e8\u5206\u65e0\u9700\u66f4\u6539\u3002<\/p>\n<h2>\u901a\u8fc7\u6a21\u5757\u6e90\u4ee3\u7801\u4e2d\u7684\u6ce8\u91ca\u751f\u6210\u6587\u6863\u6587\u4ef6\u3002<\/h2>\n<p>\u6709\u4e00\u4e2a\u540d\u4e3adocs\u7684\u76ee\u5f55\u4f5c\u4e3a\u6a21\u677f\u6b63\u5728\u521b\u5efa\uff0c\u6211\u4eec\u5728\u8fd9\u91cc\u4e3a\u6bcf\u4e2a\u63d2\u4ef6\u7684\u6587\u6863\u201c\u9664\u4e86\u5728\u6a21\u5757\u6e90\u4ee3\u7801\u4e2d\u6307\u5b9a\u7684\u6ce8\u91ca\u4e4b\u5916\u201d\u63d0\u4f9b\u4e86\u53e6\u5916\u7684\u51c6\u5907\u3002\u867d\u7136\u5e94\u8be5\u81ea\u52a8\u5316\u751f\u6210\uff0c\u4f46\u6211\u6682\u65f6\u4e0d\u77e5\u9053\u8be5\u600e\u4e48\u505a\uff0c\u4e0d\u8fc7\u5728Ansible Advent Calendar\u7b2c12\u5929\uff0csky_joker\u5148\u751f\u5df2\u7ecf\u521b\u5efa\u4e86\u4e00\u7bc7\u5f88\u68d2\u7684\u6587\u7ae0\u3002<\/p>\n<p>\u81ea\u52a8\u751f\u6210Ansible Collections\u6a21\u5757\u6587\u6863 | \u65e5\u5e38\u6280\u672f\u5de5\u7a0b\u5e08\u7684\u6280\u672f\u535a\u5ba2<\/p>\n<p>\u60a8\u53ef\u4ee5\u4f7f\u7528\u4e00\u4e2a\u540d\u4e3acollection_prep\u7684\u5de5\u5177\u4ee5rst\u683c\u5f0f\u751f\u6210\u6587\u6863\u3002<\/p>\n<p>\u987a\u4fbf\u8bf4\u4e00\u4e0b\uff0c\u5728\u6211\u624b\u4e0a\u7684\u73af\u5883\u4e2d\u3002<\/p>\n<pre class=\"post-pre\"><code>docker run -itd --name py38 -v $PWD:\/usr\/src\/work --rm python:3.8\r\n<\/code><\/pre>\n<p>\u4f5c\u4e3a\u89e3\u51b3\u65b9\u6cd5\uff0c\u6211\u4eec\u914d\u7f6e\u4e86\u4e00\u4e2a\u5bb9\u5668\u5185\u7684\u5377\uff0c\u53ef\u4ee5\u8bbf\u95ee\u672c\u5730\u7684\u5b8c\u6574\u6e90\u4ee3\u7801\uff0c\u5e76\u8fdb\u884c\u4e86\u76f8\u5173\u6587\u6863\u8bb0\u5f55\u3002\u4f46\u9700\u8981\u6ce8\u610f\u7684\u662f\uff0c\u7531\u4e8e\u4ee5root\u6743\u9650\u8fd0\u884c\u7684\u5f71\u54cd\uff0c\u751f\u6210\u7684\u6587\u4ef6\u6240\u6709\u8005\u5c06\u53d8\u4e3aroot\uff0c\u56e0\u6b64\u5728\u8fd9\u65b9\u9762\u8981\u5c0f\u5fc3\u3002\uff08\u5728\u4f7f\u7528git\u5207\u6362\u5206\u652f\u65f6\u5bfc\u81f4\u65e0\u6cd5\u66f4\u6539\u6587\u4ef6\uff57\uff09<\/p>\n<p>\u8fd9\u91cc\u662f\u751f\u6210\u7684\u6587\u4ef6\u3002<\/p>\n<p>\u8bf7\u53c2\u8003\u4ee5\u4e0b\u5185\u5bb9\u6765\u8fdb\u884c\u5bf9\u6a21\u5757\u6e90\u4ee3\u7801\u7684\u6ce8\u91ca\u3002<\/p>\n<p>\u6a21\u5757\u683c\u5f0f\u548c\u6587\u6863 \u2014 Ansible\u6587\u6863<\/p>\n<h1>\u5728\u6267\u884cAnsible\u65f6\uff0c\u672c\u5730\u5f15\u7528\u96c6\u5408\u3002<\/h1>\n<p>\u73b0\u5728\u5728collections\u76ee\u5f55\u4e0b\u653e\u7f6e\u4e86\u4e00\u4e2a\u540d\u4e3azaki_lknr.esxissh\u7684\u96c6\u5408\uff0c\u5e76\u521b\u5efa\u4e86\u540d\u4e3aesxissh_guest_power\u7684\u6a21\u5757\u3002<br \/>\n\u63a5\u4e0b\u6765\u5c06\u8fdb\u884c\u4f7f\u7528\u8be5\u6a21\u5757\u7684Playbook\u4fee\u6b63\u548c\u914d\u7f6e\u3002<\/p>\n<h2>\u4ee5FQCN\u65b9\u5f0f\u6307\u5b9a\u6a21\u5757\u3002<\/h2>\n<p>\u9996\u5148\uff0c\u5c06\u4f7f\u7528\u73b0\u6709\u6a21\u5757\u7684playbook\u4e2d\u7684\u6a21\u5757\u6307\u5b9a\u90e8\u5206\u66f4\u6539\u4e3aFQCN\u3002<br \/>\n\u901a\u8fc7\u5b8c\u6210\u8fd9\u4e2a\u4fee\u6539\uff0cplaybook\u7684\u7f16\u8f91\u5c31\u5b8c\u6210\u4e86\u3002<\/p>\n<pre class=\"post-pre\"><code><span class=\"gh\">index 43b96ba..d76cb17 100644\r\n<\/span><span class=\"gd\">--- a\/sample-playbook\/create_vm.yml\r\n<\/span><span class=\"gi\">+++ b\/sample-playbook\/create_vm.yml\r\n<\/span><span class=\"p\">@@ -3,7 +3,7 @@<\/span>\r\n\r\n   tasks:\r\n   - name: create vm\r\n<span class=\"gd\">-    esxissh_guest:\r\n<\/span><span class=\"gi\">+    zaki_lknr.esxissh.esxissh_guest:\r\n<\/span>       esxiaddress: '{{ esxiaddr }}'\r\n       esxiusername: '{{ esxiuser }}'\r\n       esxipassword: '{{ esxipass }}'\r\n<\/code><\/pre>\n<h2>\u6307\u5b9a\u96c6\u5408\u7684\u8def\u5f84<\/h2>\n<p>\u5728\u8fd9\u91cc\uff0c\u6211\u4eec\u5df2\u7ecf\u521b\u5efa\u4e86\u4e00\u4e2a\u9009\u62e9\u96c6\u548c\u5176\u4e0b\u7684\u6a21\u5757\u7684\u6307\u5b9a\u5267\u672c\u3002<br \/>\n\u81f3\u4e8e\u5173\u952e\u7684\u201c\u5728\u8fd0\u884c\u65f6\u4f7f\u7528\u6b64\u8def\u5f84\u4e2d\u7684\u96c6\u5408\u201d\u90e8\u5206\uff0c\u5219\u5f88\u5bb9\u6613\u5728ansible.cfg\u4e2d\u8fdb\u884c\u6307\u5b9a\u3002<\/p>\n<p>\u987a\u4fbf\u63d0\u4e00\u4e0b\uff0c\u96c6\u5408\u9ed8\u8ba4\u60c5\u51b5\u4e0b\u4f1a\u67e5\u770bAnsible\u6267\u884c\u65f6\u7528\u6237\u7684$HOME\/.ansible\/collections\u4e4b\u4e0b\u7684\u8bbe\u7f6e\u3002<br \/>\n\u8fd9\u4e00\u70b9\u5728\u4f7f\u7528venv\u65f6\u9700\u8981\u683c\u5916\u6ce8\u610f\uff0c\u56e0\u4e3a\u5b83\u4f1a\u5f15\u7528venv\u73af\u5883\u4e4b\u5916\u7684\u5185\u5bb9\uff0c\u6240\u4ee5\u5728\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u53ef\u80fd\u4f1a\u53d1\u751f\u201c\u867d\u7136\u6253\u7b97\u5728venv\u73af\u5883\u4e2d\u5207\u5272\u73af\u5883\uff0c\u5374\u5728\u591a\u4e2avenv\u73af\u5883\u4e2d\u67e5\u770b\u5230\u76f8\u540c\u90e8\u5206\u201d\u7684\u60c5\u51b5\uff0c\u5982\u679c\u5728\u6ca1\u6709\u7279\u522b\u6307\u5b9a\u8def\u5f84\u8bbe\u7f6e\u7684\u60c5\u51b5\u4e0b\u4f7f\u7528ansible-galaxy collection install\u8fdb\u884c\u5b89\u88c5\uff0c\u53ef\u80fd\u4f1a\u6df7\u5408\u73af\u5883\u3002<\/p>\n<p>\u8bf4\u5230\u8be5\u600e\u4e48\u529e\uff0c\u6211\u5efa\u8bae\u5728ansible.cfg\u4e2d<\/p>\n<pre class=\"post-pre\"><code><span class=\"py\">collections_path<\/span> <span class=\"p\">=<\/span> <span class=\"s\">\/home\/zaki\/src\/esxi-ansible\/collections\/<\/span>\r\n<\/code><\/pre>\n<p>\u5982\u679c\u6309\u7167\u8fd9\u6837\u7684\u63cf\u8ff0\u8fdb\u884c\uff0c\u5c06\u4f1a\u5f15\u7528\u6307\u5b9a\u8def\u5f84\u7684\u96c6\u5408\u800c\u4e0d\u662f$HOME\/.ansible\u3002<br \/>\n\u5728\u8fd9\u91cc\u6307\u5b9a\u7684\u8def\u5f84\u4e0b\u9762\uff0c\u5c06\u4f1a\u6709ansible_collections\/\/\/\uff0c\u5176\u4e0b\u9762\u6709plugins\/modules\/.py\u7684\u914d\u7f6e\u3002<\/p>\n<pre class=\"post-pre\"><code>\/home\/zaki\/src\/esxi-ansible\/collections\/\r\n\u2514\u2500\u2500 ansible_collections\r\n    \u2514\u2500\u2500 zaki_lknr\r\n        \u2514\u2500\u2500 esxissh\r\n            \u251c\u2500\u2500 README.md\r\n            \u251c\u2500\u2500 docs\r\n            \u251c\u2500\u2500 galaxy.yml\r\n            \u251c\u2500\u2500 plugins\r\n            \u2502   \u251c\u2500\u2500 README.md\r\n            \u2502   \u251c\u2500\u2500 module_utils\r\n            \u2502   \u2502   \u2514\u2500\u2500 esxissh.py\r\n            \u2502   \u2514\u2500\u2500 modules\r\n            \u2502       \u251c\u2500\u2500 esxissh_guest.py\r\n            \u2502       \u2514\u2500\u2500 esxissh_guest_power.py\r\n            \u2514\u2500\u2500 roles\r\n<\/code><\/pre>\n<h2>\u8fd0\u884c\u4f7f\u7528\u81ea\u5df1\u521b\u5efa\u7684\u6a21\u5757\u7684Ansible Playbook\u3002<\/h2>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">playbook\u304b\u3089FQCN\u3067\u30e2\u30b8\u30e5\u30fc\u30eb\u6307\u5b9a<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\u30b3\u30ec\u30af\u30b7\u30e7\u30f3\u306e\u30d1\u30b9\u3092ansible.cfg\u306ecollections_path\u3067\u6307\u5b9a<\/ul>\n<p>\u5728\u8fd9\u4e24\u4e2a\u65b9\u9762\uff0c\u4f60\u53ef\u4ee5\u4eceplaybook\u4e2d\u5f15\u7528\u4efb\u4f55\u8def\u5f84\u4e2d\u7684\u96c6\u5408\u6a21\u5757\uff0c\u56e0\u6b64\u53ef\u4ee5\u4f7f\u7528\u81ea\u5b9a\u4e49\u7684\u96c6\u5408\u6a21\u5757\u6765\u6267\u884cansible-playbook\u3002<\/p>\n<h1>\u5bf9\u73b0\u5728\u4e3a\u6b62\u7684\u603b\u7ed3<\/h1>\n<p>\u603b\u7ed3\u5230\u8fd9\u91cc\u5982\u4e0b\u6240\u793a\u3002<\/p>\n<p>ansible-galaxy collection init . &#8211;init-path \/path\/to\u3067\u3072\u306a\u5f62\u4f5c\u6210<\/p>\n<p>ansible.cfg\u3067collections_path\u3092\u6307\u5b9a<\/p>\n<p>collections_path\u306e\u30d1\u30b9\u4ee5\u4e0b\u306b\u30b3\u30ec\u30af\u30b7\u30e7\u30f3\u3092\u914d\u7f6e<br \/>\nPlaybook\u3067\u306fFQCN\u3067\u30e2\u30b8\u30e5\u30fc\u30eb\u540d\u3092\u6307\u5b9a<\/p>\n<p>\u5982\u679c\u5728\u4e2a\u4eba\u73af\u5883\u4e2d\uff0c\u540c\u65f6\u8fdb\u884cPlaybook\u7684\u521b\u5efa\u548c\u6536\u96c6\uff0c\u5e76\u4e14\u4e0d\u8fdb\u884c\u6536\u96c6\u7684\u5206\u53d1\u7b49\u64cd\u4f5c\uff0c\u6211\u8ba4\u4e3a\u8fd9\u6837\u662f\u53ef\u884c\u7684\u3002<\/p>\n<h1>\u53d1\u653e<\/h1>\n<h2>\u5c06\u6536\u85cf\u54c1\u8fdb\u884c\u5305\u88c5<\/h2>\n<p>\u8981\u521b\u5efa\u5206\u53d1\u7528\u7684\u5305\uff0c\u53ef\u4ee5\u4f7f\u7528ansible-galaxy collection build\u547d\u4ee4\u3002\u9700\u8981\u6307\u5b9a\u96c6\u5408\u7684\u8def\u5f84\uff08\u5230&lt;\u547d\u540d\u7a7a\u95f4&gt;.&lt;\u96c6\u5408&gt;\u76ee\u5f55\u4e3a\u6b62\uff0c\u8be5\u8def\u5f84\u4e0b\u5e94\u8be5\u6709galaxy.yml\u6587\u4ef6\uff09\u4f5c\u4e3a\u53c2\u6570\u3002\uff08\u5982\u679c\u7701\u7565\uff0c\u5219\u5047\u5b9a\u5728\u5f53\u524d\u76ee\u5f55\u4e2d\u5b58\u5728galaxy.yml\u6587\u4ef6\uff09<\/p>\n<p>\u6700\u591a\u53ea\u9700\u8981\u4e00\u4e2a\u9009\u9879\uff1a\u6536\u85cf\u7684\u661f\u7cfb\u5143\u6570\u636e\u7ed3\u6784 \u2014 Ansible\u6587\u6863<\/p>\n<p>\u53e6\u5916\uff0c\u8fd8\u9700\u8981\u521b\u5efa\u4e00\u4e2a\u88ab\u79f0\u4e3agalaxy.yml\u7684\u5305\u88c5\u6587\u4ef6\uff0c\u5373\u6240\u8c13\u7684\u6e05\u5355\u6587\u4ef6\uff08\u6839\u636e\u6a21\u677f\u521b\u5efa\u5e76\u586b\u5199\u76f8\u5e94\u90e8\u5206\uff09\u3002<\/p>\n<p>\u6211\u8ba4\u4e3a\uff0c\u67e5\u770b\u5185\u5bb9\u662f\u6700\u5feb\u7684\u65b9\u6cd5\uff0c\u4f46\u5728Galaxy\u7684\u9875\u9762\u4e0a\uff0c\u9700\u8981\u8bb0\u5f55\u5e93\u548c\u95ee\u9898\u7684\u94fe\u63a5\uff0c\u4ee5\u53ca\u6536\u96c6\u540d\u79f0\u3001\u7248\u672c\u7b49\u5b9a\u4e49\u3002\u60a8\u8fd8\u53ef\u4ee5\u5728\u5305\u88c5\u65f6\u6307\u5b9a\u8981\u6392\u9664\u7684\u6587\u4ef6\uff0c\u56e0\u6b64\u6700\u597d\u6392\u9664\u7279\u5b9a\u73af\u5883\u6587\u4ef6\u3001\u4e2d\u95f4\u6587\u4ef6\u548cvenv\u76ee\u5f55\u7b49\u3002<\/p>\n<p>\u4ee5\u4e0b\u662fgalaxy.yml\u6587\u4ef6\u7684\u4e3b\u8981\u63cf\u8ff0\u90e8\u5206\u3002<\/p>\n<div>\n<div class=\"post-table\">itemdescriptionnamespaceGalaxy\u4e0a\u306e\u30cd\u30fc\u30e0\u30b9\u30da\u30fc\u30b9(\u30a2\u30ab\u30a6\u30f3\u30c8\u540d)name\u30b3\u30ec\u30af\u30b7\u30e7\u30f3\u540dversion\u30b3\u30ec\u30af\u30b7\u30e7\u30f3\u30d0\u30fc\u30b8\u30e7\u30f3 (\u6570\u5024\u3067<code>x.y.z<\/code>\u5f62\u5f0f)readmeGalaxy\u7528readme\u30d5\u30a1\u30a4\u30eb\u306e\u30d1\u30b9author\u30b3\u30ec\u30af\u30b7\u30e7\u30f3\u4f5c\u6210\u8005(\u30ea\u30b9\u30c8\u5f62\u5f0f)repository\u30bd\u30fc\u30b9\u306e\u30ea\u30dd\u30b8\u30c8\u30eaURLissuesIssue\u306eURLbuild_ignore<code>collectoin build<\/code>\u6642\u306b\u9664\u304f\u30d5\u30a1\u30a4\u30eb\u30d1\u30bf\u30fc\u30f3<\/div>\n<\/div>\n<p>\u5f53\u51c6\u5907\u597d\u540e\uff0c\u8bf7\u6267\u884cansible-galaxy collection build &lt;\u8def\u5f84&gt;\u3002<\/p>\n<pre class=\"post-pre\"><code>(2.10) [zaki@cloud-dev esxi-ansible (features\/collections)]$ ansible-galaxy collection build collections\/ansible_collections\/zaki_lknr\/esxissh\/\r\nCreated collection for zaki_lknr.esxissh at \/home\/zaki\/src\/esxi-ansible\/zaki_lknr-esxissh-1.0.0.tar.gz\r\n<\/code><\/pre>\n<p>\u5f53\u6210\u529f\u65f6\uff0c\u5c06\u5728\u6267\u884c\u76ee\u5f55\u4e2d\u521b\u5efa\u4e00\u4e2a\u540d\u4e3a&#8211;.tar.gz\u7684\u96c6\u5408\u3002(&#8211;output-path \/path\/to\u53ef\u66f4\u6539\u8f93\u51fa\u8def\u5f84)<br \/>\n\u987a\u4fbf\u63d0\u4e00\u4e0b\uff0c\u5176\u5185\u5bb9\u5927\u81f4\u5982\u4e0b\u3002<\/p>\n<pre class=\"post-pre\"><code>(2.10) [zaki@cloud-dev esxi-ansible (features\/collections)]$ tar tf zaki_lknr-esxissh-1.0.0.tar.gz \r\nMANIFEST.json\r\nFILES.json\r\ndocs\/\r\nroles\/\r\nREADME.md\r\nplugins\/\r\nplugins\/README.md\r\nplugins\/module_utils\/\r\nplugins\/module_utils\/esxissh.py\r\nplugins\/modules\/\r\nplugins\/modules\/esxissh_guest.py\r\nplugins\/modules\/esxissh_guest_power.py\r\n<\/code><\/pre>\n<h2>\u4ece\u6587\u4ef6\u4e2d\u5b89\u88c5\u6253\u5305\u96c6\u5408\u3002<\/h2>\n<p>\u60a8\u53ef\u4ee5\u901a\u8fc7\u6307\u5b9a\u672c\u5730\u6587\u4ef6\u8fdb\u884c\u5b89\u88c5\uff0c\u800c\u65e0\u9700\u4f7f\u7528Ansible Galaxy\u6765\u5b89\u88c5\u96c6\u5408\u3002<\/p>\n<pre class=\"post-pre\"><code> (venv) [zaki@cloud-dev esxissh]$ ansible-galaxy collection -h\r\nusage: ansible-galaxy collection [-h] COLLECTION_ACTION ...\r\n\r\npositional arguments:\r\n  COLLECTION_ACTION\r\n    ...\r\n\r\n    install          Install collection(s) from file(s), URL(s) or Ansible\r\n                     Galaxy\r\n<\/code><\/pre>\n<p>\u4e3a\u4e86\u8bd5\u7528\uff0c\u65b0\u5efa\u4e00\u4e2a\u4e0d\u540c\u7684\u8def\u5f84\u6765\u521b\u5efa\u73af\u5883\u5e76\u653e\u7f6e\u6587\u4ef6\u3002<\/p>\n<pre class=\"post-pre\"><code>(venv) [zaki@cloud-dev esxissh]$ ls -F\r\nvenv\/  zaki_lknr-esxissh-1.0.0.tar.gz\r\n(venv) [zaki@cloud-dev esxissh]$ which ansible-galaxy\r\n~\/src\/tmp\/esxissh\/venv\/bin\/ansible-galaxy\r\n<\/code><\/pre>\n<p>\u5982\u679c\u4e0d\u6307\u5b9a\u5b89\u88c5\u76ee\u5f55\uff0c\u90a3\u4e48\u5982\u524d\u6240\u8ff0\uff0c\u9ed8\u8ba4\u5b89\u88c5\u5728$HOME\/.ansible\/\u4e0b\u9762\uff0c\u56e0\u6b64\u5728\u8fd9\u91cc\u6211\u4eec\u4f7f\u7528-p\u9009\u9879\u6307\u5b9a\u5f53\u524d\u7684collections\u3002<\/p>\n<pre class=\"post-pre\"><code>(venv) [zaki@cloud-dev esxissh]$ ansible-galaxy collection install zaki_lknr-esxissh-1.0.0.tar.gz -p collections\r\nStarting galaxy collection install process\r\n[WARNING]: The specified collections path '\/home\/zaki\/src\/tmp\/esxissh\/collections' is not part of the configured Ansible\r\ncollections paths '\/home\/zaki\/.ansible\/collections:\/usr\/share\/ansible\/collections'. The installed collection won't be picked up\r\nin an Ansible run.\r\nProcess install dependency map\r\nStarting collection install process\r\nInstalling 'zaki_lknr.esxissh:1.0.0' to '\/home\/zaki\/src\/tmp\/esxissh\/collections\/ansible_collections\/zaki_lknr\/esxissh'\r\nzaki_lknr.esxissh (1.0.0) was installed successfully\r\n(venv) [zaki@cloud-dev esxissh]$ ls -F\r\ncollections\/  venv\/  zaki_lknr-esxissh-1.0.0.tar.gz\r\n<\/code><\/pre>\n<p>\u5df2\u6309\u7167\u8981\u6c42\u8fdb\u884c\u4e86\u5b89\u88c5\u3002<\/p>\n<pre class=\"post-pre\"><code>(venv) [zaki@cloud-dev esxissh]$ tree collections\/\r\ncollections\/\r\n\u2514\u2500\u2500 ansible_collections\r\n    \u2514\u2500\u2500 zaki_lknr\r\n        \u2514\u2500\u2500 esxissh\r\n            \u251c\u2500\u2500 FILES.json\r\n            \u251c\u2500\u2500 MANIFEST.json\r\n            \u251c\u2500\u2500 README.md\r\n            \u251c\u2500\u2500 docs\r\n            \u251c\u2500\u2500 plugins\r\n            \u2502   \u251c\u2500\u2500 README.md\r\n            \u2502   \u251c\u2500\u2500 module_utils\r\n            \u2502   \u2502   \u2514\u2500\u2500 esxissh.py\r\n            \u2502   \u2514\u2500\u2500 modules\r\n            \u2502       \u251c\u2500\u2500 esxissh_guest.py\r\n            \u2502       \u2514\u2500\u2500 esxissh_guest_power.py\r\n            \u2514\u2500\u2500 roles\r\n\r\n8 directories, 7 files\r\n<\/code><\/pre>\n<h2>\u4ece\u4efb\u610f\u7684HTTP\u670d\u52a1\u5668\u8fdb\u884c\u5b89\u88c5<\/h2>\n<p>\u5982\u679c\u5c06\u96c6\u5408\u6587\u4ef6\u653e\u7f6e\u5728\u672c\u5730\u7f51\u7edc\u5185\u7684Web\u670d\u52a1\u5668\u4e0a\u7684\u7c7b\u4f3c\u4e8ehttp:\/\/192.168.0.19\/ansible\/zaki_lknr-esxissh-1.0.0.tar.gz\u7684\u4f4d\u7f6e\uff0c\u5c31\u53ef\u4ee5\u901a\u8fc7URL\u6307\u5b9a\u8fdb\u884c\u5b89\u88c5\u3002<\/p>\n<pre class=\"post-pre\"><code>(venv) [zaki@cloud-dev esxissh]$ ansible-galaxy collection install http:\/\/192.168.0.19\/ansible\/zaki_lknr-esxissh-1.0.0.tar.gz -p collections\r\nStarting galaxy collection install process\r\n[WARNING]: The specified collections path '\/home\/zaki\/src\/tmp\/esxissh\/collections' is not part of the configured Ansible\r\ncollections paths '\/home\/zaki\/.ansible\/collections:\/usr\/share\/ansible\/collections'. The installed collection won't be picked up\r\nin an Ansible run.\r\nProcess install dependency map\r\nDownloading http:\/\/192.168.0.19\/ansible\/zaki_lknr-esxissh-1.0.0.tar.gz to \/home\/zaki\/.ansible\/tmp\/ansible-local-3625522b6vz_fk\/tmpng661w25\r\nStarting collection install process\r\nInstalling 'zaki_lknr.esxissh:1.0.0' to '\/home\/zaki\/src\/tmp\/esxissh\/collections\/ansible_collections\/zaki_lknr\/esxissh'\r\nzaki_lknr.esxissh (1.0.0) was installed successfully\r\n(venv) [zaki@cloud-dev esxissh]$ ls\r\ncollections  venv\r\n(venv) [zaki@cloud-dev esxissh]$ tree collections\/\r\ncollections\/\r\n\u2514\u2500\u2500 ansible_collections\r\n    \u2514\u2500\u2500 zaki_lknr\r\n        \u2514\u2500\u2500 esxissh\r\n            \u251c\u2500\u2500 FILES.json\r\n            \u251c\u2500\u2500 MANIFEST.json\r\n            \u251c\u2500\u2500 README.md\r\n            \u251c\u2500\u2500 docs\r\n            \u251c\u2500\u2500 plugins\r\n            \u2502   \u251c\u2500\u2500 README.md\r\n            \u2502   \u251c\u2500\u2500 module_utils\r\n            \u2502   \u2502   \u2514\u2500\u2500 esxissh.py\r\n            \u2502   \u2514\u2500\u2500 modules\r\n            \u2502       \u251c\u2500\u2500 esxissh_guest.py\r\n            \u2502       \u2514\u2500\u2500 esxissh_guest_power.py\r\n            \u2514\u2500\u2500 roles\r\n\r\n8 directories, 7 files\r\n(venv) [zaki@cloud-dev esxissh]$ \r\n<\/code><\/pre>\n<p>\u6211\u8ba4\u4e3a\u5728\u79c1\u4eba\u7f51\u7edc\u4e0a\u4f7f\u7528\u4e1a\u52a1\u4e2d\u521b\u5efa\u7684\u96c6\u5408\uff0c\u5982\u591a\u4e2a\u4e3b\u673a\u7b49\uff0c\u975e\u5e38\u65b9\u4fbf\u3002<\/p>\n<h2>\u5728Ansible Galaxy\u4e0a\u53d1\u5e03<\/h2>\n<p>\u901a\u8fc7\u5c06\u5176\u4e0a\u4f20\u5230Ansible Galaxy\u4e2d\u7684\u4e2a\u4eba\u547d\u540d\u7a7a\u95f4\uff0c\u60a8\u4e5f\u53ef\u4ee5\u5c06\u5176\u516c\u5f00\u7ed9\u5168\u4e16\u754c\u3002<\/p>\n<div><img decoding=\"async\" class=\"post-images\" title=\"\" src=\"https:\/\/cdn.silicloud.com\/blog-img\/blog\/img\/657d4c4937434c4406cb9ebd\/105-0.png\" alt=\"image.png\" \/><\/div>\n<p>\u70b9\u51fb\u300c\u6dfb\u52a0\u5185\u5bb9\u300d<\/p>\n<div><img decoding=\"async\" class=\"post-images\" title=\"\" src=\"https:\/\/cdn.silicloud.com\/blog-img\/blog\/img\/657d4c4937434c4406cb9ebd\/107-0.png\" alt=\"image.png\" \/><\/div>\n<p>\u300c\u4eceGitHub\u5bfc\u5165\u89d2\u8272\u300d<\/p>\n<blockquote><p>\u9057\u7559\u89d2\u8272\u5bfc\u5165\u3002\u4e0d\u652f\u6301\u96c6\u5408\u683c\u5f0f\u3002<\/p><\/blockquote>\n<p>\u770b\u8d77\u6765\u4e0d\u80fd\u8bbe\u7f6e\u5b58\u50a8\u5e93\u7684\u6536\u85cf\u5939\u914d\u7f6e\u3002<br \/>\n\u6240\u4ee5\u8bf7\u6309\u4e0b\u201c\u4e0a\u4f20\u65b0\u6536\u85cf\u5939\u201d\u6309\u94ae\uff0c\u5e76\u4e0a\u4f20\u5df2\u521b\u5efa\u7684\u6536\u85cf\u5939\u7684\u5305\u6587\u4ef6&#8230;<\/p>\n<div><img decoding=\"async\" class=\"post-images\" title=\"\" src=\"https:\/\/cdn.silicloud.com\/blog-img\/blog\/img\/657d4c4937434c4406cb9ebd\/111-0.png\" alt=\"image.png\" \/><\/div>\n<p>\u65e0\u8bba\u505a\u4ec0\u4e48\uff0c\u90fd\u4f1a\u663e\u793a\u201c\u6587\u4ef6\u683c\u5f0f\u65e0\u6548\u201d\uff0c\u5c31\u65e0\u6cd5\u6b63\u5e38\u8fdb\u884c\u4e86\u3002\u3002\u3002<\/p>\n<p>\u6240\u4ee5\u6211\u4f1a\u5c1d\u8bd5\u901a\u8fc7CLI\u4e0a\u4f20\u3002<\/p>\n<p>\u5728\u4f7f\u7528ansible-galaxy\u547d\u4ee4\u8fdb\u884c\u4e0a\u4f20\u64cd\u4f5c\u65f6\uff0c\u9700\u8981\u6307\u5b9a\u4e0a\u4f20\u7528\u7684\u4ee4\u724c\u3002<br \/>\n\u8fd9\u4e2a\u4ee4\u724c\u53ef\u4ee5\u4ece\u767b\u5f55\u9875\u9762\u53f3\u4e0a\u89d2\u7684\u201cPreferences\u201d\u4e2d\u83b7\u53d6\u3002<\/p>\n<div><img decoding=\"async\" class=\"post-images\" title=\"\" src=\"https:\/\/cdn.silicloud.com\/blog-img\/blog\/img\/657d4c4937434c4406cb9ebd\/115-0.png\" alt=\"image.png\" \/><\/div>\n<p>\u5f53\u6253\u5f00Preferences\u9875\u9762\u65f6\uff0c\u901a\u8fc7\u70b9\u51fb\u5c4f\u5e55\u4e0a\u7684&#8221;Show API Key&#8221;\u6309\u94ae\uff0c\u53ef\u4ee5\u663e\u793aAPI\u5bc6\u94a5\u3002<\/p>\n<div><img decoding=\"async\" class=\"post-images\" title=\"\" src=\"https:\/\/cdn.silicloud.com\/blog-img\/blog\/img\/657d4c4937434c4406cb9ebd\/117-0.png\" alt=\"image.png\" \/><\/div>\n<p>\u53ea\u9700\u63d0\u4f9b\u8fd9\u4e2aAPI\u5bc6\u94a5\u4f5c\u4e3a&#8211;token=\u9009\u9879\uff0c\u5e76\u5c06\u6253\u5305\u4e3atar.gz\u6587\u4ef6\u7684ansible-galaxy collection publish\u4f5c\u4e3a\u53c2\u6570\u6267\u884c\u3002<\/p>\n<pre class=\"post-pre\"><code>(2.10) [zaki@cloud-dev tmp (fix\/collection-structure-dirs)]$ ansible-galaxy collection publish --token=${GALAXY_API_TOKEN} zaki_lknr-esxissh-1.0.0.tar.gz \r\nPublishing collection artifact '\/home\/zaki\/src\/esxi-ansible\/tmp\/zaki_lknr-esxissh-1.0.0.tar.gz' to default https:\/\/galaxy.ansible.com\/api\/\r\nCollection has been published to the Galaxy server default https:\/\/galaxy.ansible.com\/api\/\r\nWaiting until Galaxy import task https:\/\/galaxy.ansible.com\/api\/v2\/collection-imports\/6382\/ has completed\r\nCollection has been successfully published and imported to the Galaxy server default https:\/\/galaxy.ansible.com\/api\/\r\n(2.10) [zaki@cloud-dev tmp (fix\/collection-structure-dirs)]$ echo $?\r\n0\r\n<\/code><\/pre>\n<p>\u4e0a\u4f20\u6210\u529f\u3002<\/p>\n<div><img decoding=\"async\" class=\"post-images\" title=\"\" src=\"https:\/\/cdn.silicloud.com\/blog-img\/blog\/img\/657d4c4937434c4406cb9ebd\/121-0.png\" alt=\"2020-11-28_19h07_33.png\" \/><\/div>\n<p>\u8fd9\u91cc\u662f\u5b9e\u9645\u6536\u85cf\u9875\u9762\u3002<\/p>\n<p>\u8bf7\u53c2\u8003\u201c\u4f7f\u7528ESXi\u4e0a\u7684vim-cmd\u547d\u4ee4\u8fdb\u884cVM\u64cd\u4f5c\u7684Ansible\u96c6\u5408\uff08\u53ef\u4f9b\u514d\u8d39\u8bb8\u53ef\u8bc1\u4f7f\u7528\uff09\u201d\u6765\u4e86\u89e3\u5982\u4f55\u4f7f\u7528\u8fd9\u4e2a\u96c6\u5408\u3002<\/p>\n<p>\u4e0a\u4f20\u540e\u4f60\u4f1a\u53d1\u73b0\uff0c\u5c4f\u5e55\u53f3\u4e0a\u89d2\u7684&#8221;Repo&#8221;\u6216&#8221;Issue Tracker&#8221;\u6309\u94ae\u94fe\u63a5\u5230\u7684\u76ee\u6807\uff0c\u4ee5\u53ca&#8221;Read Me&#8221;\u4e2d\u663e\u793a\u7684\u5185\u5bb9\u548c&#8221;Content&#8221;\u4e2d\u5217\u51fa\u7684\u9879\u76ee\uff0c\u90fd\u663e\u793a\u4e86galaxy.yml\u6587\u4ef6\u548c\u5305\u542b\u5728\u96c6\u5408\u4e2d\u7684\u63d2\u4ef6\u7c7b\u522b\u3002<\/p>\n<div><img decoding=\"async\" class=\"post-images\" title=\"\" src=\"https:\/\/cdn.silicloud.com\/blog-img\/blog\/img\/657d4c4937434c4406cb9ebd\/126-0.png\" alt=\"image.png\" \/><\/div>\n<h3>\u641e\u7838\u4e86 z\u0101 le)<\/h3>\n<p>\u7528\u6237\u65e0\u6cd5\u5220\u9664\u5728Galaxy\u4e0a\u4e0a\u4f20\u7684\u6536\u85cf\u54c1\u3002\uff08\u53ef\u80fd\u7684\u8bdd\uff09<br \/>\n\u81f3\u5c11\u76ee\u524d\u6ca1\u6709\u4efb\u4f55\u5220\u9664\u6309\u94ae\u6216\u7c7b\u4f3c\u9009\u9879\uff0c\u4f46\u641c\u7d22\u95ee\u9898\u53ef\u4ee5\u627e\u5230\u4e00\u4e9b\u5220\u9664\u8bf7\u6c42\u3002<\/p>\n<p>\u56e0\u6b64\uff0c\u5728\u6784\u5efa\u65f6\uff0c\u9700\u8981\u5145\u5206\u786e\u8ba4\u662f\u5426\u5305\u542b\u4e86\u4e0d\u5e94\u8be5\u5305\u542b\u7684\u6587\u4ef6\u3002\u3002\u3002(\u7ffb\u8bd1: \u867d\u7136\u5df2\u7ecf\u8bbe\u7f6e\u4e86.gitignore\uff0c\u4f46\u4e0egalaxy\u7684\u6784\u5efa\u65e0\u5173\uff0c\u6240\u4ee5\u758f\u5ffd\u5927\u610f\u4e86\uff0c\u5c31\u662f\u8fd9\u4e2a\u610f\u601d\u2190)<\/p>\n<p>\u53e6\u5916\uff0c\u53ef\u4ee5\u901a\u8fc7galaxy.yml\u7684build_ignore:\u6307\u5b9a\u8981\u4ece\u6784\u5efa\u4e2d\u6392\u9664\u7684\u6587\u4ef6\u3002<br \/>\n\u6211\u4eec\u53ef\u4ee5\u6307\u5b9avenv\u3001*.tmp\u3001*.bak\u7b49\u6587\u4ef6\u3002<br \/>\n\uff08\u203b \u7531\u4e8e\u53ef\u4e0a\u4f20\u7684\u8f6f\u4ef6\u5305\u5927\u5c0f\u6700\u5927\u4e3a2MB\uff0c\u56e0\u6b64\u5982\u679c\u5305\u542bvenv\uff0c\u4e0a\u4f20\u51e0\u4e4e\u80af\u5b9a\u4f1a\u5931\u8d25\uff09<\/p>\n<p>\u6709\u65f6\u5019\uff0c\u6709\u5173\u5220\u9664Issue\u7684\u8bf7\u6c42\u53ef\u80fd\u4f1a\u5728\u4e00\u5929\u5185\u5f97\u5230\u5904\u7406\uff0c\u4f46\u4e5f\u6709\u53ef\u80fd\u4f1a\u88ab\u7ba1\u7406\u5458\u5ffd\u7565\u4e00\u5468\u5de6\u53f3\u5462\u3002\u6240\u4ee5\uff0c\u8bf7\u5927\u5bb6\u5c0f\u5fc3\u4e0d\u8981\u4e0a\u4f20\u6d89\u53ca\u673a\u5bc6\u4fe1\u606f\u7684\u5185\u5bb9\u3002\u8fd9\u662f\u4e2a\u627f\u8bfa\u54e6\uff01<\/p>\n<p>\u540e\u9762\u53ef\u80fd\u4f1a\u5220\u9664\u6574\u4e2a\u96c6\u5408\uff0c\u800c\u4e0d\u4ec5\u4ec5\u662f\u6307\u5b9a\u7248\u672c\uff0c\u6240\u4ee5\u52a1\u5fc5\u8981\u975e\u5e38\u5c0f\u5fc3\u3002\uff08\u672a\u7ecf\u786e\u8ba4\u7684\u4fe1\u606f\uff09<\/p>\n<hr \/>\n<h1>\u53c2\u8003\u6240\u7528\u4e4b\u4e8b\u7269<\/h1>\n<p>\u867d\u7136\u60f3\u8bf4\u8fd9\u662f\u516c\u5f0f\u6587\u6863\uff0c\u4f46\u4ece\u5934\u5f00\u59cb\u987a\u5e8f\u9605\u8bfb\u5e76\u4e0d\u5bb9\u6613\uff0c\u6240\u4ee5\u6211\u53c2\u8003\u4e86\u5b9e\u9645\u53d1\u5e03\u7684\u96c6\u5408\u6587\u6863\u3002\u5c31\u50cfGitHub\u4e0a\u7684\u8fd9\u4e2a\u6e90\u4ee3\u7801\u5bf9\u5e94\u4e86Galaxy\u4e0a\u7684\u90a3\u4e2a\u90e8\u5206\u4e00\u6837\u3002<\/p>\n<p>\u5f53\u6211\u67e5\u770b\u5b98\u65b9\u6587\u6863\u540e\uff0c\u5f88\u5bb9\u6613\u7406\u89e3\u4e86\u3002<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">\u30b3\u30ec\u30af\u30b7\u30e7\u30f3\u3084\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u306e\u5b9f\u88c5\u4f8b<\/ul>\n<\/li>\n<\/ul>\n<p>F5<\/p>\n<p>Ansible Galaxy<br \/>\nF5Networks\/f5-beacon<\/p>\n<p>netbox<\/p>\n<p>Ansible Galaxy<br \/>\nnetbox-community\/ansible_modules: Netbox modules for Ansible using Ansible Collections<\/p>\n<p>VMware<\/p>\n<p>Ansible Galaxy<br \/>\nansible-collections\/community.vmware: Ansible Collection for VMWare<\/p>\n<p>Ansible\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8<\/p>\n<p>Developer Guide \u2014 Ansible Documentation<\/p>\n<p>Ansible module development: getting started \u2014 Ansible Documentation<\/p>\n<p>\u30e2\u30b8\u30e5\u30fc\u30eb\u4f5c\u6210\u4f8b<\/p>\n<p>Module format and documentation \u2014 Ansible Documentation<\/p>\n<p>\u30e2\u30b8\u30e5\u30fc\u30eb\u4f5c\u6210\u6642\u306e\u66f8\u5f0f\u3084\u30b3\u30e1\u30f3\u30c8\u306e\u66f8\u304d\u65b9<\/p>\n<p>Collection Galaxy metadata structure \u2014 Ansible Documentation<\/p>\n<p>galaxy.yml\u306e\u66f8\u304d\u65b9<\/p>\n<p>Creating a new collection \u2014 Ansible Documentation<\/p>\n<p>\u547d\u540d\u898f\u5247\u306a\u3069\u3002\u3002\u3002\u3053\u3053\u306f\u3082\u3057\u304b\u3059\u308b\u3068\u30b3\u30f3\u30c8\u30ea\u30d3\u30e5\u30fc\u30c8\u3059\u308b\u305f\u3081\u306e\u60c5\u5831\u304b\u3082<\/p>\n<p>Developing collections \u2014 Ansible Documentation<\/p>\n<p>\u30b3\u30ec\u30af\u30b7\u30e7\u30f3\u306e\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u69cb\u9020\u3084\u30d5\u30a1\u30a4\u30eb\u3001ansible-galaxy\u306e\u4f7f\u3044\u65b9\u306a\u3069\u3001\u30b3\u30ec\u30af\u30b7\u30e7\u30f3\u958b\u767a\u5168\u822c<\/p>\n<p>Galaxy Documentation \u2014 Ansible Documentation<\/p>\n<p>Ansible Galaxy\u306e\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8<\/p>\n<p>Sample Ansible setup \u2014 Ansible Documentation<\/p>\n<p>\u73fever\u306eAnsible\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u69cb\u9020\u306a\u3069<\/p>\n<h1>\u8fd9\u6b21\u7684\u6210\u679c<\/h1>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">Ansible Galaxy \/ esxissh &#8211; VM operation on ESXi with enabled SSH<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">zaki-lknr\/esxissh-ansible: ssh\u3092\u6709\u52b9\u306b\u3057\u305fESXi\u3067VM\u64cd\u4f5c\u3059\u308bAnsible\u30e2\u30b8\u30e5\u30fc\u30eb<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>\u672c\u6587\u662f\u300cAnsible Advent Calendar 2020\u300d\u7b2c16\u5929\u7684\u4ecb\u7ecd\u3002 \u8fd9\u7bc7\u6587\u7ae0\u5c06\u8bb2\u8ff0\u6211\u5728\u4e4b\u524d\u7684\u53e6 [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-42361","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] \u5236\u4f5c\u5e76\u5728Galaxy\u4e0a\u53d1\u5e03\u81ea\u5b9a\u4e49\u7684\u96c6\u5408 - 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-\u5236\u4f5c\u5e76\u5728galaxy\u4e0a\u53d1\u5e03\u81ea\u5b9a\u4e49\u7684\u96c6\u5408\/\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"[Ansible] \u5236\u4f5c\u5e76\u5728Galaxy\u4e0a\u53d1\u5e03\u81ea\u5b9a\u4e49\u7684\u96c6\u5408\" \/>\n<meta property=\"og:description\" content=\"\u672c\u6587\u662f\u300cAnsible Advent Calendar 2020\u300d\u7b2c16\u5929\u7684\u4ecb\u7ecd\u3002 \u8fd9\u7bc7\u6587\u7ae0\u5c06\u8bb2\u8ff0\u6211\u5728\u4e4b\u524d\u7684\u53e6 [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.silicloud.com\/zh\/blog\/ansible-\u5236\u4f5c\u5e76\u5728galaxy\u4e0a\u53d1\u5e03\u81ea\u5b9a\u4e49\u7684\u96c6\u5408\/\" \/>\n<meta property=\"og:site_name\" content=\"Blog - Silicon Cloud\" \/>\n<meta property=\"article:published_time\" content=\"2023-12-30T18:41:47+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-05-04T00:21:13+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/cdn.silicloud.com\/blog-img\/blog\/img\/657d4c4937434c4406cb9ebd\/9-0.png\" \/>\n<meta name=\"author\" content=\"\u97f5, \u79d1\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"\u97f5, \u79d1\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"6 \u5206\" \/>\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-%e5%88%b6%e4%bd%9c%e5%b9%b6%e5%9c%a8galaxy%e4%b8%8a%e5%8f%91%e5%b8%83%e8%87%aa%e5%ae%9a%e4%b9%89%e7%9a%84%e9%9b%86%e5%90%88\/\",\"url\":\"https:\/\/www.silicloud.com\/zh\/blog\/ansible-%e5%88%b6%e4%bd%9c%e5%b9%b6%e5%9c%a8galaxy%e4%b8%8a%e5%8f%91%e5%b8%83%e8%87%aa%e5%ae%9a%e4%b9%89%e7%9a%84%e9%9b%86%e5%90%88\/\",\"name\":\"[Ansible] \u5236\u4f5c\u5e76\u5728Galaxy\u4e0a\u53d1\u5e03\u81ea\u5b9a\u4e49\u7684\u96c6\u5408 - Blog - Silicon Cloud\",\"isPartOf\":{\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#website\"},\"datePublished\":\"2023-12-30T18:41:47+00:00\",\"dateModified\":\"2024-05-04T00:21:13+00:00\",\"author\":{\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/6530331a63adef3b3443a1fab53a0e6e\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/ansible-%e5%88%b6%e4%bd%9c%e5%b9%b6%e5%9c%a8galaxy%e4%b8%8a%e5%8f%91%e5%b8%83%e8%87%aa%e5%ae%9a%e4%b9%89%e7%9a%84%e9%9b%86%e5%90%88\/#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.silicloud.com\/zh\/blog\/ansible-%e5%88%b6%e4%bd%9c%e5%b9%b6%e5%9c%a8galaxy%e4%b8%8a%e5%8f%91%e5%b8%83%e8%87%aa%e5%ae%9a%e4%b9%89%e7%9a%84%e9%9b%86%e5%90%88\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/ansible-%e5%88%b6%e4%bd%9c%e5%b9%b6%e5%9c%a8galaxy%e4%b8%8a%e5%8f%91%e5%b8%83%e8%87%aa%e5%ae%9a%e4%b9%89%e7%9a%84%e9%9b%86%e5%90%88\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.silicloud.com\/zh\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"[Ansible] \u5236\u4f5c\u5e76\u5728Galaxy\u4e0a\u53d1\u5e03\u81ea\u5b9a\u4e49\u7684\u96c6\u5408\"}]},{\"@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\/6530331a63adef3b3443a1fab53a0e6e\",\"name\":\"\u97f5, \u79d1\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/429ccb39b3fff5188bc17986222cfb0936cbadb8cc933cff04ab5ca01bd30a08?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/429ccb39b3fff5188bc17986222cfb0936cbadb8cc933cff04ab5ca01bd30a08?s=96&d=mm&r=g\",\"caption\":\"\u97f5, \u79d1\"},\"url\":\"https:\/\/www.silicloud.com\/zh\/blog\/author\/yunke\/\"},{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/ansible-%e5%88%b6%e4%bd%9c%e5%b9%b6%e5%9c%a8galaxy%e4%b8%8a%e5%8f%91%e5%b8%83%e8%87%aa%e5%ae%9a%e4%b9%89%e7%9a%84%e9%9b%86%e5%90%88\/#local-main-organization-logo\",\"url\":\"\",\"contentUrl\":\"\",\"caption\":\"Blog - Silicon Cloud\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"[Ansible] \u5236\u4f5c\u5e76\u5728Galaxy\u4e0a\u53d1\u5e03\u81ea\u5b9a\u4e49\u7684\u96c6\u5408 - 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-\u5236\u4f5c\u5e76\u5728galaxy\u4e0a\u53d1\u5e03\u81ea\u5b9a\u4e49\u7684\u96c6\u5408\/","og_locale":"zh_CN","og_type":"article","og_title":"[Ansible] \u5236\u4f5c\u5e76\u5728Galaxy\u4e0a\u53d1\u5e03\u81ea\u5b9a\u4e49\u7684\u96c6\u5408","og_description":"\u672c\u6587\u662f\u300cAnsible Advent Calendar 2020\u300d\u7b2c16\u5929\u7684\u4ecb\u7ecd\u3002 \u8fd9\u7bc7\u6587\u7ae0\u5c06\u8bb2\u8ff0\u6211\u5728\u4e4b\u524d\u7684\u53e6 [&hellip;]","og_url":"https:\/\/www.silicloud.com\/zh\/blog\/ansible-\u5236\u4f5c\u5e76\u5728galaxy\u4e0a\u53d1\u5e03\u81ea\u5b9a\u4e49\u7684\u96c6\u5408\/","og_site_name":"Blog - Silicon Cloud","article_published_time":"2023-12-30T18:41:47+00:00","article_modified_time":"2024-05-04T00:21:13+00:00","og_image":[{"url":"https:\/\/cdn.silicloud.com\/blog-img\/blog\/img\/657d4c4937434c4406cb9ebd\/9-0.png"}],"author":"\u97f5, \u79d1","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"\u97f5, \u79d1","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"6 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.silicloud.com\/zh\/blog\/ansible-%e5%88%b6%e4%bd%9c%e5%b9%b6%e5%9c%a8galaxy%e4%b8%8a%e5%8f%91%e5%b8%83%e8%87%aa%e5%ae%9a%e4%b9%89%e7%9a%84%e9%9b%86%e5%90%88\/","url":"https:\/\/www.silicloud.com\/zh\/blog\/ansible-%e5%88%b6%e4%bd%9c%e5%b9%b6%e5%9c%a8galaxy%e4%b8%8a%e5%8f%91%e5%b8%83%e8%87%aa%e5%ae%9a%e4%b9%89%e7%9a%84%e9%9b%86%e5%90%88\/","name":"[Ansible] \u5236\u4f5c\u5e76\u5728Galaxy\u4e0a\u53d1\u5e03\u81ea\u5b9a\u4e49\u7684\u96c6\u5408 - Blog - Silicon Cloud","isPartOf":{"@id":"https:\/\/www.silicloud.com\/zh\/blog\/#website"},"datePublished":"2023-12-30T18:41:47+00:00","dateModified":"2024-05-04T00:21:13+00:00","author":{"@id":"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/6530331a63adef3b3443a1fab53a0e6e"},"breadcrumb":{"@id":"https:\/\/www.silicloud.com\/zh\/blog\/ansible-%e5%88%b6%e4%bd%9c%e5%b9%b6%e5%9c%a8galaxy%e4%b8%8a%e5%8f%91%e5%b8%83%e8%87%aa%e5%ae%9a%e4%b9%89%e7%9a%84%e9%9b%86%e5%90%88\/#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.silicloud.com\/zh\/blog\/ansible-%e5%88%b6%e4%bd%9c%e5%b9%b6%e5%9c%a8galaxy%e4%b8%8a%e5%8f%91%e5%b8%83%e8%87%aa%e5%ae%9a%e4%b9%89%e7%9a%84%e9%9b%86%e5%90%88\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.silicloud.com\/zh\/blog\/ansible-%e5%88%b6%e4%bd%9c%e5%b9%b6%e5%9c%a8galaxy%e4%b8%8a%e5%8f%91%e5%b8%83%e8%87%aa%e5%ae%9a%e4%b9%89%e7%9a%84%e9%9b%86%e5%90%88\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.silicloud.com\/zh\/blog\/"},{"@type":"ListItem","position":2,"name":"[Ansible] \u5236\u4f5c\u5e76\u5728Galaxy\u4e0a\u53d1\u5e03\u81ea\u5b9a\u4e49\u7684\u96c6\u5408"}]},{"@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\/6530331a63adef3b3443a1fab53a0e6e","name":"\u97f5, \u79d1","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/429ccb39b3fff5188bc17986222cfb0936cbadb8cc933cff04ab5ca01bd30a08?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/429ccb39b3fff5188bc17986222cfb0936cbadb8cc933cff04ab5ca01bd30a08?s=96&d=mm&r=g","caption":"\u97f5, \u79d1"},"url":"https:\/\/www.silicloud.com\/zh\/blog\/author\/yunke\/"},{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.silicloud.com\/zh\/blog\/ansible-%e5%88%b6%e4%bd%9c%e5%b9%b6%e5%9c%a8galaxy%e4%b8%8a%e5%8f%91%e5%b8%83%e8%87%aa%e5%ae%9a%e4%b9%89%e7%9a%84%e9%9b%86%e5%90%88\/#local-main-organization-logo","url":"","contentUrl":"","caption":"Blog - Silicon Cloud"}]}},"_links":{"self":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts\/42361","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\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/comments?post=42361"}],"version-history":[{"count":2,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts\/42361\/revisions"}],"predecessor-version":[{"id":97203,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts\/42361\/revisions\/97203"}],"wp:attachment":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/media?parent=42361"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/categories?post=42361"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/tags?post=42361"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}