{"id":42801,"date":"2023-03-28T02:37:07","date_gmt":"2024-02-23T23:10:00","guid":{"rendered":"https:\/\/www.silicloud.com\/zh\/blog\/%e4%bd%bf%e7%94%a8vagrant%e7%9a%84%e9%85%8d%e7%bd%ae%e5%b7%a5%e5%85%b7%ef%bc%8c%e5%b0%86ansible%e7%94%a8%e4%bd%9cprovisioner%ef%bc%88%e5%9c%a8windows%e4%b8%8a%e4%bd%bf%e7%94%a8cygwin%e4%bd%9c%e4%b8%ba\/"},"modified":"2024-04-29T20:49:48","modified_gmt":"2024-04-29T12:49:48","slug":"%e4%bd%bf%e7%94%a8vagrant%e7%9a%84%e9%85%8d%e7%bd%ae%e5%b7%a5%e5%85%b7%ef%bc%8c%e5%b0%86ansible%e7%94%a8%e4%bd%9cprovisioner%ef%bc%88%e5%9c%a8windows%e4%b8%8a%e4%bd%bf%e7%94%a8cygwin%e4%bd%9c%e4%b8%ba","status":"publish","type":"post","link":"https:\/\/www.silicloud.com\/zh\/blog\/%e4%bd%bf%e7%94%a8vagrant%e7%9a%84%e9%85%8d%e7%bd%ae%e5%b7%a5%e5%85%b7%ef%bc%8c%e5%b0%86ansible%e7%94%a8%e4%bd%9cprovisioner%ef%bc%88%e5%9c%a8windows%e4%b8%8a%e4%bd%bf%e7%94%a8cygwin%e4%bd%9c%e4%b8%ba\/","title":{"rendered":"\u4f7f\u7528Vagrant\u7684\u914d\u7f6e\u5de5\u5177\uff0c\u5c06Ansible\u7528\u4f5cProvisioner\uff08\u5728Windows\u4e0a\u4f7f\u7528Cygwin\u4f5c\u4e3aControl Machine\uff09"},"content":{"rendered":"<p>\u76ee\u524d\uff08\u7248\u672c1.8.4\uff09\uff0cAnsible\u5c1a\u4e0d\u652f\u6301Windows\u4f5c\u4e3a\u63a7\u5236\u673a\uff0c\u4f46\u53ef\u4ee5\u53c2\u8003\u535a\u5ba2\u300a\u5728Windows\u4e0a\u4f7f\u7528Vagrant\u4e0eAnsible\u8fdb\u884c\u914d\u7f6e\u300b\u7b49\u8bbe\u7f6e\u7684\u6b65\u9aa4\u8fdb\u884c\u8bbe\u7f6e\u3002<\/p>\n<p>\u4ee5\u4e0a\u7684\u4e00\u534a\u53ef\u7d14\u7cb9\u4f7f\u7528Windows\uff08Cygwin\uff09\u4f86\u8a2d\u7f6eAnsible\uff0c\u8207Vagrant\u7121\u95dc\u800c\u7368\u7acb\u4f7f\u7528\u3002<\/p>\n<p>\u6b64\u5916\uff0c\u5728\u6700\u540e\u4e00\u4e2a\u907f\u514d\u63aa\u65bd\u4e2d\u63d0\u5230\u4e86\u4e00\u4e2a\u672a\u89e3\u51b3\u7684\u95ee\u9898\uff08\u88ab\u8ba4\u4e3a\u662f\u7531\u4e8e\u79d8\u5bc6\u5bc6\u94a5\u7684\u6743\u9650\u8fc7\u4e8e\u5bbd\u677e\u800c\u88ab\u62d2\u7edd\u8bbf\u95ee\uff09\uff0c\u4e3a\u4e86\u56de\u907f\u6b64\u95ee\u9898\uff0c\u90e8\u5206\u60c5\u51b5\u4e0b\u6211\u4eec\u5f3a\u884c\u4fee\u6539\u4e86Ansible\u6e90\u4ee3\u7801\u3002<\/p>\n<h1>\u73af\u5883<\/h1>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">Windows 8.1 Pro<\/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\">Cygwin<\/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\">Vagrant 1.7.2<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">Ansible 1.8.4<\/ul>\n<h1>\u914d\u7f6eCygwin\u73af\u5883<\/h1>\n<p>\u4f7f\u7528\u4f20\u7edf\u7684Cygwin\u5b89\u88c5\u7a0b\u5e8f\uff0c\u6dfb\u52a0\u4ee5\u4e0b\u7684Cygwin\u8f6f\u4ef6\u5305\u3002<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">python<\/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\">python-paramiko<\/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\">python-crypto<\/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\">python-setuptools<\/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\">gcc-core<\/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\">gcc-g++<\/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\">make<\/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\">wget<\/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\">openssh<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">libyaml-devel<\/ul>\n<h1>\u5b89\u88c5pip<\/h1>\n<p>\u4e3a\u4e86\u5b89\u88c5Ansible\uff0c\u9700\u8981\u5148\u5b89\u88c5pip\uff08Python\u7684\u5305\u7ba1\u7406\u7cfb\u7edf\uff09\uff08\u5728\u6b64\u64cd\u4f5c\u65f6\uff0cCygwin\u7684Python\u7248\u672c\u4e3a2.7.8\uff0c\u56e0\u6b64\u9ed8\u8ba4\u4e0d\u9644\u5e26pip\uff09\u3002<\/p>\n<pre class=\"post-pre\"><code>$ python \/usr\/lib\/python2.7\/site-packages\/easy_install.py pip\r\n...\r\n...\r\nInstalled \/usr\/lib\/python2.7\/site-packages\/pip-6.0.8-py2.7.egg\r\nProcessing dependencies for pip\r\nFinished processing dependencies for pip\r\n<\/code><\/pre>\n<h1>\u5b89\u88c5Ansible<\/h1>\n<pre class=\"post-pre\"><code>$ pip install ansible\r\nCollecting ansible\r\n  Downloading ansible-1.9.0.1.tar.gz (916kB)\r\n...\r\n...\r\nSuccessfully installed PyYAML-3.11 ansible-1.9.0.1 ecdsa-0.13 jinja2-2.7.3 markupsafe-0.23\r\n<\/code><\/pre>\n<p>\u5982\u679c\u5728\u6267\u884c\u547d\u4ee4&#8221;python setup.py egg_info&#8221;\u65f6\u51fa\u73b0\u9519\u8bef\u4ee3\u78011\uff0c\u90a3\u4e48\u8bf7\u5347\u7ea7setuptools\u4ee5\u89e3\u51b3\u5b89\u88c5\u95ee\u9898\u3002<br \/>\n$ pip install &#8211;upgrade setuptools<\/p>\n<h1>\u51c6\u5907\u8fdb\u884cAnsible\u72ec\u7acb\u8fd0\u884c\u7684\u6d4b\u8bd5\u3002<\/h1>\n<p>\u5728\u4f7f\u7528Ansible\u4f5c\u4e3aVagrant\u7684Provisioner\u4e4b\u524d\uff0c\u8bf7\u5148\u786e\u8ba4Ansible\u672c\u8eab\u7684\u6b63\u5e38\u8fd0\u884c\u3002<\/p>\n<h2>\u51c6\u5907\u7ba1\u7406\u8282\u70b9<\/h2>\n<p>\u4f5c\u4e3a\u88abAnsible\u63a7\u5236\u7684\u53d7\u7ba1\u8282\u70b9\uff0c\u9700\u8981\u9884\u5148\u4f7f\u7528vagrant up\u6216\u5176\u4ed6\u65b9\u6cd5\u6765\u521b\u5efa\u9002\u5f53\u7684\u865a\u62df\u673a\uff0c\u5e76\u8bb0\u4e0b\u5176IP\u5730\u5740\uff08\u4ee5\u4e0b\u6682\u5b9a\u4e3a\u4e24\u4e2a\u8282\u70b9\uff0c\u5206\u522b\u4e3a192.168.30.11\u548c192.168.30.12\uff09\u3002<\/p>\n<h2>\u51c6\u5907\u5e93\u5b58\u6587\u4ef6<\/h2>\n<pre class=\"post-pre\"><code>mkdir \/etc\/ansible\r\nchmod 755 \/etc\/ansible\r\n<\/code><\/pre>\n<pre class=\"post-pre\"><code>192.168.30.11\r\n192.168.30.12\r\n<\/code><\/pre>\n<h2>SSH\u7684\u5b89\u88c5\u8bbe\u7f6e<\/h2>\n<h3>\u521b\u5efa\u5bc6\u94a5\u5bf9\u3002<\/h3>\n<pre class=\"post-pre\"><code>$ ssh-keygen\r\nGenerating public\/private rsa key pair.\r\nEnter file in which to save the key (\/home\/XXXX\/.ssh\/id_rsa):\r\nEnter passphrase (empty for no passphrase):\r\nEnter same passphrase again:\r\nYour identification has been saved in \/home\/XXXX\/.ssh\/id_rsa.\r\nYour public key has been saved in \/home\/XXXX\/.ssh\/id_rsa.pub.\r\nThe key fingerprint is:\r\n<\/code><\/pre>\n<h3>\u7ed9Managed Node\u5206\u914d\u4e00\u4e2a\u7528\u4e8essh\u8fde\u63a5\u7684\u4e3b\u673a\u540d\uff08\u53ef\u9009\uff09<\/h3>\n<pre class=\"post-pre\"><code>Host node01\r\n  HostName 192.168.30.11\r\nHost node02\r\n  HostName 192.168.30.12\r\n<\/code><\/pre>\n<p>\u5982\u679c\u8fdb\u884c\u4e86\u8fd9\u4e2a\u8bbe\u7f6e\uff0c\u5e93\u5b58\u6587\u4ef6\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u9009\u9879\u3002<\/p>\n<pre class=\"post-pre\"><code>node01\r\nnode02\r\n<\/code><\/pre>\n<h3>\u5c06\u516c\u94a5\u5206\u53d1\u7ed9\u6258\u7ba1\u8282\u70b9\u3002<\/h3>\n<pre class=\"post-pre\"><code>$ ssh-copy-id vagrant@node01`\r\n\/usr\/bin\/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed\r\n\/usr\/bin\/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys\r\nvagrant@192.168.30.11's password:\r\n\r\nNumber of key(s) added: 1\r\n\r\nNow try logging into the machine, with:   \"ssh 'vagrant@node01'\"\r\nand check to make sure that only the key(s) you wanted were added.\r\n\r\n$ ssh-copy-id vagrant@node02\r\n\/usr\/bin\/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed\r\n\/usr\/bin\/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys\r\nvagrant@192.168.30.11's password:\r\n\r\nNumber of key(s) added: 1\r\n\r\nNow try logging into the machine, with:   \"ssh 'vagrant@node02'\"\r\nand check to make sure that only the key(s) you wanted were added.\r\n<\/code><\/pre>\n<p>\u5728\u8fd9\u91cc\uff0c@\u524d\u9762\u7684\u201cvagrant\u201d\u662f\u767b\u5f55\u5230node01\u3001node02\u7684\u7528\u6237\u540d\u3002<\/p>\n<h3>\u63a7\u5236\u4e3b\u7aef\u8bbe\u7f6e<\/h3>\n<p>\u636e\u79f0\uff0cAnsible\u4e0eSSH\u7684\u63a7\u5236\u4e3b\u673a\u4e4b\u95f4\u5b58\u5728\u901a\u4fe1\u95ee\u9898\uff0c\u56e0\u6b64\u9700\u8981\u8fdb\u884c\u4ee5\u4e0b\u4fee\u6b63\u3002<\/p>\n<pre class=\"post-pre\"><code>[ssh_connection]\r\nssh_args = -o ControlMaster=auto -o ControlPersist=60s\r\ncontrol_path = \/tmp\r\n<\/code><\/pre>\n<p>\u987a\u4fbf\u63d0\u4e00\u4e0b\uff0c\u5982\u679c\u4e0d\u8fdb\u884c\u8fd9\u4e2a\u8bbe\u5b9a\u7684\u8bdd<\/p>\n<pre class=\"post-pre\"><code>fatal: [node01] =&gt; SSH Error: Failed to connect to new control master\r\n    while connecting to 192.168.30.11:22\r\n<\/code><\/pre>\n<p>\u53d8\u6210\u8fd9\u6837\u3002<\/p>\n<h3>\u542f\u52a8SSH\u8eab\u4efd\u9a8c\u8bc1\u4ee3\u7406<\/h3>\n<p>\u4e3a\u4e86\u7701\u53bb\u8f93\u5165\u5bc6\u7801\u7684\u6b65\u9aa4\uff0c\u53ef\u4ee5\u4f7f\u7528\u8ba4\u8bc1\u4ee3\u7406\u7a0b\u5e8f\u3002<\/p>\n<pre class=\"post-pre\"><code>$ eval `ssh-agent`\r\nAgent pid 9148\r\n<\/code><\/pre>\n<p>\uff08ssh-agent\uff09\u60a8\u9700\u8981\u7528\u5355\u5f15\u53f7\u5c06\u5176\u62ec\u8d77\u6765\u3002<\/p>\n<p>\u987a\u4fbf\u63d0\u4e00\u4e0b\uff0c\u5982\u679c\u4e0d\u4f7f\u7528\u8ba4\u8bc1\u4ee3\u7406\uff0c\u4e0d\u4ec5\u9700\u8981\u591a\u6b21\u8f93\u5165\u5bc6\u7801\u77ed\u8bed\uff0c\u800c\u4e14\u7531\u4e8e\u9700\u8981\u540c\u65f6\u5904\u7406\u5230\u591a\u4e2a\u8282\u70b9\u7684SSH\u8fde\u63a5\u8bf7\u6c42\uff0c\u4f7f\u5f97\u8f93\u5165\u5bc6\u7801\u77ed\u8bed\u7684\u8981\u6c42\u6df7\u4e71\u5728\u4e00\u8d77\uff0c\u65e0\u6cd5\u987a\u5229\u8f93\u5165\u3002\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u53ef\u4ee5\u5728\u542f\u52a8ansible-playbook\u65f6\u6dfb\u52a0\u201c-f 1\u201d\u53c2\u6570\uff0c\u4ee5\u4fbf\u4e00\u6b21\u53ea\u5904\u7406\u4e00\u4e2a\u8282\u70b9\uff0c\u4ece\u800c\u53ef\u4ee5\u8f93\u5165\u5bc6\u7801\u77ed\u8bed\u3002<\/p>\n<h3>\u8ba9\u8ba4\u8bc1\u4ee3\u7406\u8bb0\u4f4f\u79c1\u94a5<\/h3>\n<pre class=\"post-pre\"><code>$ ssh-add .ssh\/id_rsa\r\nEnter passphrase for .ssh\/id_rsa:\r\nIdentity added: .ssh\/id_rsa (.ssh\/id_rsa)\r\n<\/code><\/pre>\n<h1>\u9a8c\u8bc1Ansible\u7684\u72ec\u7acb\u64cd\u4f5c<\/h1>\n<h2>\u81ea\u5b9a\u4e49\u547d\u4ee4<\/h2>\n<p>\u5c1d\u8bd5\u6267\u884cAd-hoc\u547d\u4ee4\u6765\u9a8c\u8bc1Ansible\u5728\u72ec\u7acb\u8fd0\u884c\u65f6\u7684\u5de5\u4f5c\u60c5\u51b5\uff0c\u5e76\u4ece\u4e24\u4e2a\u88ab\u7ba1\u7406\u7684\u8282\u70b9\u4e2d\u83b7\u53d6\/etc\/redhat-release\u6587\u4ef6\u7684\u547d\u4ee4\u6765\u5c1d\u8bd5\u6267\u884c\u3002<\/p>\n<pre class=\"post-pre\"><code>$ ansible all -a \"cat \/etc\/redhat-release\" -u vagrant\r\n192.168.30.12 | success | rc=0 &gt;&gt;\r\nCentOS Linux release 7.1.1503 (Core)\r\n\r\n192.168.30.11 | success | rc=0 &gt;&gt;\r\nCentOS Linux release 7.1.1503 (Core)\r\n<\/code><\/pre>\n<p>\u987a\u5229\u65e0\u6545\u4e8b\u7684\u83b7\u5f97\u6210\u529f\u3002<\/p>\n<h2>\u5267\u672c (j\u00f9<\/h2>\n<p>\u6e96\u5099\u4e00\u4efdPlaybook\u4f86\u78ba\u8a8d\u7c21\u55ae\u7684\u64cd\u4f5c\u3002<br \/>\n\u5728\u5169\u500b\u7bc0\u9ede\u4e0a\uff0c\u6e96\u5099\u4e00\u500b\u540d\u70ba&#8221;kuroneko&#8221;\u7684\u4f7f\u7528\u8005\u8a3b\u518aPlaybook\u3002<\/p>\n<pre class=\"post-pre\"><code>$ cat &lt;&lt;EOF &gt; add_user.yml\r\n&gt; - hosts: all\r\n&gt;   sudo: yes\r\n&gt;   remote_user: vagrant\r\n&gt;   vars:\r\n&gt;     username: kuroneko\r\n&gt;   tasks:\r\n&gt;     - name: add user\r\n&gt;       user: name={{ username }} group=wheel shell=\/usr\/bin\/bash\r\n&gt; EOF\r\n<\/code><\/pre>\n<p>\u8bd5\u7740\u8fd0\u884cansible-playbook\u3002<\/p>\n<pre class=\"post-pre\"><code>$ ansible-playbook add_user.yml\r\n\r\nPLAY [all] ********************************************************************\r\n\r\nGATHERING FACTS ***************************************************************\r\nok: [192.168.30.11]\r\nok: [192.168.30.12]\r\n\r\nTASK: [add user] **************************************************************\r\nchanged: [192.168.30.11]\r\nchanged: [192.168.30.12]\r\n\r\nPLAY RECAP ********************************************************************\r\n192.168.30.11              : ok=2    changed=1    unreachable=0    failed=0\r\n192.168.30.12              : ok=2    changed=1    unreachable=0    failed=0\r\n<\/code><\/pre>\n<p>\u7ecf\u8fc7\u52aa\u529b\uff0c\u4e00\u5207\u987a\u5229\u3002\u4e3a\u4e86\u786e\u8ba4kuroneko\u5df2\u7ecf\u521b\u5efa\u6210\u529f\uff0c\u8fd8\u662f\u518d\u6b21\u786e\u8ba4\u4e00\u4e0b\u3002<\/p>\n<pre class=\"post-pre\"><code>$ ansible all -a \"grep kuroneko \/etc\/passwd\" -u vagrant\r\n192.168.30.12 | success | rc=0 &gt;&gt;\r\nkuroneko:x:1002:10::\/home\/kuroneko:\/usr\/bin\/bash\r\n\r\n192.168.30.11 | success | rc=0 &gt;&gt;\r\nkuroneko:x:1002:10::\/home\/kuroneko:\/usr\/bin\/bash\r\n<\/code><\/pre>\n<p>\u786e\u8ba4\u5230\u7528\u6237&#8221;kuroneko&#8221;\u5df2\u7ecf\u6210\u529f\u6dfb\u52a0\u5e76\u4e14playbook\u6210\u529f\u6267\u884c\u3002<\/p>\n<h1>\u5c06ansible-playbook\u914d\u7f6e\u4e3a\u53ef\u4ee5\u4ecevagrant\u4e2d\u8c03\u7528<\/h1>\n<h2>\u51c6\u5907ansible-playbook.bat\u6587\u4ef6<\/h2>\n<p>\u8981\u4eceVagrant\u4e2d\u8c03\u7528ansible-playbook\uff0c\u53ef\u4ee5\u8fdb\u884c\u4ee5\u4e0b\u64cd\u4f5c\uff1a<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">Windows PATH\u306e\u4e2d\u306b ansible-player\u3092\u914d\u7f6e\u3059\u308b<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">ansible-player\u304cCygwin\u306ePaython\u3092\u4f7f\u7528\u3067\u304d\u308b<\/ul>\n<p>\u8fd9\u662f\u5fc5\u8981\u7684\u3002<br \/>\n\u56e0\u6b64\uff0c\u8bf7\u5c06\u4ee5\u4e0b\u7684bat\u6587\u4ef6\u653e\u7f6e\u5728C:\\HashiCorp\\Vagrant\\bin\u76ee\u5f55\u4e0b\u3002<\/p>\n<pre class=\"post-pre\"><code>@echo off\r\n\r\nset CYGWIN=C:\\cygwin64\r\n\r\nset SH=%CYGWIN%\\bin\\bash.exe\r\n\r\n\"%SH%\" -c \"\/bin\/ansible-playbook %*\"\r\n<\/code><\/pre>\n<p>\u5728\u8fd9\u91cc\uff0cCYGWIN=C:\\cygwin64\u662fCygwin\u5b89\u88c5\u76ee\u5f55\u3002\u8bf7\u6839\u636e\u5b9e\u9645\u73af\u5883\u8fdb\u884c\u8bbe\u7f6e\u3002\u53e6\u5916\uff0c\u653e\u7f6ebat\u6587\u4ef6\u7684\u76ee\u5f55\u4e0d\u4e00\u5b9a\u8981\u662fC:\\HashiCorp\\Vagrant\\bin\u3002\u53ef\u4ee5\u653e\u5728Windows\u7684PATH\u8def\u5f84\u4e0b\u3002<\/p>\n<p>\u6211\u4f1a\u6267\u884cansible-playbook.bat\u8fdb\u884c\u786e\u8ba4\u3002<\/p>\n<pre class=\"post-pre\"><code>$ ansible-playbook.bat add_user.yml\r\n\r\nPLAY [all] ********************************************************************\r\n\r\nGATHERING FACTS ***************************************************************\r\nok: [node01]\r\nok: [node02]\r\n\r\nTASK: [add user] **************************************************************\r\nok: [node01]\r\nok: [node02]\r\n\r\nPLAY RECAP ********************************************************************\r\nnode01                     : ok=2    changed=0    unreachable=0    failed=0\r\nnode02                     : ok=2    changed=0    unreachable=0    failed=0\r\n<\/code><\/pre>\n<p>bat\u6587\u4ef6\u8c03\u7528\u4e86ansible-playbook\uff0c\u6210\u529f\u6267\u884c\u4e86add_user.yml\u3002<\/p>\n<h1>\u5bf9\u4e8eAnsible\u4f5c\u4e3aVagrant\u7684Provisioner\u7684\u8fd0\u884c\u9a8c\u8bc1\uff0c\u8bf7\u786e\u8ba4\u3002<\/h1>\n<h2>\u51c6\u5907Vasgrantfile<\/h2>\n<p>\u51c6\u5907\u4e00\u4e2aVagrantfile\u4ee5\u521b\u5efa\u4e24\u4e2a\u8fd0\u884cCentOS 7 (1503)\u64cd\u4f5c\u7cfb\u7edf\u7684\u865a\u62df\u670d\u52a1\u5668\uff0c\u5e76\u8fdb\u884cApache provisioning\u3002<\/p>\n<pre class=\"post-pre\"><code>Vagrant.configure(2) do |config|\r\n\r\n  if Vagrant.has_plugin?(\"vagrant-cachier\")\r\n    config.cache.scope = :box\r\n  end\r\n  if Vagrant.has_plugin?(\"vagrant-vbguest\")\r\n    config.vbguest.auto_update = false\r\n  end\r\n  config.vm.define \"web02\" do |web|\r\n    web.vm.box = \"centos7-1503-01-min\"\r\n    web.vm.hostname = \"web02\"\r\n    web.vm.network \"private_network\", ip: \"192.168.40.12\"\r\n    web.vm.provision \"shell\",\r\n      inline: \"nmcli connection reload;systemctl restart network.service\"\r\n    web.vm.provision \"ansible\" do |ansible|\r\n      ansible.playbook = \"ensure-apache-latest.yml\"\r\n    end\r\n  end\r\n  config.vm.define \"web01\" do |web|\r\n    web.vm.box = \"centos7-1503-01-min\"\r\n    web.vm.hostname = \"web01\"\r\n    web.vm.network \"private_network\", ip: \"192.168.40.11\"\r\n    web.vm.provision \"shell\",\r\n      inline: \"nmcli connection reload;systemctl restart network.service\"\r\n    web.vm.provision \"ansible\" do |ansible|\r\n      ansible.playbook = \"ensure-apache-latest.yml\"\r\n    end\r\n  end\r\n\r\nend\r\n<\/code><\/pre>\n<p>\u88ab\u547c\u5524\u7684Playbook\u5982\u4e0b\u6240\u793a\u3002<\/p>\n<pre class=\"post-pre\"><code>- hosts: all\r\n  sudo: yes\r\n  remote_user: vagrant\r\n  tasks:\r\n    - name: ensure apache is at the latest version\r\n      yum: pkg=httpd state=latest\r\n      notify:\r\n      - stop firewalld\r\n      - restart httpd\r\n  handlers:\r\n    - name: stop firewalld\r\n      service: name=firewalld state=stopped enabled=no\r\n    - name: restart httpd\r\n      service: name=httpd state=restarted enabled=yes\r\n<\/code><\/pre>\n<h2>\u786e\u8ba4\u52a8\u4f5c\uff08\u5931\u8d25\uff09<\/h2>\n<p>\u5f53\u5728\u4e0a\u8ff0\u7684Vagrantfile\u4e2d\u6267\u884cvagrant up\u65f6\uff0c\u4f1a\u663e\u793a\u4ee5\u4e0b\u9519\u8bef\u6d88\u606f\uff0c\u5bfc\u81f4\u65e0\u6cd5\u542f\u52a8Playbook\u3002<\/p>\n<pre class=\"post-pre\"><code>fatal: [web01] =&gt; private_key_file (D:\/Vagrant\/projects\/ansible-windows\/.vagrant\/machines\/web01\/virtualbox\/private_key) is group-readable or world-readable and thus insecure - you will probably get an SSH failure\r\n<\/code><\/pre>\n<p>\u770b\u8d77\u6765\u79c1\u7684\u5bc6\u94a5\u6587\u4ef6\u7684\u6743\u9650\u8bbe\u7f6e\u592a\u5bbd\u677e\u4e86\uff0c\u5373\u4f7f\u4f7f\u7528chmod 600\u6216\u8005\u901a\u8fc7setfacl\u4e25\u683c\u8bbe\u7f6e\u4e86ACL\uff0c\u95ee\u9898\u4ecd\u65e0\u6cd5\u89e3\u51b3\u3002<br \/>\n\u5728\u8fd9\u7bc7\u6587\u7ae0\u7684\u5f00\u5934\uff0c\u6211\u4f7f\u7528\u4e86~\/.ssh\/id_rsa\u8fdb\u884cPlaybook\u7684\u64cd\u4f5c\u786e\u8ba4\uff0c\u6240\u4ee5\u6211\u5c1d\u8bd5\u8bbe\u7f6e\u76f8\u540c\u7684\u6743\u9650\uff0c\u4f8b\u5982\uff1a\u8bbe\u7f6e\u540c\u6837\u7684\u6743\u9650\uff5e\/.ssh\/id_rsa\u6216\u5c1d\u8bd5getfacl ~\/.ssh\/id_rsa | setfacl -f &#8211; private_key\u7b49\uff0c\u4f46\u5947\u602a\u7684\u662f\u95ee\u9898\u4f9d\u7136\u65e0\u6cd5\u89e3\u51b3\u3002\u901a\u8fc7\u6267\u884cstat private_key\u7b49\u547d\u4ee4\uff0c\u770b\u8d77\u6765\u5e76\u6ca1\u6709\u4ec0\u4e48\u5f02\u5e38\u3002\u6211\u53ef\u80fd\u5728Cygwin\u548cWindows\u7684\u6743\u9650\u76f8\u5173\u95ee\u9898\u4e0a\u6f0f\u6389\u4e86\u4e00\u4e9b\u4e1c\u897f\uff0c\u4f46\u6211\u4e0d\u77e5\u9053\u662f\u4ec0\u4e48\u3002\u56e0\u6b64\uff0c\u6211\u9009\u62e9\u4e86\u4e0b\u4e00\u4e2a\u5e94\u6025\u63aa\u65bd\u3002<\/p>\n<h1>\u907f\u514d\u7b56\u7565<\/h1>\n<p>\u4e0a\u9762\u7684\u9519\u8bef\u4fe1\u606f\u662f\u7531\/usr\/lib\/python2.7\/site-packages\/ansible\/runner\/connection.py\u8f93\u51fa\u7684\u3002<\/p>\n<pre class=\"post-pre\"><code>if st is not None and st.st_mode &amp; (stat.S_IRGRP | stat.S_IROTH):\r\n  raise AnsibleError(\"private_key_file (%s) is group-readable or world-readable and thus insecure - \"\r\n    \"you will probably get an SSH failure\"\r\n    % (private_key_file,))\r\n<\/code><\/pre>\n<p>\u6211\u8bd5\u9a8c\u6027\u5730\u4f7f\u7528&#8221;#&#8221;\u5c06\u6b64\u90e8\u5206\u6ce8\u91ca\u6389\uff0c\u7136\u540e\u6267\u884c\u4e86vagrant destroy;vagrant up\u3002\u6210\u529f\u5730\u8fdb\u884c\u4e86\u914d\u7f6e\u64cd\u4f5c\u3002<\/p>\n<pre class=\"post-pre\"><code>$ vagrant up\r\nBringing machine 'web02' up with 'virtualbox' provider...\r\nBringing machine 'web01' up with 'virtualbox' provider...\r\n...\r\n...\r\n...\r\n==&gt; web02: Running provisioner: ansible...\r\n...\r\n...\r\n...\r\nPLAY [all] ********************************************************************\r\n\r\nGATHERING FACTS ***************************************************************\r\nok: [web02]\r\n\r\nTASK: [ensure apache is at the latest version] ********************************\r\nchanged: [web02]\r\n\r\nNOTIFIED: [stop firewalld] ****************************************************\r\nchanged: [web02]\r\n\r\nNOTIFIED: [restart httpd] *****************************************************\r\nchanged: [web02]\r\n\r\nPLAY RECAP ********************************************************************\r\nweb02                      : ok=4    changed=3    unreachable=0    failed=0\r\n==&gt; web02: Configuring cache buckets...\r\n==&gt; web01: Importing base box 'centos7-1503-01-min'...\r\n...\r\n...\r\n...\r\n==&gt; web01: Running provisioner: ansible...\r\n...\r\n...\r\n...\r\nPLAY [all] ********************************************************************\r\n\r\nGATHERING FACTS ***************************************************************\r\nok: [web01]\r\n\r\nTASK: [ensure apache is at the latest version] ********************************\r\nchanged: [web01]\r\n\r\nNOTIFIED: [stop firewalld] ****************************************************\r\nchanged: [web01]\r\n\r\nNOTIFIED: [restart httpd] *****************************************************\r\nchanged: [web01]\r\n\r\nPLAY RECAP ********************************************************************\r\nweb01                      : ok=4    changed=3    unreachable=0    failed=0\r\n==&gt; web01: Configuring cache buckets...\r\n<\/code><\/pre>\n<h1>\u987a\u4fbf\u63d0\u4e00\u4e0b<\/h1>\n<p>\u5982\u679c\u6309\u7167\u4e0a\u8ff0Vagrantfile\u4e2d\u7684ansible playbook\u7684\u8c03\u7528\u65b9\u5f0f\uff0c\u53ea\u662f\u5355\u8c03\u5730\u987a\u5e8f\u6267\u884c\u521b\u5efa\u865a\u62df\u670d\u52a1\u5668\u3001\u914d\u7f6e\u548c\u521b\u5efa\u865a\u62df\u670d\u52a1\u5668\u3001\u914d\u7f6e\uff0c\u8fd9\u6837\u5f88\u65e0\u804a\u3002Vagrant\u6587\u6863\u4e2d\u7684Ansible\u7684\u5c0f\u6280\u5de7\u4e2d\u6709\u4e00\u6761\u540d\u4e3a&#8221;ANSIBLE PARALLEL EXECUTION&#8221;\u7684\u8bb0\u5f55\u3002\u6211\u5c1d\u8bd5\u5728\u4e0b\u9762\u7684Vagrantfile\u4e2d\u6a21\u4eff\u8fd9\u4e2a\u65b9\u6cd5\uff0c\u8fdb\u884c\u5e76\u884c\u6267\u884c\u914d\u7f6e\u3002<\/p>\n<pre class=\"post-pre\"><code>Vagrant.configure(2) do |config|\r\n\r\n  if Vagrant.has_plugin?(\"vagrant-cachier\")\r\n    config.cache.scope = :box\r\n  end\r\n  if Vagrant.has_plugin?(\"vagrant-vbguest\")\r\n    config.vbguest.auto_update = false\r\n  end\r\n  config.ssh.insert_key = false\r\n  config.vm.define \"web02\" do |web|\r\n    web.vm.box = \"centos7-1503-01-min\"\r\n    web.vm.hostname = \"web02\"\r\n    web.vm.network \"private_network\", ip: \"192.168.40.12\"\r\n    web.vm.provision \"shell\",\r\n      inline: \"nmcli connection reload;systemctl restart network.service\"\r\n  end\r\n  config.vm.define \"web01\" do |web|\r\n    web.vm.box = \"centos7-1503-01-min\"\r\n    web.vm.hostname = \"web01\"\r\n    web.vm.network \"private_network\", ip: \"192.168.40.11\"\r\n    web.vm.provision \"shell\",\r\n      inline: \"nmcli connection reload;systemctl restart network.service\"\r\n    web.vm.provision \"ansible\" do |ansible|\r\n      ansible.playbook = \"ensure-apache-latest.yml\"\r\n      ansible.limit = 'all'\r\n    end\r\n  end\r\n\r\nend\r\n<\/code><\/pre>\n<p>\u5982\u679c\u5fd8\u8bb0\u5c06config.ssh.insert_key = false\u8bbe\u7f6e\u4e3atrue\uff0c\u5219\u9664\u4e86\u4e00\u4e2a\u865a\u62df\u670d\u52a1\u5668\u5916\uff0c\u4e0d\u80fd\u4f7f\u7528\u540c\u4e00\u4e2a\u5bc6\u94a5\u8fdb\u884cssh\uff0c\u5e76\u4e14\u8fd9\u4f1a\u5bfc\u81f4\u90e8\u7f72\u5931\u8d25\uff0c\u6240\u4ee5\u8bf7\u6ce8\u610f\u3002<\/p>\n<p>\u770b\u8d77\u6765\u4f3c\u4e4e\u53ef\u4ee5\u4f7f\u7528\uff0c\u4f46\u4e4b\u540e\u5fc5\u987b\u66f4\u6362\u4e0d\u5b89\u5168\u7684\u4f20\u7edf\u5bc6\u94a5\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u76ee\u524d\uff08\u7248\u672c1.8.4\uff09\uff0cAnsible\u5c1a\u4e0d\u652f\u6301Windows\u4f5c\u4e3a\u63a7\u5236\u673a\uff0c\u4f46\u53ef\u4ee5\u53c2\u8003\u535a\u5ba2\u300a\u5728Windows\u4e0a\u4f7f\u7528 [&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-42801","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>\u4f7f\u7528Vagrant\u7684\u914d\u7f6e\u5de5\u5177\uff0c\u5c06Ansible\u7528\u4f5cProvisioner\uff08\u5728Windows\u4e0a\u4f7f\u7528Cygwin\u4f5c\u4e3aControl Machine\uff09 - 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\/\u4f7f\u7528vagrant\u7684\u914d\u7f6e\u5de5\u5177\uff0c\u5c06ansible\u7528\u4f5cprovisioner\uff08\u5728windows\u4e0a\u4f7f\u7528cygwin\u4f5c\u4e3a\/\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u4f7f\u7528Vagrant\u7684\u914d\u7f6e\u5de5\u5177\uff0c\u5c06Ansible\u7528\u4f5cProvisioner\uff08\u5728Windows\u4e0a\u4f7f\u7528Cygwin\u4f5c\u4e3aControl Machine\uff09\" \/>\n<meta property=\"og:description\" content=\"\u76ee\u524d\uff08\u7248\u672c1.8.4\uff09\uff0cAnsible\u5c1a\u4e0d\u652f\u6301Windows\u4f5c\u4e3a\u63a7\u5236\u673a\uff0c\u4f46\u53ef\u4ee5\u53c2\u8003\u535a\u5ba2\u300a\u5728Windows\u4e0a\u4f7f\u7528 [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.silicloud.com\/zh\/blog\/\u4f7f\u7528vagrant\u7684\u914d\u7f6e\u5de5\u5177\uff0c\u5c06ansible\u7528\u4f5cprovisioner\uff08\u5728windows\u4e0a\u4f7f\u7528cygwin\u4f5c\u4e3a\/\" \/>\n<meta property=\"og:site_name\" content=\"Blog - Silicon Cloud\" \/>\n<meta property=\"article:published_time\" content=\"2024-02-23T23:10:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-04-29T12:49:48+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\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\/%e4%bd%bf%e7%94%a8vagrant%e7%9a%84%e9%85%8d%e7%bd%ae%e5%b7%a5%e5%85%b7%ef%bc%8c%e5%b0%86ansible%e7%94%a8%e4%bd%9cprovisioner%ef%bc%88%e5%9c%a8windows%e4%b8%8a%e4%bd%bf%e7%94%a8cygwin%e4%bd%9c%e4%b8%ba\/\",\"url\":\"https:\/\/www.silicloud.com\/zh\/blog\/%e4%bd%bf%e7%94%a8vagrant%e7%9a%84%e9%85%8d%e7%bd%ae%e5%b7%a5%e5%85%b7%ef%bc%8c%e5%b0%86ansible%e7%94%a8%e4%bd%9cprovisioner%ef%bc%88%e5%9c%a8windows%e4%b8%8a%e4%bd%bf%e7%94%a8cygwin%e4%bd%9c%e4%b8%ba\/\",\"name\":\"\u4f7f\u7528Vagrant\u7684\u914d\u7f6e\u5de5\u5177\uff0c\u5c06Ansible\u7528\u4f5cProvisioner\uff08\u5728Windows\u4e0a\u4f7f\u7528Cygwin\u4f5c\u4e3aControl Machine\uff09 - Blog - Silicon Cloud\",\"isPartOf\":{\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#website\"},\"datePublished\":\"2024-02-23T23:10:00+00:00\",\"dateModified\":\"2024-04-29T12:49:48+00:00\",\"author\":{\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/1a6ecd3d914d22a5ac32791ffc1fbd8e\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/%e4%bd%bf%e7%94%a8vagrant%e7%9a%84%e9%85%8d%e7%bd%ae%e5%b7%a5%e5%85%b7%ef%bc%8c%e5%b0%86ansible%e7%94%a8%e4%bd%9cprovisioner%ef%bc%88%e5%9c%a8windows%e4%b8%8a%e4%bd%bf%e7%94%a8cygwin%e4%bd%9c%e4%b8%ba\/#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.silicloud.com\/zh\/blog\/%e4%bd%bf%e7%94%a8vagrant%e7%9a%84%e9%85%8d%e7%bd%ae%e5%b7%a5%e5%85%b7%ef%bc%8c%e5%b0%86ansible%e7%94%a8%e4%bd%9cprovisioner%ef%bc%88%e5%9c%a8windows%e4%b8%8a%e4%bd%bf%e7%94%a8cygwin%e4%bd%9c%e4%b8%ba\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/%e4%bd%bf%e7%94%a8vagrant%e7%9a%84%e9%85%8d%e7%bd%ae%e5%b7%a5%e5%85%b7%ef%bc%8c%e5%b0%86ansible%e7%94%a8%e4%bd%9cprovisioner%ef%bc%88%e5%9c%a8windows%e4%b8%8a%e4%bd%bf%e7%94%a8cygwin%e4%bd%9c%e4%b8%ba\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.silicloud.com\/zh\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u4f7f\u7528Vagrant\u7684\u914d\u7f6e\u5de5\u5177\uff0c\u5c06Ansible\u7528\u4f5cProvisioner\uff08\u5728Windows\u4e0a\u4f7f\u7528Cygwin\u4f5c\u4e3aControl Machine\uff09\"}]},{\"@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\/%e4%bd%bf%e7%94%a8vagrant%e7%9a%84%e9%85%8d%e7%bd%ae%e5%b7%a5%e5%85%b7%ef%bc%8c%e5%b0%86ansible%e7%94%a8%e4%bd%9cprovisioner%ef%bc%88%e5%9c%a8windows%e4%b8%8a%e4%bd%bf%e7%94%a8cygwin%e4%bd%9c%e4%b8%ba\/#local-main-organization-logo\",\"url\":\"\",\"contentUrl\":\"\",\"caption\":\"Blog - Silicon Cloud\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"\u4f7f\u7528Vagrant\u7684\u914d\u7f6e\u5de5\u5177\uff0c\u5c06Ansible\u7528\u4f5cProvisioner\uff08\u5728Windows\u4e0a\u4f7f\u7528Cygwin\u4f5c\u4e3aControl Machine\uff09 - 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\/\u4f7f\u7528vagrant\u7684\u914d\u7f6e\u5de5\u5177\uff0c\u5c06ansible\u7528\u4f5cprovisioner\uff08\u5728windows\u4e0a\u4f7f\u7528cygwin\u4f5c\u4e3a\/","og_locale":"zh_CN","og_type":"article","og_title":"\u4f7f\u7528Vagrant\u7684\u914d\u7f6e\u5de5\u5177\uff0c\u5c06Ansible\u7528\u4f5cProvisioner\uff08\u5728Windows\u4e0a\u4f7f\u7528Cygwin\u4f5c\u4e3aControl Machine\uff09","og_description":"\u76ee\u524d\uff08\u7248\u672c1.8.4\uff09\uff0cAnsible\u5c1a\u4e0d\u652f\u6301Windows\u4f5c\u4e3a\u63a7\u5236\u673a\uff0c\u4f46\u53ef\u4ee5\u53c2\u8003\u535a\u5ba2\u300a\u5728Windows\u4e0a\u4f7f\u7528 [&hellip;]","og_url":"https:\/\/www.silicloud.com\/zh\/blog\/\u4f7f\u7528vagrant\u7684\u914d\u7f6e\u5de5\u5177\uff0c\u5c06ansible\u7528\u4f5cprovisioner\uff08\u5728windows\u4e0a\u4f7f\u7528cygwin\u4f5c\u4e3a\/","og_site_name":"Blog - Silicon Cloud","article_published_time":"2024-02-23T23:10:00+00:00","article_modified_time":"2024-04-29T12:49:48+00:00","author":"\u6e05, \u5b87","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"\u6e05, \u5b87","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"6 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.silicloud.com\/zh\/blog\/%e4%bd%bf%e7%94%a8vagrant%e7%9a%84%e9%85%8d%e7%bd%ae%e5%b7%a5%e5%85%b7%ef%bc%8c%e5%b0%86ansible%e7%94%a8%e4%bd%9cprovisioner%ef%bc%88%e5%9c%a8windows%e4%b8%8a%e4%bd%bf%e7%94%a8cygwin%e4%bd%9c%e4%b8%ba\/","url":"https:\/\/www.silicloud.com\/zh\/blog\/%e4%bd%bf%e7%94%a8vagrant%e7%9a%84%e9%85%8d%e7%bd%ae%e5%b7%a5%e5%85%b7%ef%bc%8c%e5%b0%86ansible%e7%94%a8%e4%bd%9cprovisioner%ef%bc%88%e5%9c%a8windows%e4%b8%8a%e4%bd%bf%e7%94%a8cygwin%e4%bd%9c%e4%b8%ba\/","name":"\u4f7f\u7528Vagrant\u7684\u914d\u7f6e\u5de5\u5177\uff0c\u5c06Ansible\u7528\u4f5cProvisioner\uff08\u5728Windows\u4e0a\u4f7f\u7528Cygwin\u4f5c\u4e3aControl Machine\uff09 - Blog - Silicon Cloud","isPartOf":{"@id":"https:\/\/www.silicloud.com\/zh\/blog\/#website"},"datePublished":"2024-02-23T23:10:00+00:00","dateModified":"2024-04-29T12:49:48+00:00","author":{"@id":"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/1a6ecd3d914d22a5ac32791ffc1fbd8e"},"breadcrumb":{"@id":"https:\/\/www.silicloud.com\/zh\/blog\/%e4%bd%bf%e7%94%a8vagrant%e7%9a%84%e9%85%8d%e7%bd%ae%e5%b7%a5%e5%85%b7%ef%bc%8c%e5%b0%86ansible%e7%94%a8%e4%bd%9cprovisioner%ef%bc%88%e5%9c%a8windows%e4%b8%8a%e4%bd%bf%e7%94%a8cygwin%e4%bd%9c%e4%b8%ba\/#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.silicloud.com\/zh\/blog\/%e4%bd%bf%e7%94%a8vagrant%e7%9a%84%e9%85%8d%e7%bd%ae%e5%b7%a5%e5%85%b7%ef%bc%8c%e5%b0%86ansible%e7%94%a8%e4%bd%9cprovisioner%ef%bc%88%e5%9c%a8windows%e4%b8%8a%e4%bd%bf%e7%94%a8cygwin%e4%bd%9c%e4%b8%ba\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.silicloud.com\/zh\/blog\/%e4%bd%bf%e7%94%a8vagrant%e7%9a%84%e9%85%8d%e7%bd%ae%e5%b7%a5%e5%85%b7%ef%bc%8c%e5%b0%86ansible%e7%94%a8%e4%bd%9cprovisioner%ef%bc%88%e5%9c%a8windows%e4%b8%8a%e4%bd%bf%e7%94%a8cygwin%e4%bd%9c%e4%b8%ba\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.silicloud.com\/zh\/blog\/"},{"@type":"ListItem","position":2,"name":"\u4f7f\u7528Vagrant\u7684\u914d\u7f6e\u5de5\u5177\uff0c\u5c06Ansible\u7528\u4f5cProvisioner\uff08\u5728Windows\u4e0a\u4f7f\u7528Cygwin\u4f5c\u4e3aControl Machine\uff09"}]},{"@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\/%e4%bd%bf%e7%94%a8vagrant%e7%9a%84%e9%85%8d%e7%bd%ae%e5%b7%a5%e5%85%b7%ef%bc%8c%e5%b0%86ansible%e7%94%a8%e4%bd%9cprovisioner%ef%bc%88%e5%9c%a8windows%e4%b8%8a%e4%bd%bf%e7%94%a8cygwin%e4%bd%9c%e4%b8%ba\/#local-main-organization-logo","url":"","contentUrl":"","caption":"Blog - Silicon Cloud"}]}},"_links":{"self":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts\/42801","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=42801"}],"version-history":[{"count":2,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts\/42801\/revisions"}],"predecessor-version":[{"id":87567,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts\/42801\/revisions\/87567"}],"wp:attachment":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/media?parent=42801"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/categories?post=42801"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/tags?post=42801"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}