{"id":302251,"date":"2020-04-21T15:00:51","date_gmt":"2020-04-21T15:00:51","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=302251"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=302251","title":{"rendered":"\u0410\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0430\u0446\u0438\u044f \u0437\u0430\u0434\u0430\u0447 \u0430\u0434\u043c\u0438\u043d\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f API VMware vSphere \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c Ansible"},"content":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/company\/avanpost\/blog\/498304\/\">\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/tv\/8h\/nn\/tv8hnnkbtd6xaejjwtdwodwplga.jpeg\" alt=\"image\"><\/div>\n<p>  <\/p>\n<p>\u0412 <a href=\"https:\/\/habr.com\/ru\/company\/avanpost\/blog\/478024\/\">\u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0439 \u0441\u0442\u0430\u0442\u044c\u0435<\/a> \u043c\u044b \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043b\u0438 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u0441 VMware \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e Python. \u0412 \u044d\u0442\u043e\u0439 \u0436\u0435 \u043e\u0431\u0441\u0443\u0434\u0438\u043c \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u0441 VMware \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e Ansible.<\/p>\n<p>  <\/p>\n<p>Ansible \u2014 \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044f\u043c\u0438, \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u0430\u044f \u043d\u0430 \u044f\u0437\u044b\u043a\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f Python \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0434\u0435\u043a\u043b\u0430\u0440\u0430\u0442\u0438\u0432\u043d\u043e\u0433\u043e \u044f\u0437\u044b\u043a\u0430 \u0440\u0430\u0437\u043c\u0435\u0442\u043a\u0438 \u0434\u043b\u044f \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0439. \u041f\u0440\u043e Ansible \u043d\u0430 \u0425\u0430\u0431\u0440\u0435 \u0443\u0436\u0435 \u0435\u0441\u0442\u044c \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u0441\u0442\u0430\u0442\u0435\u0439, \u043d\u043e \u0441\u0442\u043e\u0438\u0442 \u0435\u0449\u0435 \u0440\u0430\u0437 \u0443\u043f\u043e\u043c\u044f\u043d\u0443\u0442\u044c, \u0447\u0442\u043e \u043e\u0434\u043d\u0438\u043c \u0438\u0437 \u043a\u043b\u044e\u0447\u0435\u0432\u044b\u0445 \u0441\u0432\u043e\u0439\u0441\u0442\u0432 playbook&#8217;a \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0438\u0434\u0435\u043c\u043f\u043e\u0442\u0435\u043d\u0442\u043d\u043e\u0441\u0442\u044c. \u042d\u0442\u043e \u0437\u043d\u0430\u0447\u0438\u0442, \u0447\u0442\u043e \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0431\u044b \u0440\u0430\u0437 \u043f\u043e\u0434\u0440\u044f\u0434 \u0432\u044b \u043d\u0435 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u043b\u0438 \u0441\u0432\u043e\u0439 playbook, \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0431\u0443\u0434\u0435\u0442 \u043e\u0434\u0438\u043d \u0438 \u0442\u043e\u0442 \u0436\u0435.<\/p>\n<p><a name=\"habracut\"><\/a>  <\/p>\n<p>Ansible \u043c\u043e\u0434\u0443\u043b\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 pyVmomi \u0438 \u0447\u0430\u0449\u0435 \u0432\u0441\u0435\u0433\u043e \u0442\u0440\u0435\u0431\u0443\u044e\u0442 Python \u0432\u0435\u0440\u0441\u0438\u0438 \u0432\u044b\u0448\u0435 2.6.<\/p>\n<p>  <\/p>\n<p>\u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c pyVmomi, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f <i>pip<\/i>:<\/p>\n<p>  <\/p>\n<pre><code class=\"cs\">pip install pyvmomi<\/code><\/pre>\n<p>  <\/p>\n<h2>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u043f\u043b\u0430\u0433\u0438\u043d\u0430 \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u0438\u043d\u0432\u0435\u043d\u0442\u0430\u0440\u0438\u0437\u0430\u0446\u0438\u0438 VMware<\/h2>\n<p>  <\/p>\n<p>\u0421\u043e\u0433\u043b\u0430\u0441\u043d\u043e \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u043b\u0443\u0447\u0448\u0438\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u0441 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u043c\u0438 \u0445\u043e\u0441\u0442\u0430\u043c\u0438 \u2014 \u044d\u0442\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u043f\u043b\u0430\u0433\u0438\u043d\u0430 \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u0438\u043d\u0432\u0435\u043d\u0442\u0430\u0440\u0438\u0437\u0430\u0446\u0438\u0438 VMware.<\/p>\n<p>  <\/p>\n<p>\u0414\u043b\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u043f\u043b\u0430\u0433\u0438\u043d\u0430 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0432\u043d\u0435\u0441\u0442\u0438 \u0432 \u0444\u0430\u0439\u043b <i>ansible.cfg<\/i> \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u043f\u0440\u0430\u0432\u043a\u0438:<\/p>\n<p>  <\/p>\n<pre><code class=\"cs\">[inventory] enable_plugins = vmware_vm_inventory<\/code><\/pre>\n<p>  <\/p>\n<p>\u0417\u0430\u0442\u0435\u043c \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0444\u0430\u0439\u043b \u0432 \u0440\u0430\u0431\u043e\u0447\u0435\u0439 \u043f\u0430\u043f\u043a\u0435, \u0438\u043c\u044f \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0437\u0430\u043a\u0430\u043d\u0447\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u043d\u0430 <i>.vmware.yml<\/i> \u0438\u043b\u0438 <i>.vmware.yaml<\/i>. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440:<\/p>\n<p>  <\/p>\n<pre><code class=\"cs\">plugin: vmware_vm_inventory strict: False hostname: 10.10.10.10 username: admin@vsphere.local password: AdminSecur3P@ssw0rd validate_certs: False with_tags: True<\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0447\u0435\u0433\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c:<\/p>\n<p>  <\/p>\n<pre><code class=\"cs\">ansible-inventory --list -i &lt;filename&gt;.vmware.yml<\/code><\/pre>\n<p>  <\/p>\n<h2>\u041c\u043e\u0434\u0443\u043b\u0438<\/h2>\n<p>  <\/p>\n<h6>vmware_guest<\/h6>\n<p>  <\/p>\n<p>\u042d\u0442\u043e\u0442 \u043c\u043e\u0434\u0443\u043b\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f:<\/p>\n<p>  <\/p>\n<ul>\n<li>\u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043d\u043e\u0432\u044b\u0445 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0445 \u043c\u0430\u0448\u0438\u043d \u0438\u0437 \u0448\u0430\u0431\u043b\u043e\u043d\u043e\u0432 \u0438\u043b\u0438 \u0434\u0440\u0443\u0433\u0438\u0445 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0445 \u043c\u0430\u0448\u0438\u043d<\/li>\n<li>\u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435\u043c \u043f\u0438\u0442\u0430\u043d\u0438\u044f \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0439 \u043c\u0430\u0448\u0438\u043d\u044b<\/li>\n<li>\u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435\u043c \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u043e\u0432 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0439 \u043c\u0430\u0448\u0438\u043d\u044b<\/li>\n<li>\u043f\u0435\u0440\u0435\u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u0438\u0435 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0439 \u043c\u0430\u0448\u0438\u043d\u044b<\/li>\n<li>\u0443\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0439 \u043c\u0430\u0448\u0438\u043d\u044b \u0441\u043e \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u043c\u0438 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430\u043c\u0438<\/li>\n<li>\u0438 \u043c\u043d\u043e\u0433\u043e\u0433\u043e \u0434\u0440\u0443\u0433\u043e\u0433\u043e<\/li>\n<\/ul>\n<p>  <\/p>\n<p>\u041e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b:<\/p>\n<p>  <\/p>\n<div class=\"scrollable-table\">\n<table>\n<tr>\n<th>hostname  <\/th>\n<th>DNS-\u0438\u043c\u044f \u0438\u043b\u0438 IP-\u0430\u0434\u0440\u0435\u0441 \u0445\u043e\u0441\u0442\u0430 ESXI-\u0441\u0435\u0440\u0432\u0435\u0440\u0430  <\/th>\n<\/tr>\n<tr>\n<td>username  <\/td>\n<td>\u043b\u043e\u0433\u0438\u043d \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0434\u043b\u044f \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f  <\/td>\n<\/tr>\n<tr>\n<td>password  <\/td>\n<td>\u043f\u0430\u0440\u043e\u043b\u044c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0434\u043b\u044f \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f  <\/td>\n<\/tr>\n<tr>\n<td>validate_certs  <\/td>\n<td>\u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u0438 \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u0430  <\/td>\n<\/tr>\n<tr>\n<td>datacenter  <\/td>\n<td>datacenter \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0439 \u043c\u0430\u0448\u0438\u043d\u044b  <\/td>\n<\/tr>\n<tr>\n<td>cluster  <\/td>\n<td>\u043a\u043b\u0430\u0441\u0442\u0435\u0440 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0439 \u043c\u0430\u0448\u0438\u043d\u044b  <\/td>\n<\/tr>\n<tr>\n<td>name  <\/td>\n<td>\u0438\u043c\u044f \u0446\u0435\u043b\u0435\u0432\u043e\u0439 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0439 \u043c\u0430\u0448\u0438\u043d\u044b  <\/td>\n<\/tr>\n<tr>\n<td>template  <\/td>\n<td>\u0438\u043c\u044f \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0439 \u043c\u0430\u0448\u0438\u043d\u044b \u0438\u043b\u0438 \u0448\u0430\u0431\u043b\u043e\u043d\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u043a\u043b\u043e\u043d\u0438\u0440\u043e\u0432\u0430\u043d  <\/td>\n<\/tr>\n<tr>\n<td>folder  <\/td>\n<td>\u0446\u0435\u043b\u0435\u0432\u043e\u0435 \u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0439 \u043c\u0430\u0448\u0438\u043d\u044b  <\/td>\n<\/tr>\n<tr>\n<td>annotation  <\/td>\n<td>\u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0438\u043b\u0438 \u043f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u0435 \u0434\u043b\u044f \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0439 \u043c\u0430\u0448\u0438\u043d\u044b  <\/td>\n<\/tr>\n<tr>\n<td>datastore  <\/td>\n<td>\u0446\u0435\u043b\u0435\u0432\u043e\u0439 datastore  <\/td>\n<\/tr>\n<tr>\n<td>networks  <\/td>\n<td>\u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0441\u0435\u0442\u0438 \u0434\u043b\u044f \u043d\u043e\u0432\u043e\u0439 \u043c\u0430\u0448\u0438\u043d\u044b  <\/td>\n<\/tr>\n<tr>\n<td>customization  <\/td>\n<td>\u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440, \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0449\u0438\u0439 \u043a\u0430\u0441\u0442\u043e\u043c\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0433\u043e\u0441\u0442\u0435\u0432\u0443\u044e \u041e\u0421  <\/td>\n<\/tr>\n<tr>\n<td>hardware  <\/td>\n<td>\u043a\u0430\u0441\u0442\u043e\u043c\u0438\u0437\u0430\u0446\u0438\u044f hardware \u043c\u0430\u0448\u0438\u043d\u044b  <\/td>\n<\/tr>\n<\/table>\n<\/div>\n<p>  <\/p>\n<p>\u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043f\u0440\u0438\u043c\u0435\u0440 \u043a\u043b\u043e\u043d\u0438\u0440\u0443\u0435\u0442 \u043c\u0430\u0448\u0438\u043d\u0443, \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u0442 \u0441\u0435\u0442\u0435\u0432\u044b\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0438 \u0434\u043e\u0436\u0434\u0435\u0442\u0441\u044f \u043c\u043e\u043c\u0435\u043d\u0442\u0430, \u043a\u043e\u0433\u0434\u0430 \u043d\u0430 \u043d\u0435\u0439 \u0431\u0443\u0434\u0435\u0442 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u0430 \u0441\u0435\u0442\u044c:<\/p>\n<p>  <\/p>\n<pre><code class=\"cs\">- name: \u041a\u043b\u043e\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043c\u0430\u0448\u0438\u043d\u044b \u0438\u0437 \u0448\u0430\u0431\u043b\u043e\u043d\u0430   vmware_guest:     hostname: &quot;{{ vcenter_server }}&quot;     username: &quot;{{ vcenter_user }}&quot;     password: &quot;{{ vcenter_pass }}&quot;     validate_certs: False     datacenter: datacenter1     cluster: cluster1     name: VMNAME     template: TemplateName     folder: \/dc1\/vm\/targetFolder     annotation: &quot;\u041c\u043e\u044f \u043c\u0430\u0448\u0438\u043d\u0430, \u043a\u043b\u043e\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u0430\u044f \u0438\u0437 TemplateName&quot;     datastore: DATASTORE1     networks:       - name: VM Network         ip: '10.10.100.100'         netmask: '255.255.252.0'         gateway: '10.10.100.10'         dns_servers: [1.1.1.1, 8.8.8.8]         type: static     customization:       hostname: &quot;VMNAME.domain.ru&quot;       dns_servers: [1.1.1.1, 8.8.8.8]     wait_for_ip_address: yes<\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0430\u044f \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f \u0438 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u044b \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b \u043f\u043e <a href=\"https:\/\/docs.ansible.com\/ansible\/latest\/modules\/vmware_guest_module.html\">\u0441\u0441\u044b\u043b\u043a\u0435<\/a>.<\/p>\n<p>  <\/p>\n<p>\u0414\u043b\u044f \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u043a\u0430\u0441\u0442\u043e\u043c\u0438\u0437\u0430\u0446\u0438\u0438 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u0435\u0441\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0443\u0441\u043b\u043e\u0432\u0438\u0439:<\/p>\n<p>  <\/p>\n<ol>\n<li>\u041e\u043f\u0435\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u0430\u044f \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u0434\u043e\u043b\u0436\u043d\u0430 \u0431\u044b\u0442\u044c \u0432 \u0441\u043f\u0438\u0441\u043a\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u043c\u044b\u0445. \u041e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u0442\u044c\u0441\u044f \u0441 \u043c\u0430\u0442\u0440\u0438\u0446\u0435\u0439 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0438 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0445 \u0441\u0438\u0441\u0442\u0435\u043c \u043c\u043e\u0436\u043d\u043e \u043f\u043e <a href=\"https:\/\/partnerweb.vmware.com\/programs\/guestOS\/guest-os-customization-matrix.pdf\">\u0441\u0441\u044b\u043b\u043a\u0435<\/a><\/li>\n<li>\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u044b\u0435 VMware Tools<\/li>\n<li>\u041d\u0430 Linux-base \u0434\u0438\u0441\u0442\u0440\u0438\u0431\u0443\u0442\u0438\u0432\u0430\u0445 \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d Perl<\/li>\n<li>\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u0430 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0430\u044f \u0432\u0435\u0440\u0441\u0438\u0438 \u041e\u0421 Microsoft System Preparation (Sysprep) \u0434\u043b\u044f Windows-\u0434\u0438\u0441\u0442\u0440\u0438\u0431\u0443\u0442\u0438\u0432\u043e\u0432<\/li>\n<\/ol>\n<p>  <\/p>\n<h6>vmware_guest_info<\/h6>\n<p>  <\/p>\n<p>\u0414\u0430\u043d\u043d\u044b\u0439 \u043c\u043e\u0434\u0443\u043b\u044c \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u043e \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0439 \u043c\u0430\u0448\u0438\u043d\u0435, \u0447\u0442\u043e \u0434\u0430\u0435\u0442 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043a\u043e\u043c\u0431\u0438\u043d\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0435\u0433\u043e \u0441 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u043c.<\/p>\n<p>  <\/p>\n<p>\u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0442\u0430\u043a \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u043f\u0435\u0440\u0435\u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u0438\u0435 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0439 \u043c\u0430\u0448\u0438\u043d\u044b:<\/p>\n<p>  <\/p>\n<pre><code class=\"cs\">- name: \u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c uuid \u043c\u0430\u0448\u0438\u043d\u044b \u043f\u043e \u0438\u043c\u0435\u043d\u0438   vmware_guest_facts:     hostname: &quot;{{ vcenter_server }}&quot;     username: &quot;{{ vcenter_user }}&quot;     password: &quot;{{ vcenter_pass }}&quot;     validate_certs: False     datacenter: datacenter1     folder: \/dc1\/vm\/targetFolder     name: VMNAME   register: vm_facts - name: \u041f\u0435\u0440\u0435\u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u0438\u0435 \u043c\u0430\u0448\u0438\u043d\u044b   vmware_guest:     hostname: &quot;{{ vcenter_server }}&quot;     username: &quot;{{ vcenter_user }}&quot;     password: &quot;{{ vcenter_pass }}&quot;     validate_certs: False     cluster: cluster1     uuid: &quot;{{ vm_facts.instance.hw_product_uuid }}&quot;     name: NEW_VM_NAME<\/code><\/pre>\n<p>  <\/p>\n<p><a href=\"https:\/\/docs.ansible.com\/ansible\/latest\/modules\/vmware_guest_info_module.html\">\u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0430\u044f \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f.<\/a><\/p>\n<p>  <\/p>\n<p>\u0413\u043b\u0430\u0432\u043d\u044b\u043c \u043f\u043b\u044e\u0441\u043e\u043c \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0442\u043e, \u0447\u0442\u043e \u043f\u043e\u0441\u043b\u0435 \u043a\u043b\u043e\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043c\u0430\u0448\u0438\u043d\u044b \u0438\u043c\u0435\u0435\u0442\u0441\u044f \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u0442\u044c \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0443 \u0443\u0436\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u044b, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c rabbitmq, \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u043f\u0440\u0430\u0432\u0438\u043b\u0430 firewall \u0438 \u0434\u0440. \u0412 \u0441\u043b\u0443\u0447\u0430\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u0435\u0441\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0441\u0432\u043e\u0439 \u043c\u043e\u0434\u0443\u043b\u044c \u0434\u043b\u044f Ansible \u043d\u0430 Python. \u0412\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 Python c VMware \u0431\u044b\u043b\u043e \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u043e \u0432 <a href=\"https:\/\/habr.com\/ru\/company\/avanpost\/blog\/478024\/\">\u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0439 \u0441\u0442\u0430\u0442\u044c\u0435<\/a>.<\/p>\n<p>  <\/p>\n<p>\u041e\u0431\u044a\u0435\u0434\u0438\u043d\u0438\u043c \u0432\u0441\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u044b \u0432\u044b\u0448\u0435 \u0438 \u043f\u043e\u0441\u0442\u0430\u0432\u0438\u043c \u0441\u0435\u0431\u0435 \u0442\u0430\u043a\u0443\u044e \u0437\u0430\u0434\u0430\u0447\u0443:<\/p>\n<p>  <\/p>\n<ul>\n<li>\u0420\u0430\u0437\u0432\u0435\u0440\u043d\u0443\u0442\u044c \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u0443\u044e \u043c\u0430\u0448\u0438\u043d\u0443 \u0441 \u041e\u0421 Windows \u0438\u0437 \u0448\u0430\u0431\u043b\u043e\u043d\u0430<\/li>\n<li>\u0417\u0430\u0434\u0430\u0442\u044c \u0430\u0442\u0440\u0438\u0431\u0443\u0442 <i>owner<\/i> \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0439 \u043c\u0430\u0448\u0438\u043d\u044b<\/li>\n<li>\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u043d\u0430 \u043d\u0435\u0435 7-zip \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043c\u043e\u0434\u0443\u043b\u044f <i>win_get_url<\/i><\/li>\n<li>\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u043d\u0430 \u043d\u0435\u0435 postgresql \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043c\u043e\u0434\u0443\u043b\u044f <i>win_chocolatey<\/i><\/li>\n<\/ul>\n<p>  <\/p>\n<pre><code class=\"cs\">- name: \u041a\u043b\u043e\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 VM \u0438\u0437 \u0448\u0430\u0431\u043b\u043e\u043d\u0430   vmware_guest:     hostname: &quot;{{ vcenter_server }}&quot;     username: &quot;{{ vcenter_user }}&quot;     password: &quot;{{ vcenter_pass }}&quot;     validate_certs: False     datacenter: datacenter1     cluster: cluster1     name: VMNAME     template: TemplateName     folder: \/dc1\/vm\/targetFolder     annotation: &quot;\u041c\u043e\u044f \u043c\u0430\u0448\u0438\u043d\u0430, \u043a\u043b\u043e\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u0430\u044f \u0438\u0437 TemplateName&quot;     datastore: DATASTORE1     networks:       - name: VM Network         ip: '10.10.100.100'         netmask: '255.255.252.0'         gateway: '10.10.100.10'         dns_servers: [1.1.1.1, 8.8.8.8]         type: static     customization:       hostname: &quot;VMNAME.domain.ru&quot;       dns_servers: [1.1.1.1, 8.8.8.8]     wait_for_ip_address: yes   register: vm_facts  - name: \u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u0430\u0442\u0442\u0440\u0438\u0431\u0443\u0442\u0430 owner   vmware_guest_custom_attributes:     hostname: &quot;{{ vcenter_server }}&quot;     username: &quot;{{ vcenter_user }}&quot;     password: &quot;{{ vcenter_pass }}&quot;     validate_certs: False     name: VMNAME     uuid: &quot;{{ vm_facts.instance.hw_product_uuid }}&quot;     state: present     attributes:       - name: &quot;Owner&quot;         value: IIvanov  # \u0414\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043d\u043e\u0432\u043e\u0433\u043e ansible-\u0445\u043e\u0441\u0442\u0430 - name: Add new host   add_host:     name: '10.10.100.100'     ansible_host: '10.10.100.100'     ansible_user: &quot;{{ login }}&quot;     ansible_password: &quot;{{ password }}&quot;     ansible_connection: winrm     ansible_winrm_transport: basic  # \u041e\u0436\u0438\u0434\u0430\u043d\u0438\u0435 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u043c\u0430\u0448\u0438\u043d\u044b \u0438 \u043e\u0442\u0432\u0435\u0442\u0430 \u043e\u0442 \u043d\u0435\u0435 - name: Ansible ping   win_ping:   delegate_to: '10.10.100.100'   register: result   until: result.ping == &quot;pong&quot;   retries: 20   delay: 6  # \u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 7-Zip \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e win_package - name: \u0421\u043a\u0430\u0447\u0438\u0432\u0430\u043d\u0438\u0435 7-zip   win_get_url:     url: https:\/\/www.7-zip.org\/a\/7z1701-x64.msi     dest: C:\\temp\\7z.msi   delegate_to: '10.10.100.100'  - name: \u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 7-zip   win_package:     path: C:\\temp\\7z.msi     state: present   delegate_to: '10.10.100.100'  - name: \u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 postgresql \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e chokolatey   win_chocolatey:     name: postgresql     state: present   delegate_to: '10.10.100.100'<\/code><\/pre>\n<p>  <\/p>\n<p>\u0414\u0430\u043d\u043d\u044b\u0439 \u043f\u043e\u0434\u0445\u043e\u0434 \u0445\u043e\u0440\u043e\u0448\u043e \u043b\u043e\u0436\u0438\u0442\u0441\u044f \u043d\u0430 \u043c\u043e\u0434\u0435\u043b\u044c \u00ab\u0418\u043d\u0444\u0440\u0430\u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u043a\u0430\u043a \u043a\u043e\u0434 (IaC)\u00bb, \u0441\u043e\u0433\u043b\u0430\u0441\u043d\u043e \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0432 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 \u0440\u0430\u0437\u0432\u0435\u0440\u0442\u044b\u0432\u0430\u043d\u0438\u044f \u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0438\u043d\u0444\u0440\u0430\u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u0442\u0435 \u0436\u0435 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0438 \u0438 \u043c\u0435\u0442\u043e\u0434\u043e\u043b\u043e\u0433\u0438\u0438, \u0447\u0442\u043e \u0438 \u0432 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0435 \u041f\u041e. Playbook&#8217;\u0438 \u0443\u0434\u043e\u0431\u043d\u043e \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0432 \u0441\u0438\u0441\u0442\u0435\u043c\u0430\u0445 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u044f \u0432\u0435\u0440\u0441\u0438\u0439, \u0447\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u0442\u044c \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u0439 \u043a \u0438\u043d\u0444\u0440\u0430\u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0435 \u0445\u0440\u043e\u043d\u043e\u043b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u0438. \u041c\u043e\u0436\u043d\u043e \u0442\u0430\u043a \u0436\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043c\u0435\u0442\u043e\u0434\u043e\u043b\u043e\u0433\u0438\u044e code-review \u0434\u043b\u044f \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0435\u043d\u0438\u044f \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0433\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0432.<\/p>\n<p>  <\/p>\n<p>\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u043c \u043c\u043e\u0436\u0435\u0442 \u0441\u043b\u0443\u0436\u0438\u0442\u044c \u0431\u044b\u0441\u0442\u0440\u043e\u0435, \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0435 \u0438 \u0432\u043e\u0441\u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u043c\u043e\u0435 \u0440\u0430\u0437\u0432\u0435\u0440\u0442\u044b\u0432\u0430\u043d\u0438\u0435 \u0442\u0435\u0441\u0442\u043e\u0432\u044b\u0445, staging, production \u043c\u0430\u0448\u0438\u043d \u0438 \u0441\u0440\u0435\u0434.<\/p>\n<\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/company\/avanpost\/blog\/498304\/\"> https:\/\/habr.com\/ru\/company\/avanpost\/blog\/498304\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/company\/avanpost\/blog\/498304\/\">\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/tv\/8h\/nn\/tv8hnnkbtd6xaejjwtdwodwplga.jpeg\" alt=\"image\"><\/div>\n<p>  <\/p>\n<p>\u0412 <a href=\"https:\/\/habr.com\/ru\/company\/avanpost\/blog\/478024\/\">\u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0439 \u0441\u0442\u0430\u0442\u044c\u0435<\/a> \u043c\u044b \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043b\u0438 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u0441 VMware \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e Python. \u0412 \u044d\u0442\u043e\u0439 \u0436\u0435 \u043e\u0431\u0441\u0443\u0434\u0438\u043c \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u0441 VMware \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e Ansible.<\/p>\n<p>  <\/p>\n<p>Ansible \u2014 \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044f\u043c\u0438, \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u0430\u044f \u043d\u0430 \u044f\u0437\u044b\u043a\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f Python \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0434\u0435\u043a\u043b\u0430\u0440\u0430\u0442\u0438\u0432\u043d\u043e\u0433\u043e \u044f\u0437\u044b\u043a\u0430 \u0440\u0430\u0437\u043c\u0435\u0442\u043a\u0438 \u0434\u043b\u044f \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0439. \u041f\u0440\u043e Ansible \u043d\u0430 \u0425\u0430\u0431\u0440\u0435 \u0443\u0436\u0435 \u0435\u0441\u0442\u044c \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u0441\u0442\u0430\u0442\u0435\u0439, \u043d\u043e \u0441\u0442\u043e\u0438\u0442 \u0435\u0449\u0435 \u0440\u0430\u0437 \u0443\u043f\u043e\u043c\u044f\u043d\u0443\u0442\u044c, \u0447\u0442\u043e \u043e\u0434\u043d\u0438\u043c \u0438\u0437 \u043a\u043b\u044e\u0447\u0435\u0432\u044b\u0445 \u0441\u0432\u043e\u0439\u0441\u0442\u0432 playbook&#8217;a \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0438\u0434\u0435\u043c\u043f\u043e\u0442\u0435\u043d\u0442\u043d\u043e\u0441\u0442\u044c. \u042d\u0442\u043e \u0437\u043d\u0430\u0447\u0438\u0442, \u0447\u0442\u043e \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0431\u044b \u0440\u0430\u0437 \u043f\u043e\u0434\u0440\u044f\u0434 \u0432\u044b \u043d\u0435 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u043b\u0438 \u0441\u0432\u043e\u0439 playbook, \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0431\u0443\u0434\u0435\u0442 \u043e\u0434\u0438\u043d \u0438 \u0442\u043e\u0442 \u0436\u0435.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-302251","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/302251","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=302251"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/302251\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=302251"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=302251"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=302251"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}