{"id":369318,"date":"2024-05-21T04:00:46","date_gmt":"2024-05-21T04:00:46","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=369318"},"modified":"-0001-11-30T00:00:00","modified_gmt":"2024-05-21T04:00:46","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=369318","title":{"rendered":"<span>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043d\u043e\u0432\u044b\u0445 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u043e\u0432 Nextcloud\u00a0 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0432 Ansible<\/span>"},"content":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u0412\u0441\u0435\u043c \u043f\u0440\u0438\u0432\u0435\u0442!\u00a0\u0425\u043e\u0447\u0443 \u043f\u043e\u0434\u0435\u043b\u0438\u0442\u044c\u0441\u044f \u0441 \u0432\u0430\u043c\u0438 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u043c \u0441\u043a\u0440\u0438\u043f\u0442\u0430 \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u043e\u0432 Nextcloud \u0447\u0435\u0440\u0435\u0437 Ansible \u0432 vCloudDirector. \u0417\u0430\u043e\u0434\u043d\u043e \u043e\u043f\u0438\u0448\u0443 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u043e\u0432 Nextcloud. \u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u0443 \u0432\u0430\u0441 \u0442\u043e\u0436\u0435 \u0431\u044b\u0432\u0430\u044e\u0442 \u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0435 \u0437\u0430\u0434\u0430\u0447\u0438, \u2014 \u043c\u043e\u0436\u0435\u0442\u0435 \u043d\u0435 \u0438\u0437\u043e\u0431\u0440\u0435\u0442\u0430\u0442\u044c \u0435\u0449\u0451 \u043e\u0434\u0438\u043d \u0432\u0435\u043b\u043e\u0441\u0438\u043f\u0435\u0434, \u0432\u043e\u0442 \u043e\u0434\u0438\u043d \u0438\u0437 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u0432 \u0440\u0435\u0448\u0435\u043d\u0438\u044f. <\/p>\n<p>\u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u043f\u0440\u0438\u0432\u0435\u0434\u0443 \u0441\u0445\u0435\u043c\u0443 \u0438\u043d\u0444\u0440\u0430\u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0431\u0443\u0434\u0443\u0442 \u0440\u0430\u0437\u0432\u043e\u0440\u0430\u0447\u0438\u0432\u0430\u0442\u044c\u0441\u044f \u043d\u043e\u0432\u044b\u0435 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u044b Nextcloud.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/getpro\/habr\/upload_files\/247\/83c\/426\/24783c426205fe9020a7c4a66bdc1f32.jpeg\" width=\"689\" height=\"814\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/247\/83c\/426\/24783c426205fe9020a7c4a66bdc1f32.jpeg\" data-blurred=\"true\"\/><\/figure>\n<p>\u0414\u043e\u0431\u0430\u0432\u043b\u044e \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e\u0441\u0442\u0435\u0439, \u0447\u0442\u043e\u0431\u044b \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0430 \u0441\u0442\u0430\u043b\u0430 \u043f\u043e\u043d\u044f\u0442\u043d\u0435\u0435.<\/p>\n<p>\u0412\u0441\u0435 \u0441\u0435\u0440\u0432\u0435\u0440\u044b \u0432 \u0438\u043d\u0444\u0440\u0430\u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0435 \u2014 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0435, \u0440\u0430\u0437\u0432\u0451\u0440\u043d\u0443\u0442\u044b \u0432 Vmware Cloud Director (\u0434\u0430\u043b\u0435\u0435 VCD). \u041e\u043d\u0438 \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442 \u043f\u043e\u0434 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435\u043c \u041e\u0421 Ubuntu 20.04. \u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 reverse proxy \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0432\u0435\u0431-\u0441\u0435\u0440\u0432\u0435\u0440 Nginx.\u00a0<\/p>\n<p>\u041d\u043e\u0432\u044b\u0435 \u0440\u0430\u0437\u0432\u043e\u0440\u0430\u0447\u0438\u0432\u0430\u0435\u043c\u044b\u0435 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u044b Nextcloud \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u044b \u043d\u0430 \u0441\u0445\u0435\u043c\u0435 \u043a\u0430\u043a Nextcloud Instances. \u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0441\u043a\u0440\u0438\u043f\u0442\u0430 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043d\u043e\u0432\u044b\u0445 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u043e\u0432 Nextcloud \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f Scripts. \u042d\u0442\u043e\u0442 \u0441\u0435\u0440\u0432\u0435\u0440 \u0438\u043c\u0435\u0435\u0442 ssh \u0434\u043e\u0441\u0442\u0443\u043f\u044b \u043f\u043e \u043a\u043b\u044e\u0447\u0443 \u043d\u0430 Nginx \u0438 \u0432\u0441\u0435 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0435\u043c\u044b\u0435 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u044b. \u0422\u0430\u043a\u0436\u0435 Scripts \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u0441\u044b\u043b\u0430\u0442\u044c API \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u043a Vmware Cloud Director.\u00a0<\/p>\n<p>\u0414\u043b\u044f \u0434\u043e\u0441\u0442\u0443\u043f\u043e\u0432 \u043a \u0438\u043d\u0442\u0435\u0440\u043d\u0435\u0442\u0443 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f NSX EDGE Gateway, \u0430 \u0434\u043b\u044f \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0434\u043e\u043c\u0435\u043d\u043d\u044b\u0445 \u0438\u043c\u0451\u043d \u2014 \u043f\u0443\u0431\u043b\u0438\u0447\u043d\u044b\u0439 DNS \u0441\u0435\u0440\u0432\u0435\u0440 (\u043e\u043d \u0442\u0430\u043a \u0438 \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0435\u043d \u043d\u0430 \u0441\u0445\u0435\u043c\u0435). \u0412\u0441\u0435 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u044b Nextcloud \u043d\u0430\u0445\u043e\u0434\u044f\u0442\u0441\u044f \u0432 \u043e\u0434\u043d\u043e\u043c \u0434\u043e\u043c\u0435\u043d\u0435 domainname.com. \u0412\u043c\u0435\u0441\u0442\u043e \u044d\u0442\u043e\u0433\u043e \u0438\u043c\u0435\u043d\u0438 \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u0432\u0430\u0448 \u0434\u043e\u043c\u0435\u043d. \u0422\u0430\u043a\u0436\u0435 \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u0430\u0433\u0430\u0435\u0442\u0441\u044f, \u0447\u0442\u043e SSL \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u044b \u043d\u0430 \u0434\u043e\u043c\u0435\u043d domainname.com \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u044b \u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u044b \u043d\u0430 Nginx.<\/p>\n<h3>\u0421\u043a\u0440\u0438\u043f\u0442 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043d\u043e\u0432\u044b\u0445 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u043e\u0432 Nextcloud<\/h3>\n<p>\u0421\u043a\u0440\u0438\u043f\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u043d\u0430 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u043c \u0441\u0435\u0440\u0432\u0435\u0440\u0435 Scripts. \u041d\u0430 \u043d\u0451\u043c \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d Ansible \u0441 \u043c\u043e\u0434\u0443\u043b\u0435\u043c ansible-module-vcloud-director \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 API VCD. \u041e\u043d \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0438\u0437 \u0433\u043b\u0430\u0432\u043d\u043e\u0433\u043e \u0441\u043a\u0440\u0438\u043f\u0442\u0430 \u043d\u0430 bash \u0438 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0445 \u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0432 \u0434\u043b\u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u044b\u0445 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0439 \u043d\u0430 Ansible \u0438 Python. \u0412\u043e\u0442 \u0438\u0445 \u0441\u043f\u0438\u0441\u043e\u043a:<\/p>\n<ol>\n<li>\n<p><strong>create_instances_nextcloud.sh<\/strong><\/p>\n<\/li>\n<li>\n<p><strong>create_vapp.yml<\/strong><\/p>\n<\/li>\n<li>\n<p><strong>create_vm_in_vapp.yml<\/strong><\/p>\n<\/li>\n<li>\n<p><strong>list_nics.ym<\/strong>l<\/p>\n<\/li>\n<li>\n<p><strong>insert_txt.py<\/strong><\/p>\n<\/li>\n<li>\n<p><strong>config_next.yml<\/strong><\/p>\n<\/li>\n<li>\n<p><strong>config_nginx.yml<\/strong><\/p>\n<\/li>\n<li>\n<p><strong>nextcloud_template_tls<\/strong><\/p>\n<\/li>\n<\/ol>\n<p>\u0421\u043a\u0440\u0438\u043f\u0442 <strong>create_instances_nextcloud.sh \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0442\u0430\u043a<\/strong>:<\/p>\n<pre><code>#!\/bin\/bash ansible-playbook create_vapp.yml --extra-vars \"orgname=$1\" ansible-playbook create_vm.yml --extra-vars \"orgname=$1\" ip=$(ansible-playbook list_nics.yml --extra-vars \"orgname=$1\" 2>&amp;1 | grep '\"ip_address\":' | grep -E -o '[0-9]{1,3}(\\.[0-9]{1,3}){3}') last_name_conf_next=\"nextcloud_tls\" name_config_next=\"$1$last_name_conf_next\" echo \"[$1]\" >> ansible_hosts echo \"$ip\" >> ansible_hosts cp nextcloud_template_tls \"$name_config_next\" .\/insert_txt.py $1 $ip $name_config_next last_domain_name_nextcloud=\"next.domainname.com\" domain_name_nextcloud=\"$1$last_domain_name_nextcloud\" scp $name_config_next root@192.168.4.3:\/etc\/nginx\/sites-available ansible-playbook config_nginx.yml --extra-vars \"name_config_next=$name_config_next\" sleep 60 ansible-playbook config_next.yml --extra-vars \"orgname=$1 ip=$ip domain_name_nextcloud=$domain_name_nextcloud password=$2\"<\/code><\/pre>\n<p>\u0421\u043a\u0440\u0438\u043f\u0442 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u0434\u0432\u0430 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430:<\/p>\n<ol>\n<li>\n<p>\u0418\u043c\u044f \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u0430 Nextcloud. \u042f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441\u0443\u0444\u0444\u0438\u043a\u0441\u043e\u043c \u043a \u0434\u043e\u043c\u0435\u043d\u043d\u043e\u043c\u0443 \u0438\u043c\u0435\u043d\u0438 next.domainname.com<\/p>\n<\/li>\n<li>\n<p>\u041f\u0430\u0440\u043e\u043b\u044c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f admin \u0432 Nextcloud<\/p>\n<\/li>\n<\/ol>\n<p>\u0412\u043e \u0432\u0442\u043e\u0440\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0435 \u0441\u043a\u0440\u0438\u043f\u0442\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f ansible playbook create_vapp.yml. \u041e\u043d \u043d\u0443\u0436\u0435\u043d \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043d\u043e\u0432\u043e\u0433\u043e vApp \u0432 VCD. \u041f\u0440\u0438\u0432\u0435\u0434\u0443 \u0435\u0433\u043e \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u043d\u0438\u0435:<\/p>\n<pre><code>- name: vCloudDirectorAnsible   hosts: localhost   environment:        env_user: admin        env_password: password        env_host: vcd.domainname.ru            ## VCD Instance URL        env_org: name_org             ## VCD ORG to login ##      env_api_version: PYVCLOUD_API_VERSION        env_verify_ssl_certs: false   tasks:   - name: create vapp     vcd_vapp:       vapp_name: \"{{ orgname }}Nextcloud\"       vdc: \"name_VDC\"       description: \"name_VDC\"       network: \"name_network\"       deploy: true       power_on: true       accept_all_eulas: false       state: \"present\"<\/code><\/pre>\n<p>Playbook \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 \u201corgname\u201d, \u0447\u0442\u043e \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441\u0443\u0444\u0444\u0438\u043a\u0441\u043e\u043c \u043a \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044e \u043d\u043e\u0432\u043e\u0433\u043e \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u0430 Nextcloud<\/p>\n<p>\u0412 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u201cenvironment\u201d \u0437\u0430\u0434\u0430\u044e\u0442\u0441\u044f \u201ccredentials\u201d, \u0442\u0430\u043a\u0438\u0435 \u043a\u0430\u043a:<\/p>\n<ol>\n<li>\n<p><strong>env_user<\/strong> \u2013 \u0438\u043c\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0441 \u043f\u0440\u0430\u0432\u0430\u043c\u0438 \u0430\u0434\u043c\u0438\u043d\u0438\u0441\u0442\u0440\u0430\u0442\u043e\u0440\u0430 \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u0430\u0446\u0438\u0438<\/p>\n<\/li>\n<li>\n<p><strong>env_password<\/strong> \u2013 \u043f\u0430\u0440\u043e\u043b\u044c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f<\/p>\n<\/li>\n<li>\n<p><strong>env_host<\/strong> \u2013 \u0434\u043e\u043c\u0435\u043d\u043d\u043e\u0435 \u0438\u043c\u044f VCD<\/p>\n<\/li>\n<li>\n<p><strong>env_org<\/strong> \u2013 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u0430\u0446\u0438\u0438 \u0432 VCD<\/p>\n<\/li>\n<\/ol>\n<p>\u0414\u0430\u043b\u0435\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u0437\u0430\u0434\u0430\u0447\u0430 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f vapp. \u0412 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 vcd_vapp \u0432\u0432\u043e\u0434\u044f\u0442\u0441\u044f \u0434\u0430\u043d\u043d\u044b\u0435, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u0434\u043b\u044f \u043d\u043e\u0432\u043e\u0433\u043e vApp:<\/p>\n<ol>\n<li>\n<p><strong>vapp_name<\/strong> \u2013 \u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 vApp \u0441 \u0441\u0443\u0444\u0444\u0438\u043a\u0441\u043e\u043c \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044f \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u0430 Nextcloud \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0435\u043c\u044b\u0439 \u0432 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 orgname<\/p>\n<\/li>\n<li>\n<p><strong>vdc<\/strong> \u2013 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 VDC \u0433\u0434\u0435 \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c\u0441\u044f \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 Nextcloud<\/p>\n<\/li>\n<li>\n<p><strong>description<\/strong> \u2013 \u043e\u043f\u0438c\u0430\u043d\u0438\u0435 vApp (\u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043b\u044e\u0431\u044b\u043c)<\/p>\n<\/li>\n<li>\n<p><strong>network<\/strong> \u2013 \u0438\u043c\u044f \u0441\u0435\u0442\u0438 \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u043a vApp<\/p>\n<\/li>\n<li>\n<p><strong>power_on<\/strong> \u2013 \u0432\u043a\u043b\u044e\u0447\u0438\u0442\u044c vApp \u043f\u043e\u0441\u043b\u0435 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f<\/p>\n<\/li>\n<li>\n<p><strong>state<\/strong> \u2013 <strong>present<\/strong> \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442 \u0447\u0442\u043e \u043d\u0443\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c vApp<\/p>\n<\/li>\n<\/ol>\n<p>\u0414\u0430\u043b\u0435\u0435 \u0432 \u0441\u043a\u0440\u0438\u043f\u0442\u0435 create_instances_nextcloud.sh (3 \u0441\u0442\u0440\u043e\u043a\u0430) \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f playbook create_vm.yml \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0439 \u043c\u0430\u0448\u0438\u043d\u044b \u0432 \u0440\u0430\u043d\u0435\u0435 \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u043e\u043c vApp. \u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0439 \u043c\u0430\u0448\u0438\u043d\u044b \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0438\u0437 \u0437\u0430\u0440\u0430\u043d\u0435\u0435 \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u0448\u0430\u0431\u043b\u043e\u043d\u0430 \u0412\u041c \u0441 Nextcloud. \u0412\u043e\u0442 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u043d\u0438\u0435 playbook:<\/p>\n<pre><code>- name: vCloudDirectorAnsible   hosts: localhost   environment:        env_user: name_admin        env_password: password        env_host: vcd.domainname.ru            ## VCD Instance URL        env_org: name_VDC             ## VCD ORG to login ##      env_api_version: PYVCLOUD_API_VERSION        env_verify_ssl_certs: false   tasks:   - name: create vapp vm from catalog     vcd_vapp_vm:       target_vm_name: \"{{ orgname }}Nextcloud\"       target_vapp: \"{{ orgname }}Nextcloud\"       target_vdc: name_VDC       source_vdc: \"name_source_VDC\"       source_catalog_name: name_Catalog       source_template_name: template_name       source_vm_name: source_vm_name       hostname: \"{{ orgname }}Nextcloud\"       ip_allocation_mode: \"POOL\"       power_on: \"true\"       all_eulas_accepted: \"true\"       network: network_name       deploy: false       state: \"present\"<\/code><\/pre>\n<p>Playbook \u043a\u0430\u043a \u0438 \u0432 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u043e\u0434\u0438\u043d \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440: \u201corgname\u201d.<\/p>\n<p>\u041a\u0430\u043a \u0438 \u0432 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u043c playbook \u0432 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u201cenvironment\u201d \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u201ccredentials\u201d. \u0414\u0430\u043b\u0435\u0435 \u0441\u043e\u0437\u0434\u0430\u0451\u0442\u0441\u044f \u0437\u0430\u0434\u0430\u0447\u0430 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0439 \u043c\u0430\u0448\u0438\u043d\u044b \u0432 vApp, \u0433\u0434\u0435 \u0432 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u201cvcd_vapp_vm\u201d \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0435:<\/p>\n<ol>\n<li>\n<p><strong>target_vm_name<\/strong> \u2013 \u0438\u043c\u044f \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0435\u043c\u043e\u0439 \u043c\u0430\u0448\u0438\u043d\u044b \u0441 \u0441\u0443\u0444\u0444\u0438\u043a\u0441\u043e\u043c \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044f \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u0430 Nextcloud, \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0435\u043c\u044b\u043c \u0447\u0435\u0440\u0435\u0437 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e orgname<\/p>\n<\/li>\n<li>\n<p><strong>target_vapp<\/strong> \u2014 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 vApp, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c\u0441\u044f \u0412\u041c, \u0441 \u0441\u0443\u0444\u0444\u0438\u043a\u0441\u043e\u043c \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044f \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u0430 Nextcloud \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0435\u043c\u044b\u043c \u0432 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u201corgname\u201d<\/p>\n<\/li>\n<li>\n<p><strong>target_vdc<\/strong> \u2013 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 VDC, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c\u0441\u044f \u0412\u041c<\/p>\n<\/li>\n<li>\n<p><strong>source_catalog_name<\/strong> \u2013 \u0438\u043c\u044f \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0430, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0448\u0430\u0431\u043b\u043e\u043d<\/p>\n<\/li>\n<li>\n<p><strong>source_template_name<\/strong> \u2013 \u0438\u043c\u044f \u0448\u0430\u0431\u043b\u043e\u043d\u0430 \u0441 Nextcloud, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0437\u0432\u043e\u0440\u0430\u0447\u0438\u0432\u0430\u0442\u044c\u0441\u044f<\/p>\n<\/li>\n<li>\n<p><strong>source_vm_name<\/strong> \u2013 \u0438\u043c\u044f \u0412\u041c, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0432 \u0448\u0430\u0431\u043b\u043e\u043d\u0435<\/p>\n<\/li>\n<li>\n<p><strong>hostname<\/strong> \u2013 \u0441\u0435\u0442\u0435\u0432\u043e\u0435 \u0438\u043c\u044f \u0412\u041c \u0441 \u0441\u0443\u0444\u0444\u0438\u043a\u0441\u043e\u043c \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044f \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u0430 Nextcloud, \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0435\u043c\u044b\u043c \u0447\u0435\u0440\u0435\u0437 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e \u201corgname\u201d<\/p>\n<\/li>\n<li>\n<p>\u00a0<strong>ip_allocation_mode<\/strong> \u2013 \u0441\u043f\u043e\u0441\u043e\u0431 \u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f ip-\u0430\u0434\u0440\u0435\u0441\u0430 \u0412\u041c. \u0412\u044b\u0431\u0440\u0430\u043d \u0441\u043f\u043e\u0441\u043e\u0431 static_ip_pool<\/p>\n<\/li>\n<li>\n<p><strong>power_on<\/strong> \u2013 \u0432\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0438\u043b\u0438 \u043d\u0435\u0442 \u043c\u0430\u0448\u0438\u043d\u0443 \u043f\u043e\u0441\u043b\u0435 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f. \u0412\u044b\u0431\u0440\u0430\u043d\u043e \u201c\u0414\u0430\u201d.<\/p>\n<\/li>\n<li>\n<p><strong>network<\/strong> \u2013 \u0438\u043c\u044f \u0441\u0435\u0442\u0438, \u043a \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0435\u043c\u0443\u044e \u0412\u041c. \u0418\u043c\u044f \u0441\u0435\u0442\u0438 \u0441\u043e\u0432\u043f\u0430\u0434\u0430\u0435\u0442 \u0441 \u0438\u043c\u0435\u043d\u0435\u043c \u0441\u0435\u0442\u0438, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u043a vApp \u043f\u0440\u0438 \u0435\u0433\u043e \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u0432 \u043f\u0440\u043e\u0448\u043b\u043e\u043c playbook.\u00a0<\/p>\n<\/li>\n<li>\n<p><strong>\u00a0State<\/strong> \u2013 \u043f\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0430 present. \u042d\u0442\u043e \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442, \u0447\u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c\u0441\u044f \u043d\u043e\u0432\u0430\u044f \u0412\u041c<\/p>\n<\/li>\n<\/ol>\n<p>\u041d\u0430 \u044d\u0442\u043e\u043c \u044d\u0442\u0430\u043f\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0432\u044b\u0432\u043e\u0434 \u0441\u043a\u0440\u0438\u043f\u0442\u0430 \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0442\u0430\u043a\u0438\u043c:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/60e\/03f\/8d8\/60e03f8d8c206c49ff31f3a65ff5e8d2.png\" width=\"1600\" height=\"346\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/60e\/03f\/8d8\/60e03f8d8c206c49ff31f3a65ff5e8d2.png\"\/><\/figure>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f vApp \u0438 VM \u0432 \u043d\u0451\u043c, \u043d\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0443\u0437\u043d\u0430\u0442\u044c ip-\u0430\u0434\u0440\u0435\u0441, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0430 \u043d\u043e\u0432\u0430\u044f \u0412\u041c \u0438 \u0437\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0435\u0433\u043e \u0432 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e \u201cip\u201d \u043a\u043e\u043c\u0430\u043d\u0434\u043e\u0439 \u0432 \u0441\u0442\u0440\u043e\u043a\u0435 4 \u0441\u043a\u0440\u0438\u043f\u0442\u0430 create_instances_nextcloud.sh. \u0414\u0435\u043b\u0430\u0435\u0442\u0441\u044f \u044d\u0442\u043e \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 playbook \u201clist_nics.yml\u201d. \u0412\u043e\u0442 \u0435\u0433\u043e \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u043d\u0438\u0435:<\/p>\n<pre><code>- name: vCloudDirectorAnsible   hosts: localhost   environment:        env_user: name_admin        env_password: password        env_host: vcd.domainname.ru            ## VCD Instance URL        env_org: name_org             ## VCD ORG to login ##      env_api_version: PYVCLOUD_API_VERSION        env_verify_ssl_certs: false   tasks:     - name: list vapp vm nics       vcd_vapp_vm:         target_vm_name: \"{{ orgname }}Nextcloud\"         target_vapp: \"{{ orgname }}Nextcloud\"         target_vdc: name_VDC         operation: \"list_nics\"       register: command_output     - debug:              var: command_output<\/code><\/pre>\n<p>Playbook \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 \u201corgname\u201d.<\/p>\n<p>\u041a\u0430\u043a \u0438 \u0432 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u0445 playbook \u0432 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u201cenvironment\u201d \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u201ccredentials\u201d . \u0417\u0430\u0442\u0435\u043c \u0441\u043e\u0437\u0434\u0430\u0451\u0442\u0441\u044f \u0437\u0430\u0434\u0430\u0447\u0430 \u043f\u0440\u043e\u0441\u043c\u043e\u0442\u0440\u0430 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u043e \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430\u0445. \u0412 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 vcd_vapp_vm \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u044e\u0442\u0441\u044f:<\/p>\n<ol>\n<li>\n<p><strong>target_vm_name<\/strong> \u2013 \u0438\u043c\u044f \u0412\u041c, \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043f\u043e \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0445\u043e\u0442\u0438\u043c \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c. \u0421\u043e\u0432\u043f\u0430\u0434\u0430\u0435\u0442 \u0441 \u0438\u043c\u0435\u043d\u0435\u043c \u0412\u041c, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0431\u044b\u043b\u0438 \u0443\u043a\u0430\u0437\u0430\u043d\u044b \u0432 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u0445 playbook.<\/p>\n<\/li>\n<li>\n<p><strong>target_vapp \u2013 <\/strong>\u0438\u043c\u044f vApp,\u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0412\u041c<\/p>\n<\/li>\n<li>\n<p><strong>target_vdc \u2013 <\/strong>\u0438\u043c\u044f VDC, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0412\u041c<\/p>\n<\/li>\n<li>\n<p><strong>operation \u2013 <\/strong>\u0442\u0438\u043f \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438. \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u043f\u043e \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430\u043c &#171;list_nics&#187;<\/p>\n<\/li>\n<\/ol>\n<p>\u0414\u0430\u043b\u0435\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0430 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0445 \u0444\u0430\u0439\u043b\u043e\u0432 Nginx. \u0414\u0435\u043b\u0430\u0435\u0442\u0441\u044f \u044d\u0442\u043e \u043f\u0443\u0442\u0451\u043c \u0440\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0435\u0434\u0438\u043d\u043e\u0433\u043e \u0448\u0430\u0431\u043b\u043e\u043d\u0430 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 \u043f\u043e\u0434 \u0438\u043c\u0435\u043d\u0435\u043c nextcloud_template_tls. \u042d\u0442\u043e\u0442 \u0448\u0430\u0431\u043b\u043e\u043d \u0431\u044b\u043b \u0441\u043e\u0437\u0434\u0430\u043d \u0438\u0437 <a href=\"https:\/\/github.com\/nextcloud\/all-in-one\/blob\/main\/reverse-proxy.md\"><u>\u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438<\/u><\/a> \u043f\u0443\u0442\u0451\u043c \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u044f \u0441\u0442\u0440\u043e\u043a\u0438 \u201cserver_name &lt;your-nc-domain>;\u201d \u0438 \u201cproxy_pass http:\/\/127.0.0.1:11000$request_uri; \u201d.\u00a0<\/p>\n<p>\u0412 \u0441\u0442\u0440\u043e\u043a\u0435 5 \u0438 6 \u0441\u043a\u0440\u0438\u043f\u0442\u0430 create_instances_nextcloud.sh \u0437\u0430\u0434\u0430\u0451\u0442\u0441\u044f \u0438\u043c\u044f \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430 Nginx \u0434\u043b\u044f \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u0430 Nextcloud. \u0417\u0430\u0442\u0435\u043c \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0441\u0442\u0440\u043e\u043a\u0438 \u0432 \u0438\u043d\u0432\u0435\u043d\u0442\u0430\u0440\u043d\u044b\u0439 \u0444\u0430\u0439\u043b Ansible \u0434\u043b\u044f \u043d\u043e\u0432\u043e\u0433\u043e \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u0430 Nextcloud \u0432 \u043a\u043e\u043c\u0430\u043d\u0434\u0430\u0445 \u043f\u043e\u0434 \u0441\u0442\u0440\u043e\u043a\u0430\u043c\u0438 7 \u0438 8 \u0441\u043a\u0440\u0438\u043f\u0442\u0430 create_instances_nextcloud.sh.\u00a0<\/p>\n<p>\u0412 \u0441\u0442\u0440\u043e\u043a\u0435 9 \u043a\u043e\u043f\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0448\u0430\u0431\u043b\u043e\u043d \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 Nginx nextcloud_template_tls \u043f\u043e\u0434 \u043d\u043e\u0432\u044b\u043c \u0438\u043c\u0435\u043d\u0435\u043c, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0445\u0440\u0430\u043d\u0438\u0442\u0441\u044f \u0432 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 name_config_next. \u0417\u0430\u0442\u0435\u043c \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u0441\u043a\u0440\u0438\u043f\u0442\u0430 \u043d\u0430 Python insert_txt.py \u0432\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u043d\u0443\u0436\u043d\u044b\u0435 \u0441\u0442\u0440\u043e\u043a\u0438 \u0434\u043b\u044f \u043d\u0430\u0448\u0435\u0433\u043e \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u0430 Nextcloud. \u0412\u043e\u0442 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u043d\u0438\u0435 \u044d\u0442\u043e\u0433\u043e \u0441\u043a\u0440\u0438\u043f\u0442\u0430:<\/p>\n<pre><code>#!\/usr\/bin\/python3.8 import sys def insert(file, line, column, text):     ln, cn = line - 1, column - 1         # offset from human index to Python index     count = 0                             # initial count of characters     with open(file, 'r+') as f:           # open file for reading an writing         for idx, line in enumerate(f):    # for all line in the file             if idx &lt; ln:                  # before the given line                 count += len(line)        # read and count characters              elif idx == ln:               # once at the line                                                  f.seek(count + cn)        # place cursor at the correct character location                 remainder = f.read()      # store all character afterwards                                        f.seek(count + cn)        # move cursor back to the correct character location                 f.write(text + remainder) # insert text and rewrite the remainder                 return                    # You're finished! if __name__ == \"__main__\":   nextcloud_domain_name='server_name ' + sys.argv[1] + 'next.domainname.com;'   directve_proxy_pass_next='proxy_pass https:\/\/' + sys.argv[2] + '$request_uri;'   template_nextcloud=sys.argv[3]   insert(template_nextcloud, 27, 5, nextcloud_domain_name)   insert(template_nextcloud, 30, 9, directve_proxy_pass_next)<\/code><\/pre>\n<p>\u042d\u0442\u043e\u0442 \u0441\u043a\u0440\u0438\u043f\u0442 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 3 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430:<\/p>\n<ol>\n<li>\n<p>\u0421\u0443\u0444\u0444\u0438\u043a\u0441 \u2013 \u0441\u0443\u0444\u0444\u0438\u043a\u0441 \u0438\u043c\u0435\u043d\u0438 \u043d\u043e\u0432\u043e\u0433\u043e \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u0430 Nextcloud. \u042f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441\u0443\u0444\u0444\u0438\u043a\u0441\u043e\u043c \u0434\u043e\u043c\u0435\u043d\u043d\u043e\u0433\u043e \u0438\u043c\u0435\u043d\u0438 next.domainname.com<\/p>\n<\/li>\n<li>\n<p>IP \u0430\u0434\u0440\u0435\u0441 \u2013 ip-\u0430\u0434\u0440\u0435\u0441 \u043d\u043e\u0432\u043e\u0433\u043e \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u0430 Nextcloud<\/p>\n<\/li>\n<li>\n<p>\u0418\u043c\u044f \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430 Nginx \u0434\u043b\u044f Nextcloud<\/p>\n<\/li>\n<\/ol>\n<p>\u0412 \u0438\u0442\u043e\u0433\u0435 \u0434\u0430\u043d\u043d\u044b\u0439 \u0441\u043a\u0440\u0438\u043f\u0442 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442 \u0434\u0438\u0440\u0435\u043a\u0442\u0438\u0432\u044b \u201cserver_name\u201d \u0438 \u201cproxy_pass\u201d \u0432 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0439 \u0444\u0430\u0439\u043b Nginx, \u0433\u0434\u0435 domainname.com \u2014 \u0434\u043e\u043c\u0435\u043d, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0431\u0443\u0434\u0435\u0442 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u044c\u0441\u044f \u0432\u0430\u0448 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 Nextcloud.<\/p>\n<p>\u0414\u0430\u043b\u0435\u0435 \u0432 \u0441\u0442\u0440\u043e\u043a\u0430\u0445 11, 12 \u0441\u043a\u0440\u0438\u043f\u0442\u0430 create_instances_nextcloud.sh \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043e\u0439 domain_name_nextcloud \u043f\u0440\u0438\u0441\u0432\u0430\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0434\u043e\u043c\u0435\u043d\u043d\u043e\u0435 \u0438\u043c\u044f Nextcloud, \u0433\u0434\u0435 domainname.com \u2014 \u0434\u043e\u043c\u0435\u043d, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0431\u0443\u0434\u0435\u0442 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u044c\u0441\u044f \u0432\u0430\u0448 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 Nextcloud.\u00a0<\/p>\n<p>\u0412 \u0441\u0442\u0440\u043e\u043a\u0435 13 \u0441\u043a\u0440\u0438\u043f\u0442\u0430 create_instances_nextcloud.sh \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043b\u0435\u043d\u043d\u044b\u0439 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0439 \u0444\u0430\u0439\u043b \u043a\u043e\u043f\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u043d\u0430 Nginx \u043f\u043e ssh \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u043a\u043e\u043c\u0430\u043d\u0434\u044b scp.\u00a0<\/p>\n<p>\u0412 \u0441\u0442\u0440\u043e\u043a\u0435 14 \u0437\u0430\u0434\u0430\u0451\u0442\u0441\u044f \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044f Nginx \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 playbook config_nginx.yml. \u0412\u043e\u0442 \u0435\u0433\u043e \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u043d\u0438\u0435:<\/p>\n<pre><code>- name: \"Run a shell command on a remote host\"   hosts: nginx*   tasks:   - name: create simvolic url      shell: |        ln -s \/etc\/nginx\/sites-available\/{{ name_config_next }} \/etc\/nginx\/sites-enabled\/{{ name_config_next }}        \/etc\/init.d\/nginx reload <\/code><\/pre>\n<p>Playbook \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u043e\u0434\u0438\u043d \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 \u201cname_config_next\u201d, \u0447\u0442\u043e \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0438\u043c\u0435\u043d\u0435\u043c \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u044b \u043f\u043e\u0434\u0433\u043e\u0442\u0430\u0432\u043b\u0438\u0432\u0430\u043b\u0438 \u0440\u0430\u043d\u0435\u0435.<\/p>\n<p>\u0412 \u044d\u0442\u043e\u043c playbook \u0443\u0434\u0430\u043b\u0451\u043d\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u044e\u0442\u0441\u044f \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u043f\u043e ssh \u043d\u0430 Nginx proxy. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0441\u0438\u043c\u0432\u043e\u043b\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u0441\u0441\u044b\u043b\u043a\u0438 \u0432 \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0435 \u201csites-enabled\u201d \u043d\u0430 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0439 \u0444\u0430\u0439\u043b, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u044b \u0441\u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u043b\u0438 \u0440\u0430\u043d\u0435\u0435 \u0432 \u043a\u0430\u0442\u0430\u043b\u043e\u0433 \u201csites-available\u201d. \u041f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e Nginx \u043f\u0435\u0440\u0435\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u0442 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044e \u043a\u043e\u043c\u0430\u043d\u0434\u043e\u0439 \u201c\/etc\/init.d\/nginx reload\u201d.\u00a0<\/p>\n<p>\u041d\u0430 \u044d\u0442\u043e\u043c \u044d\u0442\u0430\u043f\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0432\u044b\u0432\u043e\u0434 \u0441\u043a\u0440\u0438\u043f\u0442\u0430 \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0442\u0430\u043a\u0438\u043c\u00a0<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/2f2\/e57\/ea3\/2f2e57ea31b2c1ae54f4ee1313f17ae2.png\" width=\"1600\" height=\"205\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/2f2\/e57\/ea3\/2f2e57ea31b2c1ae54f4ee1313f17ae2.png\"\/><\/figure>\n<p>\u0412 \u0441\u0442\u0440\u043e\u043a\u0435 15 \u0441\u043a\u0440\u0438\u043f\u0442\u0430 create_instances_nextcloud.sh \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u043a\u043e\u043c\u0430\u043d\u0434\u044b sleep \u0436\u0434\u0451\u043c 60 \u0441\u0435\u043a\u0443\u043d\u0434, \u043f\u043e\u043a\u0430 \u043c\u0430\u0448\u0438\u043d\u0430 \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u0441\u044f.<\/p>\n<p>\u0412 \u0441\u0442\u0440\u043e\u043a\u0435 16 \u0441\u043a\u0440\u0438\u043f\u0442\u0430 create_instances_nextcloud.sh \u0438\u0434\u0451\u0442 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u043e\u0433\u043e \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u0430 Nextcloud \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 playbook config_next.yml. \u0412\u043e\u0442 \u0435\u0433\u043e \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u043d\u0438\u0435:<\/p>\n<pre><code>- name: \"Run a shell command on a remote host\"   hosts: \"{{ orgname }}\"   tasks:   - name: congigure Nextcloud     shell: |        sudo -u www-data php \/var\/www\/nextcloud\/occ config:system:set trusted_domains 3 --value='{{ ip }}'        sudo -u www-data php \/var\/www\/nextcloud\/occ config:system:set trusted_domains 4 --value='{{ domain_name_nextcloud }}'        echo \"{{ password }}\" | sudo -u www-data php \/var\/www\/nextcloud\/occ user:resetpassword admin               systemctl restart apache2<\/code><\/pre>\n<p>Playbook \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u0442\u0440\u0438 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430:<\/p>\n<ol>\n<li>\n<p>\u0421\u0443\u0444\u0444\u0438\u043a\u0441 \u0438\u043c\u0435\u043d\u0438 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u0430 Nextcloud<\/p>\n<\/li>\n<li>\n<p>IP-\u0430\u0434\u0440\u0435\u0441 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u0430 Nextcloud<\/p>\n<\/li>\n<li>\n<p>\u0414\u043e\u043c\u0435\u043d\u043d\u043e\u0435 \u0438\u043c\u044f \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u0430 Nextcloud<\/p>\n<\/li>\n<li>\n<p>\u041f\u0430\u0440\u043e\u043b\u044c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f admin \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0437\u0430\u0434\u0430\u0442\u044c \u0432 Nextcloud<\/p>\n<\/li>\n<\/ol>\n<p>\u0412 \u044d\u0442\u043e\u043c playbook \u0443\u0434\u0430\u043b\u0451\u043d\u043d\u043e \u043f\u043e ssh \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u044e\u0442\u0441\u044f \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u043d\u0430 \u043d\u043e\u0432\u043e\u043c \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u0435 Nextcloud: \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0434\u043e\u0432\u0435\u0440\u0435\u043d\u043d\u044b\u0435 \u0434\u043e\u043c\u0435\u043d\u044b \u0432 \u0432\u0438\u0434\u0435 ip-\u0430\u0434\u0440\u0435\u0441\u0430 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u0430 Nextcloud \u0438 \u0435\u0433\u043e \u0434\u043e\u043c\u0435\u043d\u043d\u043e\u0433\u043e \u0438\u043c\u0435\u043d\u0438. \u0421\u0431\u0440\u0430\u0441\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043f\u0430\u0440\u043e\u043b\u044c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0430\u0434\u043c\u0438\u043d\u0438\u0441\u0442\u0440\u0430\u0442\u043e\u0440\u0430 Nextcloud \u043f\u043e\u0434 \u0438\u043c\u0435\u043d\u0435\u043c admin. \u0417\u0430\u0442\u0435\u043c \u043f\u0435\u0440\u0435\u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u0442\u0441\u044f \u0432\u0435\u0431-\u0441\u0435\u0440\u0432\u0435\u0440 apache2.<\/p>\n<p>\u041d\u0430 \u044d\u0442\u043e\u043c \u044d\u0442\u0430\u043f\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0441\u043a\u0440\u0438\u043f\u0442\u0430 \u0432\u044b\u0432\u043e\u0434 \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0442\u0430\u043a\u0438\u043c<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/459\/716\/3a2\/4597163a2d1061170156154ec3adbe7d.png\" width=\"1600\" height=\"159\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/459\/716\/3a2\/4597163a2d1061170156154ec3adbe7d.png\"\/><\/figure>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0441\u043a\u0440\u0438\u043f\u0442\u0430 create_instances_nextcloud.sh \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c DNS \u0437\u0430\u043f\u0438\u0441\u0438 \u0434\u043b\u044f \u043d\u0430\u0448\u0435\u0433\u043e \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u0430 Nextcloud \u043d\u0430 DNS \u0441\u0435\u0440\u0432\u0435\u0440\u0435. \u0418 \u0432\u0441\u0451, \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f Nextcloud.\u00a0<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/e9b\/8af\/00b\/e9b8af00b017bf361d871abb60274e05.png\" width=\"1344\" height=\"588\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/e9b\/8af\/00b\/e9b8af00b017bf361d871abb60274e05.png\"\/><\/figure>\n<p>\u041e\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0439 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043c\u043d\u043e\u0433\u043e \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u043e\u0432 Nextcloud, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0441\u043a\u0440\u0438\u043f\u0442 create_instances_nextcloud.sh. \u0411\u0443\u0434\u0435\u0442 \u043a\u0440\u0443\u0442\u043e, \u0435\u0441\u043b\u0438 \u043c\u043e\u0439 \u043e\u043f\u044b\u0442 \u0432\u0430\u043c \u043f\u043e\u043c\u043e\u0436\u0435\u0442.<\/p>\n<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \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\/articles\/796469\/\"> https:\/\/habr.com\/ru\/articles\/796469\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u0412\u0441\u0435\u043c \u043f\u0440\u0438\u0432\u0435\u0442!\u00a0\u0425\u043e\u0447\u0443 \u043f\u043e\u0434\u0435\u043b\u0438\u0442\u044c\u0441\u044f \u0441 \u0432\u0430\u043c\u0438 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u043c \u0441\u043a\u0440\u0438\u043f\u0442\u0430 \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u043e\u0432 Nextcloud \u0447\u0435\u0440\u0435\u0437 Ansible \u0432 vCloudDirector. \u0417\u0430\u043e\u0434\u043d\u043e \u043e\u043f\u0438\u0448\u0443 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u043e\u0432 Nextcloud. \u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u0443 \u0432\u0430\u0441 \u0442\u043e\u0436\u0435 \u0431\u044b\u0432\u0430\u044e\u0442 \u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0435 \u0437\u0430\u0434\u0430\u0447\u0438, \u2014 \u043c\u043e\u0436\u0435\u0442\u0435 \u043d\u0435 \u0438\u0437\u043e\u0431\u0440\u0435\u0442\u0430\u0442\u044c \u0435\u0449\u0451 \u043e\u0434\u0438\u043d \u0432\u0435\u043b\u043e\u0441\u0438\u043f\u0435\u0434, \u0432\u043e\u0442 \u043e\u0434\u0438\u043d \u0438\u0437 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u0432 \u0440\u0435\u0448\u0435\u043d\u0438\u044f. <\/p>\n<p>\u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u043f\u0440\u0438\u0432\u0435\u0434\u0443 \u0441\u0445\u0435\u043c\u0443 \u0438\u043d\u0444\u0440\u0430\u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0431\u0443\u0434\u0443\u0442 \u0440\u0430\u0437\u0432\u043e\u0440\u0430\u0447\u0438\u0432\u0430\u0442\u044c\u0441\u044f \u043d\u043e\u0432\u044b\u0435 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u044b Nextcloud.<\/p>\n<figure class=\"full-width\"><\/figure>\n<p>\u0414\u043e\u0431\u0430\u0432\u043b\u044e \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e\u0441\u0442\u0435\u0439, \u0447\u0442\u043e\u0431\u044b \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0430 \u0441\u0442\u0430\u043b\u0430 \u043f\u043e\u043d\u044f\u0442\u043d\u0435\u0435.<\/p>\n<p>\u0412\u0441\u0435 \u0441\u0435\u0440\u0432\u0435\u0440\u044b \u0432 \u0438\u043d\u0444\u0440\u0430\u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0435 \u2014 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0435, \u0440\u0430\u0437\u0432\u0451\u0440\u043d\u0443\u0442\u044b \u0432 Vmware Cloud Director (\u0434\u0430\u043b\u0435\u0435 VCD). \u041e\u043d\u0438 \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442 \u043f\u043e\u0434 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435\u043c \u041e\u0421 Ubuntu 20.04. \u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 reverse proxy \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0432\u0435\u0431-\u0441\u0435\u0440\u0432\u0435\u0440 Nginx.\u00a0<\/p>\n<p>\u041d\u043e\u0432\u044b\u0435 \u0440\u0430\u0437\u0432\u043e\u0440\u0430\u0447\u0438\u0432\u0430\u0435\u043c\u044b\u0435 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u044b Nextcloud \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u044b \u043d\u0430 \u0441\u0445\u0435\u043c\u0435 \u043a\u0430\u043a Nextcloud Instances. \u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0441\u043a\u0440\u0438\u043f\u0442\u0430 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043d\u043e\u0432\u044b\u0445 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u043e\u0432 Nextcloud \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f Scripts. \u042d\u0442\u043e\u0442 \u0441\u0435\u0440\u0432\u0435\u0440 \u0438\u043c\u0435\u0435\u0442 ssh \u0434\u043e\u0441\u0442\u0443\u043f\u044b \u043f\u043e \u043a\u043b\u044e\u0447\u0443 \u043d\u0430 Nginx \u0438 \u0432\u0441\u0435 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0435\u043c\u044b\u0435 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u044b. \u0422\u0430\u043a\u0436\u0435 Scripts \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u0441\u044b\u043b\u0430\u0442\u044c API \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u043a Vmware Cloud Director.\u00a0<\/p>\n<p>\u0414\u043b\u044f \u0434\u043e\u0441\u0442\u0443\u043f\u043e\u0432 \u043a \u0438\u043d\u0442\u0435\u0440\u043d\u0435\u0442\u0443 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f NSX EDGE Gateway, \u0430 \u0434\u043b\u044f \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0434\u043e\u043c\u0435\u043d\u043d\u044b\u0445 \u0438\u043c\u0451\u043d \u2014 \u043f\u0443\u0431\u043b\u0438\u0447\u043d\u044b\u0439 DNS \u0441\u0435\u0440\u0432\u0435\u0440 (\u043e\u043d \u0442\u0430\u043a \u0438 \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0435\u043d \u043d\u0430 \u0441\u0445\u0435\u043c\u0435). \u0412\u0441\u0435 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u044b Nextcloud \u043d\u0430\u0445\u043e\u0434\u044f\u0442\u0441\u044f \u0432 \u043e\u0434\u043d\u043e\u043c \u0434\u043e\u043c\u0435\u043d\u0435 domainname.com. \u0412\u043c\u0435\u0441\u0442\u043e \u044d\u0442\u043e\u0433\u043e \u0438\u043c\u0435\u043d\u0438 \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u0432\u0430\u0448 \u0434\u043e\u043c\u0435\u043d. \u0422\u0430\u043a\u0436\u0435 \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u0430\u0433\u0430\u0435\u0442\u0441\u044f, \u0447\u0442\u043e SSL \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u044b \u043d\u0430 \u0434\u043e\u043c\u0435\u043d domainname.com \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u044b \u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u044b \u043d\u0430 Nginx.<\/p>\n<h3>\u0421\u043a\u0440\u0438\u043f\u0442 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043d\u043e\u0432\u044b\u0445 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u043e\u0432 Nextcloud<\/h3>\n<p>\u0421\u043a\u0440\u0438\u043f\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u043d\u0430 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u043c \u0441\u0435\u0440\u0432\u0435\u0440\u0435 Scripts. \u041d\u0430 \u043d\u0451\u043c \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d Ansible \u0441 \u043c\u043e\u0434\u0443\u043b\u0435\u043c ansible-module-vcloud-director \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 API VCD. \u041e\u043d \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0438\u0437 \u0433\u043b\u0430\u0432\u043d\u043e\u0433\u043e \u0441\u043a\u0440\u0438\u043f\u0442\u0430 \u043d\u0430 bash \u0438 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0445 \u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0432 \u0434\u043b\u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u044b\u0445 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0439 \u043d\u0430 Ansible \u0438 Python. \u0412\u043e\u0442 \u0438\u0445 \u0441\u043f\u0438\u0441\u043e\u043a:<\/p>\n<ol>\n<li>\n<p><strong>create_instances_nextcloud.sh<\/strong><\/p>\n<\/li>\n<li>\n<p><strong>create_vapp.yml<\/strong><\/p>\n<\/li>\n<li>\n<p><strong>create_vm_in_vapp.yml<\/strong><\/p>\n<\/li>\n<li>\n<p><strong>list_nics.ym<\/strong>l<\/p>\n<\/li>\n<li>\n<p><strong>insert_txt.py<\/strong><\/p>\n<\/li>\n<li>\n<p><strong>config_next.yml<\/strong><\/p>\n<\/li>\n<li>\n<p><strong>config_nginx.yml<\/strong><\/p>\n<\/li>\n<li>\n<p><strong>nextcloud_template_tls<\/strong><\/p>\n<\/li>\n<\/ol>\n<p>\u0421\u043a\u0440\u0438\u043f\u0442 <strong>create_instances_nextcloud.sh \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0442\u0430\u043a<\/strong>:<\/p>\n<pre><code>#!\/bin\/bash ansible-playbook create_vapp.yml --extra-vars \"orgname=$1\" ansible-playbook create_vm.yml --extra-vars \"orgname=$1\" ip=$(ansible-playbook list_nics.yml --extra-vars \"orgname=$1\" 2>&amp;1 | grep '\"ip_address\":' | grep -E -o '[0-9]{1,3}(\\.[0-9]{1,3}){3}') last_name_conf_next=\"nextcloud_tls\" name_config_next=\"$1$last_name_conf_next\" echo \"[$1]\" >> ansible_hosts echo \"$ip\" >> ansible_hosts cp nextcloud_template_tls \"$name_config_next\" .\/insert_txt.py $1 $ip $name_config_next last_domain_name_nextcloud=\"next.domainname.com\" domain_name_nextcloud=\"$1$last_domain_name_nextcloud\" scp $name_config_next root@192.168.4.3:\/etc\/nginx\/sites-available ansible-playbook config_nginx.yml --extra-vars \"name_config_next=$name_config_next\" sleep 60 ansible-playbook config_next.yml --extra-vars \"orgname=$1 ip=$ip domain_name_nextcloud=$domain_name_nextcloud password=$2\"<\/code><\/pre>\n<p>\u0421\u043a\u0440\u0438\u043f\u0442 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u0434\u0432\u0430 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430:<\/p>\n<ol>\n<li>\n<p>\u0418\u043c\u044f \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u0430 Nextcloud. \u042f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441\u0443\u0444\u0444\u0438\u043a\u0441\u043e\u043c \u043a \u0434\u043e\u043c\u0435\u043d\u043d\u043e\u043c\u0443 \u0438\u043c\u0435\u043d\u0438 next.domainname.com<\/p>\n<\/li>\n<li>\n<p>\u041f\u0430\u0440\u043e\u043b\u044c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f admin \u0432 Nextcloud<\/p>\n<\/li>\n<\/ol>\n<p>\u0412\u043e \u0432\u0442\u043e\u0440\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0435 \u0441\u043a\u0440\u0438\u043f\u0442\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f ansible playbook create_vapp.yml. \u041e\u043d \u043d\u0443\u0436\u0435\u043d \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043d\u043e\u0432\u043e\u0433\u043e vApp \u0432 VCD. \u041f\u0440\u0438\u0432\u0435\u0434\u0443 \u0435\u0433\u043e \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u043d\u0438\u0435:<\/p>\n<pre><code>- name: vCloudDirectorAnsible   hosts: localhost   environment:        env_user: admin        env_password: password        env_host: vcd.domainname.ru            ## VCD Instance URL        env_org: name_org             ## VCD ORG to login ##      env_api_version: PYVCLOUD_API_VERSION        env_verify_ssl_certs: false   tasks:   - name: create vapp     vcd_vapp:       vapp_name: \"{{ orgname }}Nextcloud\"       vdc: \"name_VDC\"       description: \"name_VDC\"       network: \"name_network\"       deploy: true       power_on: true       accept_all_eulas: false       state: \"present\"<\/code><\/pre>\n<p>Playbook \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 \u201corgname\u201d, \u0447\u0442\u043e \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441\u0443\u0444\u0444\u0438\u043a\u0441\u043e\u043c \u043a \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044e \u043d\u043e\u0432\u043e\u0433\u043e \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u0430 Nextcloud<\/p>\n<p>\u0412 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u201cenvironment\u201d \u0437\u0430\u0434\u0430\u044e\u0442\u0441\u044f \u201ccredentials\u201d, \u0442\u0430\u043a\u0438\u0435 \u043a\u0430\u043a:<\/p>\n<ol>\n<li>\n<p><strong>env_user<\/strong> \u2013 \u0438\u043c\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0441 \u043f\u0440\u0430\u0432\u0430\u043c\u0438 \u0430\u0434\u043c\u0438\u043d\u0438\u0441\u0442\u0440\u0430\u0442\u043e\u0440\u0430 \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u0430\u0446\u0438\u0438<\/p>\n<\/li>\n<li>\n<p><strong>env_password<\/strong> \u2013 \u043f\u0430\u0440\u043e\u043b\u044c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f<\/p>\n<\/li>\n<li>\n<p><strong>env_host<\/strong> \u2013 \u0434\u043e\u043c\u0435\u043d\u043d\u043e\u0435 \u0438\u043c\u044f VCD<\/p>\n<\/li>\n<li>\n<p><strong>env_org<\/strong> \u2013 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u0430\u0446\u0438\u0438 \u0432 VCD<\/p>\n<\/li>\n<\/ol>\n<p>\u0414\u0430\u043b\u0435\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u0437\u0430\u0434\u0430\u0447\u0430 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f vapp. \u0412 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 vcd_vapp \u0432\u0432\u043e\u0434\u044f\u0442\u0441\u044f \u0434\u0430\u043d\u043d\u044b\u0435, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u0434\u043b\u044f \u043d\u043e\u0432\u043e\u0433\u043e vApp:<\/p>\n<ol>\n<li>\n<p><strong>vapp_name<\/strong> \u2013 \u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 vApp \u0441 \u0441\u0443\u0444\u0444\u0438\u043a\u0441\u043e\u043c \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044f \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u0430 Nextcloud \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0435\u043c\u044b\u0439 \u0432 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 orgname<\/p>\n<\/li>\n<li>\n<p><strong>vdc<\/strong> \u2013 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 VDC \u0433\u0434\u0435 \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c\u0441\u044f \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 Nextcloud<\/p>\n<\/li>\n<li>\n<p><strong>description<\/strong> \u2013 \u043e\u043f\u0438c\u0430\u043d\u0438\u0435 vApp (\u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043b\u044e\u0431\u044b\u043c)<\/p>\n<\/li>\n<li>\n<p><strong>network<\/strong> \u2013 \u0438\u043c\u044f \u0441\u0435\u0442\u0438 \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u043a vApp<\/p>\n<\/li>\n<li>\n<p><strong>power_on<\/strong> \u2013 \u0432\u043a\u043b\u044e\u0447\u0438\u0442\u044c vApp \u043f\u043e\u0441\u043b\u0435 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f<\/p>\n<\/li>\n<li>\n<p><strong>state<\/strong> \u2013 <strong>present<\/strong> \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442 \u0447\u0442\u043e \u043d\u0443\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c vApp<\/p>\n<\/li>\n<\/ol>\n<p>\u0414\u0430\u043b\u0435\u0435 \u0432 \u0441\u043a\u0440\u0438\u043f\u0442\u0435 create_instances_nextcloud.sh (3 \u0441\u0442\u0440\u043e\u043a\u0430) \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f playbook create_vm.yml \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0439 \u043c\u0430\u0448\u0438\u043d\u044b \u0432 \u0440\u0430\u043d\u0435\u0435 \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u043e\u043c vApp. \u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0439 \u043c\u0430\u0448\u0438\u043d\u044b \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0438\u0437 \u0437\u0430\u0440\u0430\u043d\u0435\u0435 \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u0448\u0430\u0431\u043b\u043e\u043d\u0430 \u0412\u041c \u0441 Nextcloud. \u0412\u043e\u0442 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u043d\u0438\u0435 playbook:<\/p>\n<pre><code>- name: vCloudDirectorAnsible   hosts: localhost   environment:        env_user: name_admin        env_password: password        env_host: vcd.domainname.ru            ## VCD Instance URL        env_org: name_VDC             ## VCD ORG to login ##      env_api_version: PYVCLOUD_API_VERSION        env_verify_ssl_certs: false   tasks:   - name: create vapp vm from catalog     vcd_vapp_vm:       target_vm_name: \"{{ orgname }}Nextcloud\"       target_vapp: \"{{ orgname }}Nextcloud\"       target_vdc: name_VDC       source_vdc: \"name_source_VDC\"       source_catalog_name: name_Catalog       source_template_name: template_name       source_vm_name: source_vm_name       hostname: \"{{ orgname }}Nextcloud\"       ip_allocation_mode: \"POOL\"       power_on: \"true\"       all_eulas_accepted: \"true\"       network: network_name       deploy: false       state: \"present\"<\/code><\/pre>\n<p>Playbook \u043a\u0430\u043a \u0438 \u0432 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u043e\u0434\u0438\u043d \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440: \u201corgname\u201d.<\/p>\n<p>\u041a\u0430\u043a \u0438 \u0432 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u043c playbook \u0432 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u201cenvironment\u201d \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u201ccredentials\u201d. \u0414\u0430\u043b\u0435\u0435 \u0441\u043e\u0437\u0434\u0430\u0451\u0442\u0441\u044f \u0437\u0430\u0434\u0430\u0447\u0430 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0439 \u043c\u0430\u0448\u0438\u043d\u044b \u0432 vApp, \u0433\u0434\u0435 \u0432 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u201cvcd_vapp_vm\u201d \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0435:<\/p>\n<ol>\n<li>\n<p><strong>target_vm_name<\/strong> \u2013 \u0438\u043c\u044f \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0435\u043c\u043e\u0439 \u043c\u0430\u0448\u0438\u043d\u044b \u0441 \u0441\u0443\u0444\u0444\u0438\u043a\u0441\u043e\u043c \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044f \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u0430 Nextcloud, \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0435\u043c\u044b\u043c \u0447\u0435\u0440\u0435\u0437 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e orgname<\/p>\n<\/li>\n<li>\n<p><strong>target_vapp<\/strong> \u2014 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 vApp, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c\u0441\u044f \u0412\u041c, \u0441 \u0441\u0443\u0444\u0444\u0438\u043a\u0441\u043e\u043c \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044f \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u0430 Nextcloud \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0435\u043c\u044b\u043c \u0432 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u201corgname\u201d<\/p>\n<\/li>\n<li>\n<p><strong>target_vdc<\/strong> \u2013 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 VDC, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c\u0441\u044f \u0412\u041c<\/p>\n<\/li>\n<li>\n<p><strong>source_catalog_name<\/strong> \u2013 \u0438\u043c\u044f \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0430, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0448\u0430\u0431\u043b\u043e\u043d<\/p>\n<\/li>\n<li>\n<p><strong>source_template_name<\/strong> \u2013 \u0438\u043c\u044f \u0448\u0430\u0431\u043b\u043e\u043d\u0430 \u0441 Nextcloud, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0437\u0432\u043e\u0440\u0430\u0447\u0438\u0432\u0430\u0442\u044c\u0441\u044f<\/p>\n<\/li>\n<li>\n<p><strong>source_vm_name<\/strong> \u2013 \u0438\u043c\u044f \u0412\u041c, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0432 \u0448\u0430\u0431\u043b\u043e\u043d\u0435<\/p>\n<\/li>\n<li>\n<p><strong>hostname<\/strong> \u2013 \u0441\u0435\u0442\u0435\u0432\u043e\u0435 \u0438\u043c\u044f \u0412\u041c \u0441 \u0441\u0443\u0444\u0444\u0438\u043a\u0441\u043e\u043c \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044f \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u0430 Nextcloud, \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0435\u043c\u044b\u043c \u0447\u0435\u0440\u0435\u0437 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e \u201corgname\u201d<\/p>\n<\/li>\n<li>\n<p>\u00a0<strong>ip_allocation_mode<\/strong> \u2013 \u0441\u043f\u043e\u0441\u043e\u0431 \u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f ip-\u0430\u0434\u0440\u0435\u0441\u0430 \u0412\u041c. \u0412\u044b\u0431\u0440\u0430\u043d \u0441\u043f\u043e\u0441\u043e\u0431 static_ip_pool<\/p>\n<\/li>\n<li>\n<p><strong>power_on<\/strong> \u2013 \u0432\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0438\u043b\u0438 \u043d\u0435\u0442 \u043c\u0430\u0448\u0438\u043d\u0443 \u043f\u043e\u0441\u043b\u0435 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f. \u0412\u044b\u0431\u0440\u0430\u043d\u043e \u201c\u0414\u0430\u201d.<\/p>\n<\/li>\n<li>\n<p><strong>network<\/strong> \u2013 \u0438\u043c\u044f \u0441\u0435\u0442\u0438, \u043a \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0435\u043c\u0443\u044e \u0412\u041c. \u0418\u043c\u044f \u0441\u0435\u0442\u0438 \u0441\u043e\u0432\u043f\u0430\u0434\u0430\u0435\u0442 \u0441 \u0438\u043c\u0435\u043d\u0435\u043c \u0441\u0435\u0442\u0438, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u043a vApp \u043f\u0440\u0438 \u0435\u0433\u043e \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u0432 \u043f\u0440\u043e\u0448\u043b\u043e\u043c playbook.\u00a0<\/p>\n<\/li>\n<li>\n<p><strong>\u00a0State<\/strong> \u2013 \u043f\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0430 present. \u042d\u0442\u043e \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442, \u0447\u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c\u0441\u044f \u043d\u043e\u0432\u0430\u044f \u0412\u041c<\/p>\n<\/li>\n<\/ol>\n<p>\u041d\u0430 \u044d\u0442\u043e\u043c \u044d\u0442\u0430\u043f\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0432\u044b\u0432\u043e\u0434 \u0441\u043a\u0440\u0438\u043f\u0442\u0430 \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0442\u0430\u043a\u0438\u043c:<\/p>\n<figure class=\"full-width\"><\/figure>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f vApp \u0438 VM \u0432 \u043d\u0451\u043c, \u043d\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0443\u0437\u043d\u0430\u0442\u044c ip-\u0430\u0434\u0440\u0435\u0441, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0430 \u043d\u043e\u0432\u0430\u044f \u0412\u041c \u0438 \u0437\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0435\u0433\u043e \u0432 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e \u201cip\u201d \u043a\u043e\u043c\u0430\u043d\u0434\u043e\u0439 \u0432 \u0441\u0442\u0440\u043e\u043a\u0435 4 \u0441\u043a\u0440\u0438\u043f\u0442\u0430 create_instances_nextcloud.sh. \u0414\u0435\u043b\u0430\u0435\u0442\u0441\u044f \u044d\u0442\u043e \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 playbook \u201clist_nics.yml\u201d. \u0412\u043e\u0442 \u0435\u0433\u043e \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u043d\u0438\u0435:<\/p>\n<pre><code>- name: vCloudDirectorAnsible   hosts: localhost   environment:        env_user: name_admin        env_password: password        env_host: vcd.domainname.ru            ## VCD Instance URL        env_org: name_org             ## VCD ORG to login ##      env_api_version: PYVCLOUD_API_VERSION        env_verify_ssl_certs: false   tasks:     - name: list vapp vm nics       vcd_vapp_vm:         target_vm_name: \"{{ orgname }}Nextcloud\"         target_vapp: \"{{ orgname }}Nextcloud\"         target_vdc: name_VDC         operation: \"list_nics\"       register: command_output     - debug:              var: command_output<\/code><\/pre>\n<p>Playbook \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 \u201corgname\u201d.<\/p>\n<p>\u041a\u0430\u043a \u0438 \u0432 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u0445 playbook \u0432 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u201cenvironment\u201d \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u201ccredentials\u201d . \u0417\u0430\u0442\u0435\u043c \u0441\u043e\u0437\u0434\u0430\u0451\u0442\u0441\u044f \u0437\u0430\u0434\u0430\u0447\u0430 \u043f\u0440\u043e\u0441\u043c\u043e\u0442\u0440\u0430 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u043e \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430\u0445. \u0412 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 vcd_vapp_vm \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u044e\u0442\u0441\u044f:<\/p>\n<ol>\n<li>\n<p><strong>target_vm_name<\/strong> \u2013 \u0438\u043c\u044f \u0412\u041c, \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043f\u043e \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0445\u043e\u0442\u0438\u043c \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c. \u0421\u043e\u0432\u043f\u0430\u0434\u0430\u0435\u0442 \u0441 \u0438\u043c\u0435\u043d\u0435\u043c \u0412\u041c, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0431\u044b\u043b\u0438 \u0443\u043a\u0430\u0437\u0430\u043d\u044b \u0432 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u0445 playbook.<\/p>\n<\/li>\n<li>\n<p><strong>target_vapp \u2013 <\/strong>\u0438\u043c\u044f vApp,\u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0412\u041c<\/p>\n<\/li>\n<li>\n<p><strong>target_vdc \u2013 <\/strong>\u0438\u043c\u044f VDC, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0412\u041c<\/p>\n<\/li>\n<li>\n<p><strong>operation \u2013 <\/strong>\u0442\u0438\u043f \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438. \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u043f\u043e \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430\u043c &#171;list_nics&#187;<\/p>\n<\/li>\n<\/ol>\n<p>\u0414\u0430\u043b\u0435\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0430 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0445 \u0444\u0430\u0439\u043b\u043e\u0432 Nginx. \u0414\u0435\u043b\u0430\u0435\u0442\u0441\u044f \u044d\u0442\u043e \u043f\u0443\u0442\u0451\u043c \u0440\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0435\u0434\u0438\u043d\u043e\u0433\u043e \u0448\u0430\u0431\u043b\u043e\u043d\u0430 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 \u043f\u043e\u0434 \u0438\u043c\u0435\u043d\u0435\u043c nextcloud_template_tls. \u042d\u0442\u043e\u0442 \u0448\u0430\u0431\u043b\u043e\u043d \u0431\u044b\u043b \u0441\u043e\u0437\u0434\u0430\u043d \u0438\u0437 <a href=\"https:\/\/github.com\/nextcloud\/all-in-one\/blob\/main\/reverse-proxy.md\"><u>\u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438<\/u><\/a> \u043f\u0443\u0442\u0451\u043c \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u044f \u0441\u0442\u0440\u043e\u043a\u0438 \u201cserver_name &lt;your-nc-domain>;\u201d \u0438 \u201cproxy_pass http:\/\/127.0.0.1:11000$request_uri; \u201d.\u00a0<\/p>\n<p>\u0412 \u0441\u0442\u0440\u043e\u043a\u0435 5 \u0438 6 \u0441\u043a\u0440\u0438\u043f\u0442\u0430 create_instances_nextcloud.sh \u0437\u0430\u0434\u0430\u0451\u0442\u0441\u044f \u0438\u043c\u044f \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430 Nginx \u0434\u043b\u044f \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u0430 Nextcloud. \u0417\u0430\u0442\u0435\u043c \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0441\u0442\u0440\u043e\u043a\u0438 \u0432 \u0438\u043d\u0432\u0435\u043d\u0442\u0430\u0440\u043d\u044b\u0439 \u0444\u0430\u0439\u043b Ansible \u0434\u043b\u044f \u043d\u043e\u0432\u043e\u0433\u043e \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u0430 Nextcloud \u0432 \u043a\u043e\u043c\u0430\u043d\u0434\u0430\u0445 \u043f\u043e\u0434 \u0441\u0442\u0440\u043e\u043a\u0430\u043c\u0438 7 \u0438 8 \u0441\u043a\u0440\u0438\u043f\u0442\u0430 create_instances_nextcloud.sh.\u00a0<\/p>\n<p>\u0412 \u0441\u0442\u0440\u043e\u043a\u0435 9 \u043a\u043e\u043f\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0448\u0430\u0431\u043b\u043e\u043d \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 Nginx nextcloud_template_tls \u043f\u043e\u0434 \u043d\u043e\u0432\u044b\u043c \u0438\u043c\u0435\u043d\u0435\u043c, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0445\u0440\u0430\u043d\u0438\u0442\u0441\u044f \u0432 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 name_config_next. \u0417\u0430\u0442\u0435\u043c \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u0441\u043a\u0440\u0438\u043f\u0442\u0430 \u043d\u0430 Python insert_txt.py \u0432\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u043d\u0443\u0436\u043d\u044b\u0435 \u0441\u0442\u0440\u043e\u043a\u0438 \u0434\u043b\u044f \u043d\u0430\u0448\u0435\u0433\u043e \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u0430 Nextcloud. \u0412\u043e\u0442 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u043d\u0438\u0435 \u044d\u0442\u043e\u0433\u043e \u0441\u043a\u0440\u0438\u043f\u0442\u0430:<\/p>\n<pre><code>#!\/usr\/bin\/python3.8 import sys def insert(file, line, column, text):     ln, cn = line - 1, column - 1         # offset from human index to Python index     count = 0                             # initial count of characters     with open(file, 'r+') as f:           # open file for reading an writing         for idx, line in enumerate(f):    # for all line in the file             if idx &lt; ln:                  # before the given line                 count += len(line)        # read and count characters              elif idx == ln:               # once at the line                                                  f.seek(count + cn)        # place cursor at the correct character location                 remainder = f.read()      # store all character afterwards                                        f.seek(count + cn)        # move cursor back to the correct character location                 f.write(text + remainder) # insert text and<\/code><\/pre>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\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-369318","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/369318","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=369318"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/369318\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=369318"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=369318"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=369318"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}