{"id":332640,"date":"2022-04-30T21:00:08","date_gmt":"2022-04-30T21:00:08","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=332640"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=332640","title":{"rendered":"<span>\u041c\u0438\u043a\u0440\u043e\u043e\u0431\u043b\u0430\u043a\u043e. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0437\u043d\u0430\u043a\u043e\u043c\u0438\u0442\u044c \u043c\u0430\u0448\u0438\u043d\u044b \u0434\u0440\u0443\u0433 \u0441 \u0434\u0440\u0443\u0433\u043e\u043c<\/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\u0432\u043e\u0435\u0439 <a href=\"https:\/\/habr.com\/ru\/post\/661077\/\" rel=\"noopener noreferrer nofollow\">\u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0439 \u0441\u0442\u0430\u0442\u044c\u0435<\/a> \u044f \u0443\u0436\u0435 \u0443\u043f\u043e\u043c\u0438\u043d\u0430\u043b, \u0447\u0442\u043e \u0441\u043e\u0437\u0434\u0430\u044e \u0441\u0432\u043e\u0451 \u043c\u0438\u043a\u0440\u043e\u043e\u0431\u043b\u0430\u043a\u043e. \u0422\u043e\u0447\u043d\u0435\u0435, \u043d\u0443 \u043a\u0430\u043a \u0441\u0432\u043e\u0451, \u044d\u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u043e\u0431\u043b\u0430\u043a\u043e \u043a\u0430\u043a \u043f\u0440\u043e\u0434\u0443\u043a\u0442, \u0430 \u043d\u0435 \u043a\u0430\u043a \u0443\u0441\u043b\u0443\u0433\u0430. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043e\u043d\u043e \u0442\u0430\u043a\u043e\u0435 \u0436\u0435 \u043c\u043e\u0451, \u043a\u0430\u043a \u0438 \u0432\u0430\u0448\u0435. \u041a\u0430\u043a \u0438 \u0432\u0441\u0435\u0433\u043e \u043c\u0438\u0440\u0430. \u0422\u043e \u0435\u0441\u0442\u044c \u043a\u0430\u0436\u0434\u044b\u0439 \u0441\u043c\u043e\u0436\u0435\u0442 \u0435\u0433\u043e \u0440\u0430\u0437\u0432\u0435\u0440\u043d\u0443\u0442\u044c \u043d\u0430 \u0441\u0432\u043e\u0451 \u0436\u0435\u043b\u0435\u0437\u043e, \u0431\u0443\u0434\u044c \u0442\u043e \u0434\u0430\u0442\u0430\u0446\u0435\u043d\u0442\u0440 \u0438\u043b\u0438 \u043f\u0430\u0440\u0430-\u0442\u0440\u043e\u0439\u043a\u0430 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0445 \u043c\u0430\u0448\u0438\u043d \u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0438\u043c \u0432 \u0441\u0432\u043e\u0451 \u0443\u0434\u043e\u0432\u043e\u043b\u044c\u0441\u0442\u0432\u0438\u0435, \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u044f \u043d\u0430 \u043d\u0435\u043c \u0441\u0432\u043e\u0438 \u043f\u043e\u0442\u0440\u044f\u0441\u0430\u044e\u0449\u0438\u0435 \u043f\u0440\u043e\u0435\u043a\u0442\u044b. \u041c\u043e\u0436\u043d\u043e \u0434\u0430\u0436\u0435 \u043d\u0430\u0439\u0442\u0438 \u043a\u0430\u043a\u043e\u0439-\u0442\u043e \u0433\u043e\u0442\u043e\u0432\u044b\u0439 \u043f\u0440\u043e\u0435\u043a\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043b\u0435\u0436\u0438\u0442 \u0433\u0434\u0435-\u043d\u0438\u0431\u0443\u0434\u044c \u043d\u0430 \u0433\u0438\u0442\u0445\u0430\u0431\u0435 \u0438 \u0434\u0430\u0432\u043d\u043e \u043f\u0440\u043e\u0441\u0438\u0442\u0441\u044f \u043d\u0430 \u0441\u0442\u0430\u0440\u0442, \u0442\u043e\u043b\u044c\u043a\u043e \u0430\u0432\u0442\u043e\u0440\u0443 \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c \u0435\u0433\u043e \u0431\u044b\u043b\u043e \u043d\u0435\u0433\u0434\u0435, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u0438\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u043e\u0432 \u0443 \u043d\u0430\u0441 \u0431\u0435\u0441\u043f\u043b\u0430\u0442\u043d\u043e\u0435, \u0430 \u0432\u043e\u0442 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0430 \u0440\u0430\u0431\u043e\u0442\u044b \u0441\u0432\u043e\u0435\u0433\u043e \u0441\u0435\u0440\u0432\u0438\u0441\u0430 \u043a \u0434\u0435\u0448\u0435\u0432\u043e\u043c\u0443 \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u0443 \u044d\u043a\u043e\u043d\u043e\u043c\u0438\u043a\u0438 \u043d\u0430 \u043c\u043e\u0439 \u0432\u0437\u0433\u043b\u044f\u0434 \u043d\u0435 \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0441\u044f. \u0410 \u044f \u0442\u0430\u043a\u043e\u0439 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u043b \u043e\u0431\u043b\u0430\u043a\u043e, \u0432\u043a\u0438\u043d\u0443\u043b \u0442\u0443\u0434\u0430 \u0447\u0443\u0436\u043e\u0439 \u043f\u0440\u043e\u0435\u043a\u0442 \u0438 \u043f\u043e\u043c\u043e\u0433 \u043c\u0438\u0440\u0443 \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u0442\u043e, \u0447\u0442\u043e \u0442\u0430\u043a \u0438 \u043c\u043e\u0433\u043b\u043e \u043e\u0441\u0442\u0430\u0442\u044c\u0441\u044f \u0432 \u0433\u043b\u0443\u0431\u0438\u043d\u0430\u0445 \u0433\u0438\u0442\u0445\u0430\u0431\u0430. \u041d\u043e \u044d\u0442\u043e \u0444\u0430\u043d\u0442\u0430\u0437\u0438\u0438, \u0434\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0435\u0449\u0435 \u0434\u0430\u043b\u0435\u043a\u043e, \u043d\u043e \u043f\u0443\u0442\u0435\u0448\u0435\u0441\u0442\u0432\u0438\u0435 \u0432 \u0442\u044b\u0441\u044f\u0447\u0443 \u043c\u0438\u043b\u044c \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442\u0441\u044f \u0441 \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u0448\u0430\u0433\u0430, \u0433\u043b\u0430\u0432\u043d\u043e\u0435 \u043d\u0435 \u043f\u0440\u0435\u043a\u0440\u0430\u0449\u0430\u0442\u044c \u043f\u0435\u0440\u0435\u0431\u0438\u0440\u0430\u0442\u044c \u043d\u043e\u0433\u0430\u043c\u0438. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043c\u044b \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u0435\u043c&#8230;<\/p>\n<p>\u0422\u0430\u043a \u0432\u043e\u0442 \u0432 <a href=\"https:\/\/habr.com\/ru\/post\/661077\/\" rel=\"noopener noreferrer nofollow\">\u043f\u0440\u043e\u0448\u043b\u043e\u043c \u043f\u043e\u0441\u0442\u0435<\/a> \u0432 \u0440\u0430\u043c\u043a\u0430\u0445 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 <a href=\"https:\/\/gitlab.com\/paap.cloud\/kubos\/-\/tree\/feature\/openvpn\" rel=\"noopener noreferrer nofollow\">kubos <\/a>\u043c\u044b \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043b\u0438\u0441\u044c \u043d\u0430 \u0442\u043e\u043c, \u0447\u0442\u043e \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0438\u043b\u0438 \u0432\u0441\u0435 \u043c\u0430\u0448\u0438\u043d\u043a\u0438 \u043d\u0430\u0448\u0435\u0433\u043e \u0431\u0443\u0434\u0443\u0449\u0435\u0433\u043e \u043e\u0431\u043b\u0430\u043a\u0430 \u0432 \u043e\u0431\u0449\u0443\u044e \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u0443\u044e \u0441\u0435\u0442\u044c. \u0422\u0435\u043f\u0435\u0440\u044c \u043f\u043e\u0440\u0430 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0442\u0430\u043a, \u0447\u0442\u043e\u0431\u044b \u043c\u0430\u0448\u0438\u043d\u043a\u0438 \u0432\u0438\u0434\u0435\u043b\u0438 \u0434\u0440\u0443\u0433 \u0434\u0440\u0443\u0433\u0430 \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e IP-\u0430\u0434\u0440\u0435\u0441\u0430\u043c, \u043d\u043e \u0438 \u043f\u043e \u0438\u043c\u0435\u043d\u0430\u043c. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043d\u0443\u0436\u043d\u043e \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c DNS \u0441\u0435\u0440\u0432\u0435\u0440, \u0447\u0435\u043c \u043c\u044b \u0441\u0435\u0439\u0447\u0430\u0441 \u0438 \u0437\u0430\u0439\u043c\u0435\u043c\u0441\u044f. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u044f \u043e\u0442\u0432\u0435\u043b \u0432 \u0433\u0438\u0442\u043b\u0430\u0431\u0435 <a href=\"https:\/\/gitlab.com\/paap.cloud\/kubos\/-\/tree\/feature\/dns\" rel=\"noopener noreferrer nofollow\">\u043e\u0442\u0434\u0435\u043b\u044c\u043d\u0443\u044e \u0432\u0435\u0442\u043a\u0443<\/a>, \u0433\u0434\u0435 \u0438 \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d \u043f\u043e\u043b\u043d\u044b\u0439 \u043a\u043e\u0434 ansible \u0438 \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0432, \u043e \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043f\u043e\u0439\u0434\u0435\u0442 \u0440\u0435\u0447\u044c \u043d\u0438\u0436\u0435.<\/p>\n<h2>\u0421\u043e\u0431\u0438\u0440\u0430\u0435\u043c \u0438\u043d\u0444\u0443 \u043e \u0445\u043e\u0441\u0442\u0430\u0445<\/h2>\n<p>\u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u043d\u0443\u0436\u043d\u043e \u0441 \u043a\u0430\u0436\u0434\u043e\u0439 \u043c\u0430\u0448\u0438\u043d\u044b \u0432 \u043d\u0430\u0448\u0435\u0439 \u0441\u0435\u0442\u0438 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e \u0442\u043e\u043c, \u043a\u0430\u043a\u043e\u0439 ip-\u0430\u0434\u0440\u0435\u0441 \u0435\u0439 \u0431\u044b\u043b \u0432\u044b\u0434\u0430\u043d \u043f\u0440\u0438 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0438 \u0432 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u0443\u044e \u0441\u0435\u0442\u044c. \u0412\u0435\u0440\u043e\u044f\u0442\u043d\u043e, \u044f \u0441\u0434\u0435\u043b\u0430\u043b \u044d\u0442\u043e \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043a\u043e\u0441\u0442\u044b\u043b\u044c\u043d\u043e, \u043d\u043e \u043d\u0435 \u043d\u0430\u0448\u0435\u043b \u043d\u0438\u0447\u0435\u0433\u043e \u043b\u0443\u0447\u0448\u0435, \u043a\u0430\u043a \u043d\u0430 \u043a\u0430\u0436\u0434\u043e\u0439 \u043c\u0430\u0448\u0438\u043d\u0435 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c json-\u0444\u0430\u0439\u043b \u0441 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435\u043c \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u0435\u0435 \u0437\u043e\u0432\u0443\u0442 \u0438 \u043a\u0430\u043a\u043e\u0439 ip-\u0430\u0434\u0440\u0435\u0441 \u0435\u0439 \u0432\u044b\u0434\u0430\u043d. \u041a\u043e\u0434 \u043d\u0438\u0436\u0435 \u0431\u044b\u043b \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d \u0432 \u0430\u043d\u0441\u0438\u0431\u043b \u0441\u043a\u0440\u0438\u043f\u0442\u044b \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f openvpn \u0441\u0435\u0442\u0438 <a href=\"https:\/\/gitlab.com\/paap.cloud\/kubos\/-\/blob\/feature\/dns\/docker\/ansible\/openvpn\/roles\/openvpn-client\/tasks\/main.yml\" rel=\"noopener noreferrer nofollow\">\u0442\u0443\u0442 <\/a>\u0438 <a href=\"https:\/\/gitlab.com\/paap.cloud\/kubos\/-\/blob\/feature\/dns\/docker\/ansible\/openvpn\/roles\/openvpn-server\/tasks\/main.yml\" rel=\"noopener noreferrer nofollow\">\u0442\u0443\u0442<\/a><\/p>\n<pre><code># \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0430 \u0440\u0435\u0435\u0441\u0442\u0440\u0430 \u043a\u0430\u043a\u043e\u043c\u0443 \u0445\u043e\u0441\u0442\u0443 \u043a\u0430\u043a\u043e\u0439 IP \u0431\u044b\u043b \u0432\u044b\u0434\u0430\u043d \u043f\u0440\u0438 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0438 \u043a \u0441\u0435\u0442\u0438 OpenVPN - name: Create {{inventory_hostname}}.json file   shell: |     VPN_IP=$(ip route | grep tun0 | grep -v via | sed 's\/.* src \\([0-9.]*\\).*\/\\1\/');     REVERSE_VPN_IP=$(echo $VPN_IP | awk -F . '{print $4\".\"$3\".\"$2\".\"$1}');     echo \"{ \\\"vpn_hosts\\\": [ { \\\"name\\\": \\\"{{ inventory_hostname }}\\\", \\\"ip\\\": \\\"$VPN_IP\\\", \\\"reverse_ip\\\": \\\"$REVERSE_VPN_IP\\\" } ] }\" > {{inventory_hostname}}.json;                args:     chdir: $HOME     creates: \"{{inventory_hostname}}.json\"  - name: Fetch {{inventory_hostname}}.json   fetch:     src: \"$HOME\/{{inventory_hostname}}.json\"     dest: \"{{ playbook_dir }}\/inventory\/\"     flat: yes<\/code><\/pre>\n<p>\u0422\u0430\u043a\u043e\u0439 \u0436\u0435 \u043a\u043e\u0434 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442\u0441\u044f \u0438 \u0432 \u0441\u043a\u0440\u0438\u043f\u0442\u0435 \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u0430\u043d\u0441\u0438\u0431\u043b \u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0432, \u0442\u043e \u0435\u0441\u0442\u044c \u0432 \u0444\u0430\u0439\u043b\u0435 <a href=\"https:\/\/gitlab.com\/paap.cloud\/kubos\/-\/blob\/feature\/dns\/docker\/entrypoint.sh\" rel=\"noopener noreferrer nofollow\">entrypoint.sh<\/a>. \u041d\u0430\u043f\u043e\u043c\u0438\u043d\u0430\u044e, \u0447\u0442\u043e \u0441\u043a\u0440\u0438\u043f\u0442 \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u0430\u043d\u0441\u0438\u0431\u043b \u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0432 \u043c\u044b \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u0438\u0437 \u0434\u043e\u043a\u0435\u0440 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0430 \u0438 \u044d\u0442\u043e\u0442 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440 \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u0447\u0430\u0441\u0442\u044c\u044e \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0439 \u0441\u0435\u0442\u0438<\/p>\n<pre><code># \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0430 \u0440\u0435\u0435\u0441\u0442\u0440\u0430 \u043a\u0430\u043a\u043e\u043c\u0443 \u0445\u043e\u0441\u0442\u0443 \u043a\u0430\u043a\u043e\u0439 IP \u0431\u044b\u043b \u0432\u044b\u0434\u0430\u043d \u043f\u0440\u0438 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0438 \u043a \u0441\u0435\u0442\u0438 OpenVPN VPN_IP=$(ip route | grep tun0 | grep -v via | sed 's\/.* src \\([0-9.]*\\).*\/\\1\/'); REVERSE_VPN_IP=$(echo $VPN_IP | awk -F . '{print $4\".\"$3\".\"$2\".\"$1}'); echo \"{ \\\"vpn_hosts\\\": [ { \\\"name\\\": \\\"docker\\\", \\\"ip\\\": \\\"$VPN_IP\\\", \\\"reverse_ip\\\": \\\"$REVERSE_VPN_IP\\\" } ] }\" > openvpn\/inventory\/docker.json;     <\/code><\/pre>\n<p>\u041d\u0438\u0436\u0435 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d \u043f\u0440\u0438\u043c\u0435\u0440 \u0442\u0430\u043a\u043e\u0433\u043e json-\u0444\u0430\u0439\u043b\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0437\u0434\u0430\u043d \u043d\u0430 \u043a\u0430\u0436\u0434\u043e\u0439 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0439 \u043c\u0430\u0448\u0438\u043d\u0435 \u0438 \u0432 \u0434\u043e\u043a\u0435\u0440-\u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0435<\/p>\n<pre><code>{   \"vpn_hosts\": [     {        \"name\": \"worker1\",        \"ip\": \"10.10.0.6\",        \"reverse_ip\": \"6.0.10.10\"     }    ] }<\/code><\/pre>\n<p>\u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0438\u043c\u0435\u043d\u0438 \u0445\u043e\u0441\u0442\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0438\u043c\u044f \u0445\u043e\u0441\u0442\u0430 \u0441 \u0442\u043e\u0447\u043a\u0438 \u0437\u0440\u0435\u043d\u0438\u044f \u0430\u043d\u0441\u0438\u0431\u043b\u0430, ip &#8212; \u044d\u0442\u043e \u0430\u0434\u0440\u0435\u0441 \u0432\u044b\u0434\u0430\u043d\u043d\u044b\u0439 \u0432 openvpn \u0441\u0435\u0442\u0438 (\u043e\u043d \u043f\u043e\u043b\u0443\u0447\u0435\u043d \u0441\u043a\u0440\u0438\u043f\u0442\u043e\u043c \u0432\u044b\u0448\u0435 \u0438\u0437 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430 tun0). \u0422\u0430\u043a\u0436\u0435 \u0432 \u044d\u0442\u043e\u0442 \u0436\u0435 \u0444\u0430\u0439\u043b \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0440\u0435\u0432\u0435\u0440\u0441\u043d\u044b\u0439 ip-\u0430\u0434\u0440\u0435\u0441, \u0442.\u043a. \u043e\u043d \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f \u0432 \u0442\u0430\u043a\u043e\u043c \u0432\u0438\u0434\u0435 \u043f\u0440\u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0435 \u0440\u0435\u0432\u0435\u0440\u0441\u043d\u043e\u0439 DNS-\u0437\u043e\u043d\u044b (\u0442\u0430\u043a \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0437\u043e\u043d\u0430 DNS, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043d\u0443\u0436\u043d\u0430 \u0434\u043b\u044f \u043f\u043e\u0438\u0441\u043a\u0430 \u0438\u043c\u0435\u043d\u0438 \u0445\u043e\u0441\u0442\u0430 \u043f\u043e \u0435\u0433\u043e ip-\u0430\u0434\u0440\u0435\u0441\u0443). \u0420\u0435\u0432\u0435\u0440\u0441\u043d\u0443\u044e \u0437\u043e\u043d\u0443 \u043d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0442\u044c \u043d\u0435\u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e, \u0435\u0441\u043b\u0438 \u044d\u0442\u043e \u0438 \u043f\u0440\u0430\u0432\u0434\u0430 \u043d\u0435 \u043d\u0443\u0436\u043d\u043e. \u041d\u043e \u044f \u0432\u0441\u0435 \u0436\u0435 \u0440\u0435\u0448\u0438\u043b \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043f\u043e\u043b\u043d\u043e\u0446\u0435\u043d\u043d\u0443\u044e \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0443 DNS, \u0447\u0442\u043e\u0431 \u0443\u0436 \u0434\u043e \u043a\u043e\u043d\u0446\u0430 \u0432\u043e \u0432\u0441\u0435\u043c \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c\u0441\u044f. \u0422\u0430\u043a\u0436\u0435 \u043e\u0431\u0440\u0430\u0449\u0430\u044e \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u0447\u0442\u043e \u044f \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u043e \u0432 json \u0441\u043e\u0437\u0434\u0430\u044e \u043c\u0430\u0441\u0441\u0438\u0432 \u0438\u0437 \u043e\u0434\u043d\u043e\u0433\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u0430, \u0447\u0442\u043e\u0431\u044b \u0434\u0430\u043b\u044c\u0448\u0435, \u043f\u043e\u043b\u0443\u0447\u0438\u0432 \u0432\u0441\u0435 \u0442\u0430\u043a\u0438\u0435 \u0444\u0430\u0439\u043b\u044b \u0441\u043e \u0432\u0441\u0435\u043c \u043c\u0430\u0448\u0438\u043d, \u0438\u0445 \u043f\u0440\u043e\u0449\u0435 \u0431\u044b\u043b\u043e \u0441\u043c\u0435\u0440\u0436\u0438\u0442\u044c \u0432 \u043e\u0434\u0438\u043d \u043e\u0431\u0449\u0438\u0439 \u043c\u0430\u0441\u0441\u0438\u0432 \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u0437\u0430\u043c\u0435\u0447\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u043a\u043e\u043d\u0441\u043e\u043b\u044c\u043d\u043e\u0439 \u0443\u0442\u0438\u043b\u0438\u0442\u044b <strong>jq<\/strong>.<\/p>\n<p>\u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043a\u0430\u043a \u0440\u0430\u0437 \u043f\u0435\u0440\u0435\u0439\u0434\u0435\u043c \u043a \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u0438\u044e \u044d\u0442\u043e\u0433\u043e \u043c\u0435\u0440\u0436\u0438\u043d\u0433\u0430 \u0432 \u0441\u043a\u0440\u0438\u043f\u0442\u0435 \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u0432\u0441\u0435\u0445 \u043f\u043b\u0435\u0439\u0431\u0443\u043a\u043e\u0432 <a href=\"https:\/\/gitlab.com\/paap.cloud\/kubos\/-\/blob\/feature\/dns\/docker\/entrypoint.sh\" rel=\"noopener noreferrer nofollow\">entrypoint.sh<\/a><\/p>\n<pre><code># https:\/\/e.printstacktrace.blog\/merging-json-files-recursively-in-the-command-line\/ jq -s '       def deepmerge(a;b):           reduce b[] as $item (a;               reduce ($item | keys_unsorted[]) as $key (.;                   $item[$key] as $val | ($val | type) as $type | .[$key] = if ($type == \"object\") then                             deepmerge({}; [if .[$key] == null then {} else .[$key] end, $val])                   elif ($type == \"array\") then                       (.[$key] + $val)                   else                       $val                   end               )           );       deepmerge({}; .)' openvpn\/inventory\/* > inventories.json;<\/code><\/pre>\n<p>\u042f \u0442\u0443\u0442 \u043d\u0435 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e \u0443\u043a\u0430\u0437\u0430\u043b \u0441\u0441\u044b\u043b\u043a\u0443 \u043d\u0430\u0434 \u0434\u0430\u043d\u043d\u044b\u043c \u043a\u043e\u0434\u043e\u043c, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u0434\u043b\u044f \u043c\u0435\u0440\u0436\u0430 json-\u043e\u0432 \u043c\u043d\u0435 \u043f\u0440\u0438\u0448\u043b\u043e\u0441\u044c \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0434\u0440\u0443\u0433\u0430-\u0438\u043d\u0442\u0435\u0440\u043d\u0435\u0442\u0430, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043f\u0438\u0441\u0430\u0442\u044c \u043f\u043e\u0434\u043e\u0431\u043d\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u043c\u043d\u0435 \u0441\u0430\u043c\u043e\u043c\u0443 \u043d\u0435 \u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c, \u0430 \u0437\u0430\u0434\u0430\u0447\u0430, \u043e\u0447\u0435\u0432\u0438\u0434\u043d\u043e, \u0443\u0436\u0435 \u0431\u044b\u043b\u0430 \u043a\u0435\u043c-\u0442\u043e \u0440\u0435\u0448\u0435\u043d\u0430, \u0447\u0442\u043e \u0438 \u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0434\u0438\u043b\u043e\u0441\u044c \u043f\u043e\u0441\u043b\u0435 \u043d\u0435\u0434\u043e\u043b\u0433\u043e\u0439 \u0433\u0443\u0433\u043b\u0435\u0436\u043a\u0438. \u0417\u0430 <a href=\"https:\/\/e.printstacktrace.blog\/merging-json-files-recursively-in-the-command-line\/\" rel=\"noopener noreferrer nofollow\">\u0434\u0430\u043d\u043d\u044b\u0439 \u043a\u043e\u0434<\/a> \u0432\u044b\u0440\u0430\u0436\u0430\u044e \u0431\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u043d\u043e\u0441\u0442\u044c \u0432 \u0430\u0434\u0440\u0435\u0441 <a href=\"https:\/\/e.printstacktrace.blog\/about\" rel=\"noopener noreferrer nofollow\"><u>Szymon Stepniak<\/u><\/a>. \u042f \u0432\u043d\u0435\u0441 \u0432 \u044d\u0442\u043e\u0442 \u043a\u043e\u0434 \u043b\u0438\u0448\u044c \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0438\u0435 \u043f\u043e\u0447\u0442\u0438 \u043a\u043e\u0441\u043c\u0435\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043a\u043e\u0434 \u0440\u0430\u0431\u043e\u0442\u0430\u043b \u043d\u0435 \u0441\u043e\u0432\u0441\u0435\u043c \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e.<\/p>\n<p>\u041f\u043e \u0438\u0442\u043e\u0433\u0443 \u043e\u0442\u0440\u0430\u0431\u043e\u0442\u043a\u0438 <strong>jq<\/strong> \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0437\u0434\u0430\u043d <strong>inventories.json<\/strong> \u0444\u0430\u0439\u043b \u0432\u0438\u0434\u0430<\/p>\n<pre><code>{   \"vpn_hosts\": [     {        \"name\": \"master\",        \"ip\": \"10.10.0.1\",        \"reverse_ip\": \"1.0.10.10\"     },     {        \"name\": \"worker1\",        \"ip\": \"10.10.0.6\",        \"reverse_ip\": \"6.0.10.10\"     },     {        \"name\": \"worker2\",        \"ip\": \"10.10.0.8\",        \"reverse_ip\": \"8.0.10.10\"     }    ] }<\/code><\/pre>\n<h2>\u041f\u043e\u0440\u0430 \u0443\u0436\u0435 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u044d\u0442\u043e\u0442 \u043f\u0430\u0441\u043f\u043e\u0440\u0442\u043d\u044b\u0439 \u0441\u0442\u043e\u043b<\/h2>\n<p>\u0414\u043b\u044f \u0440\u0430\u0437\u0432\u043e\u0440\u0430\u0447\u0438\u0432\u0430\u043d\u0438\u044f DNS-\u0441\u0435\u0440\u0432\u0435\u0440\u0430 BIND \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u0430\u043d\u0441\u0438\u0431\u043b <a href=\"https:\/\/gitlab.com\/paap.cloud\/kubos\/-\/blob\/feature\/dns\/docker\/ansible\/dns\/playbook.yml\" rel=\"noopener noreferrer nofollow\">playbook<\/a><\/p>\n<pre><code>--- - hosts: master   become: true   become_user: root   become_method: sudo   roles:     - dns-server  - hosts: all,!master   become: true   become_user: root   become_method: sudo   roles:     - dns-client<\/code><\/pre>\n<p>\u0412 \u0434\u0430\u043d\u043d\u043e\u043c \u043f\u043b\u0435\u0439\u0431\u0443\u043a\u0435 2 \u0440\u043e\u043b\u0438: \u0434\u043d\u0441-\u0441\u0435\u0440\u0432\u0435\u0440 \u0438 \u0434\u043d\u0441-\u043a\u043b\u0438\u0435\u043d\u0442. \u042d\u0442\u043e\u0442 \u043f\u043b\u0435\u0439\u0431\u0443\u043a \u043a\u0430\u043a \u0438 \u0440\u0430\u043d\u0435\u0435 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442\u0441\u044f \u0438\u0437 \u0434\u043e\u043a\u0435\u0440\u0430 \u0432 \u0441\u043a\u0440\u0438\u043f\u0442\u0435 <a href=\"https:\/\/gitlab.com\/paap.cloud\/kubos\/-\/blob\/feature\/dns\/docker\/entrypoint.sh\" rel=\"noopener noreferrer nofollow\">entrypoint.sh<\/a> \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0433\u043e \u0440\u044f\u0434\u0430 \u043a\u043e\u043c\u0430\u043d\u0434<\/p>\n<pre><code># \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0430 \u0444\u0430\u0439\u043b\u0430 \u0438\u043d\u0432\u0435\u043d\u0442\u0430\u0440\u0438\u0437\u0430\u0446\u0438\u0438 \u0445\u043e\u0441\u0442\u043e\u0432 \u0434\u043b\u044f \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 DNS {   echo \"[servers]\";   echo \"master ansible_host=host.docker.internal ansible_port=${MASTER_PORT} ansible_user=${USER_NAME} ansible_password=${USER_PASSWORD} ansible_sudo_pass=${USER_PASSWORD}\";   echo \"\";   echo \"[clients]\";   echo \"worker1 ansible_host=host.docker.internal ansible_port=${WORKER1_PORT} ansible_user=${USER_NAME} ansible_password=${USER_PASSWORD} ansible_sudo_pass=${USER_PASSWORD}\";   echo \"worker2 ansible_host=host.docker.internal ansible_port=${WORKER2_PORT} ansible_user=${USER_NAME} ansible_password=${USER_PASSWORD} ansible_sudo_pass=${USER_PASSWORD}\";   echo \"worker3 ansible_host=host.docker.internal ansible_port=${WORKER3_PORT} ansible_user=${USER_NAME} ansible_password=${USER_PASSWORD} ansible_sudo_pass=${USER_PASSWORD}\";   echo \"worker4 ansible_host=host.docker.internal ansible_port=${WORKER4_PORT} ansible_user=${USER_NAME} ansible_password=${USER_PASSWORD} ansible_sudo_pass=${USER_PASSWORD}\";       } > dns\/hosts;  # \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 DNS ansible-playbook -i dns\/hosts dns\/playbook.yml \\   --extra-vars \"dns_ip=$VIRTUAL_NETWORK_GATEWAY\" \\   --extra-vars \"@inventories.json\";<\/code><\/pre>\n<p>\u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u043a\u0430\u043a \u043e\u0431\u044b\u0447\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0435\u0442\u0441\u044f \u0444\u0430\u0439\u043b \u0438\u043d\u0432\u0435\u043d\u0442\u0430\u0440\u0438\u0437\u0430\u0446\u0438\u0438 \u0445\u043e\u0441\u0442\u043e\u0432 \u0434\u043b\u044f \u0430\u043d\u0441\u0438\u0431\u043b\u0430, \u0430 \u0434\u0430\u043b\u0435\u0435 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0441\u0430\u043c\u043e\u0435 \u0433\u043b\u0430\u0432\u043d\u043e\u0435: \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0430 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0432 \u043f\u043b\u0435\u0439\u0431\u0443\u043a. \u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u0447\u0442\u043e \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u043f\u0435\u0440\u0435\u0434\u0430\u044e\u0442\u0441\u044f \u043f\u0443\u0442\u0435\u043c \u0441\u043a\u0430\u0440\u043c\u043b\u0438\u0432\u0430\u043d\u0438\u044f <strong>inventories.json<\/strong> \u0444\u0430\u0439\u043b\u0430, \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0432\u044b\u0448\u0435 \u043f\u043e\u0441\u043b\u0435 \u043c\u0435\u0440\u0436\u0430.<\/p>\n<p>\u041a\u043e\u0433\u0434\u0430 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043f\u043b\u0435\u0439\u0431\u0443\u043a, \u0442\u043e \u043d\u0430 <a href=\"https:\/\/gitlab.com\/paap.cloud\/kubos\/-\/blob\/feature\/dns\/docker\/ansible\/dns\/roles\/dns-server\/tasks\/main.yml\" rel=\"noopener noreferrer nofollow\">\u0434\u043d\u0441-\u0441\u0435\u0440\u0432\u0435\u0440\u0435<\/a> \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0441\u0430\u043c bind, \u0430 \u043f\u043e\u0442\u043e\u043c \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u0435\u0433\u043e \u043a\u043e\u043d\u0444\u0438\u0433\u043e\u0432 \u043f\u0443\u0442\u0435\u043c \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f jinja2 \u0448\u0430\u0431\u043b\u043e\u043d\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0442\u0430\u043a \u043b\u044e\u0431\u044f\u0442 \u0430\u043d\u0441\u0438\u0431\u043b \u0434\u0435\u0432\u043e\u043f\u0441\u044b :). \u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u043f\u0440\u0438\u0432\u0435\u0434\u0443 \u044d\u0442\u0443 \u0447\u0430\u0441\u0442\u044c \u0441\u043a\u0440\u0438\u043f\u0442\u0430 \u0430\u043d\u0441\u0438\u0431\u043b\u0430, \u0430 \u043f\u043e\u0442\u043e\u043c \u0440\u0430\u0437\u0431\u0435\u0440\u0435\u043c \u0441\u0430\u043c\u0438 \u0448\u0430\u0431\u043b\u043e\u043d\u044b<\/p>\n<pre><code>- name: Install bind9   apt:     update_cache: yes     name: [ 'bind9', 'bind9utils', 'bind9-doc' ]     state: present   register: bind9_installed  - name: Replace named.conf.options   template:     src: named.conf.options.j2     dest: \/etc\/bind\/named.conf.options   when: bind9_installed.changed  - name: Replace named.conf.local   template:     src: named.conf.local.j2     dest: \/etc\/bind\/named.conf.local   when: bind9_installed.changed  - name: Ensure \/etc\/bind\/zones directory exists   file:     path: \/etc\/bind\/zones     state: directory  - name: Create db.host.name files   template:     src: db.host.name.j2     dest: \"\/etc\/bind\/zones\/db.{{ item.name }}\"   with_items: \"{{ vpn_hosts }}\"   when: bind9_installed.changed  - name: Create db.host.ip files   template:     src: db.host.ip.j2     dest: \"\/etc\/bind\/zones\/db.{{ item.ip }}\"   with_items: \"{{ vpn_hosts }}\"   when: bind9_installed.changed<\/code><\/pre>\n<p>\u0422\u0443\u0442 \u0432\u0441\u0435\u0433\u043e 4 \u043a\u043e\u043d\u0444\u0438\u0433\u0430, \u0445\u043e\u0442\u044f \u043d\u0435 \u0442\u0430\u043a\u043e\u0435 \u0443\u0436 \u0438 &#171;\u0432\u0441\u0435\u0433\u043e&#187; :). \u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u0441\u043e\u0437\u0434\u0430\u044e\u0442\u0441\u044f \u043e\u043f\u0446\u0438\u0438 <a href=\"https:\/\/gitlab.com\/paap.cloud\/kubos\/-\/blob\/feature\/dns\/docker\/ansible\/dns\/roles\/dns-server\/templates\/named.conf.options.j2\" rel=\"noopener noreferrer nofollow\"><strong>named.conf.options<\/strong><\/a><\/p>\n<pre><code>acl trusted_clients { {% for vpn_host in vpn_hosts %}     {{ vpn_host.ip }}; # {{ vpn_host.name }} {% endfor %} };  options { directory \"\/var\/cache\/bind\";  allow-query { trusted_clients; };  forwarders { 8.8.8.8; 8.8.4.4; };  \/\/======================================================================== \/\/ If BIND logs error messages about the root key being expired, \/\/ you will need to update your keys.  See https:\/\/www.isc.org\/bind-keys \/\/======================================================================== dnssec-validation auto;  listen-on-v6 { any; }; };<\/code><\/pre>\n<p>\u0422\u0443\u0442 \u0438\u0437 \u0432\u0430\u0436\u043d\u043e\u0433\u043e, \u044d\u0442\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 ip \u0430\u0434\u0440\u0435\u0441\u043e\u0432 \u0442\u0435\u0445 \u043c\u0430\u0448\u0438\u043d, \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f DNS-\u0441\u0435\u0440\u0432\u0435\u0440\u043e\u043c (<strong>trusted_clients<\/strong>). \u0412 \u0431\u043b\u043e\u043a\u0435 <strong>acl<\/strong> \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0448\u0430\u0431\u043b\u043e\u043d\u0430 \u0438\u0434\u0435\u0442 \u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0435 \u0432\u0441\u0435\u0445 ip-\u0430\u0434\u0440\u0435\u0441\u043e\u0432 \u0432\u0441\u0435\u0445 \u043c\u0430\u0448\u0438\u043d \u0432 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0439 \u0441\u0435\u0442\u0438. \u0412 \u0431\u043b\u043e\u043a\u0435 <strong>options<\/strong> \u0434\u0430\u043d\u043d\u044b\u0439 acl \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f, \u043a\u0430\u043a \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u043d\u044b\u0439, \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u0434\u0438\u0440\u0435\u043a\u0442\u0438\u0432\u044b <strong>allow-query<\/strong>. \u0422\u0430\u043a\u0436\u0435 \u0432 \u0431\u043b\u043e\u043a\u0435 <strong>options<\/strong> \u0432\u0430\u0436\u043d\u043e \u0437\u0430\u0434\u0430\u0442\u044c \u0440\u0430\u0437\u0434\u0435\u043b <strong>forwarders<\/strong>, \u0447\u0442\u043e\u0431\u044b \u0434\u043b\u044f \u0438\u043c\u0435\u043d, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0435 \u043e\u0442\u043d\u043e\u0441\u044f\u0442\u0441\u044f \u043a \u043d\u0430\u0448\u0435\u0439 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0439 \u0441\u0435\u0442\u0438, \u043f\u043e\u0438\u0441\u043a ip-\u0430\u0434\u0440\u0435\u0441\u043e\u0432 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u043b\u0441\u044f \u043d\u0430 DNS-\u0441\u0435\u0440\u0432\u0435\u0440\u0430\u0445 google. \u0412\u0441\u0435 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u043e\u0435 \u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043e \u0431\u0435\u0437 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439 \u0432 \u0442\u043e\u043c \u0432\u0438\u0434\u0435, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0434\u0430\u043d\u043d\u044b\u0439 \u0444\u0430\u0439\u043b \u043f\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441 bind9.<\/p>\n<p>\u0414\u0430\u043b\u0435\u0435 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0431\u0430\u0437\u043e\u0432\u044b\u0439 \u043a\u043e\u043d\u0444\u0438\u0433 <a href=\"https:\/\/gitlab.com\/paap.cloud\/kubos\/-\/blob\/feature\/dns\/docker\/ansible\/dns\/roles\/dns-server\/templates\/named.conf.local.j2\" rel=\"noopener noreferrer nofollow\"><strong>named.conf.local <\/strong><\/a><\/p>\n<pre><code>{% for vpn_host in vpn_hosts %} \/\/ For {{ vpn_host.name }}  zone \"{{ vpn_host.name }}\" {     type master;     file \"\/etc\/bind\/zones\/db.{{ vpn_host.name }}\"; # zone file path };  zone \"{{ vpn_host.reverse_ip }}.in-addr.arpa\" {     type master;     file \"\/etc\/bind\/zones\/db.{{ vpn_host.ip }}\";  # reverse zone file path for {{ vpn_host.name }}       };  {% endfor %}<\/code><\/pre>\n<p>\u0414\u043b\u044f \u0443\u043f\u0440\u043e\u0449\u0435\u043d\u0438\u044f \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0430\u0446\u0438\u0438 \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0448\u0430\u0431\u043b\u043e\u043d\u0430 \u0431\u0443\u0434\u0435\u043c \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u043f\u043e \u043e\u0434\u043d\u043e\u0439 \u0437\u043e\u043d\u0435 \u0438 \u0440\u0435\u0432\u0435\u0440\u0441\u0438\u0432\u043d\u043e\u0439 \u0437\u043e\u043d\u0435 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0445\u043e\u0441\u0442\u0430 \u0432 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0439 \u0441\u0435\u0442\u0438. \u0418\u0434\u0435\u043e\u043b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u0438 \u044d\u0442\u043e \u043d\u0435 \u0441\u043e\u0432\u0441\u0435\u043c \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043d\u0443\u0436\u043d\u043e \u0432\u0441\u0435\u0433\u043e 2 \u0437\u043e\u043d\u044b: \u0437\u043e\u043d\u0430 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0439 \u0441\u0435\u0442\u0438 \u0438 \u0440\u0435\u0432\u0435\u0440\u0441\u0438\u0432\u043d\u0430\u044f \u0437\u043e\u043d\u0430 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0439 \u0441\u0435\u0442\u0438. \u041e\u0434\u043d\u0430\u043a\u043e \u0438\u0437-\u0437\u0430 \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u043a\u043e\u043d\u0444\u0438\u0433\u043e\u0432 bind, \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u0440\u0435\u0432\u0435\u0440\u0441\u0438\u0432\u043d\u044b\u0445 \u043a\u043e\u043d\u0444\u0438\u0433\u043e\u0432, \u0433\u0434\u0435 \u043d\u0443\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0440\u0435\u0432\u0435\u0440\u0441\u0438\u0432\u043d\u044b\u0435 \u0430\u0434\u0440\u0435\u0441\u0430, \u043c\u044b \u0443\u043f\u0440\u043e\u0441\u0442\u0438\u043c \u0441\u0435\u0431\u0435 \u0436\u0438\u0437\u043d\u044c, \u0441\u043e\u0437\u0434\u0430\u0432 \u043f\u043e \u043e\u0434\u043d\u043e\u043c\u0443 \u0444\u0430\u0439\u043b\u0443 \u043d\u0430 \u043a\u0430\u0436\u0434\u043e\u0435 \u0438\u043c\u044f \u0445\u043e\u0441\u0442\u0430 \u0438 \u043d\u0430 \u043a\u0430\u0436\u0434\u044b\u0439 ip-\u0430\u0434\u0440\u0435\u0441 \u0432 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0439 \u0441\u0435\u0442\u0438.<\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043a\u043e\u043d\u0444\u0438\u0433 \u0437\u043e\u043d\u044b <a href=\"https:\/\/gitlab.com\/paap.cloud\/kubos\/-\/blob\/feature\/dns\/docker\/ansible\/dns\/roles\/dns-server\/templates\/db.host.name.j2\" rel=\"noopener noreferrer nofollow\"><strong>db.host.name <\/strong><\/a><\/p>\n<pre><code>; ; BIND data file ; $TTL604800 @INSOAlocalhost. root.localhost. (       3; Serial  604800; Refresh   86400; Retry 2419200; Expire  604800 ); Negative Cache TTL ; ; name servers - NS records                         IN      NS      localhost.  ; name servers - A records localhost.              IN      A       {{ dns_ip }}  ; {{ item.name }} - A records {{ item.name }}.        IN      A       {{ item.ip }}<\/code><\/pre>\n<p>\u0433\u0434\u0435 \u0432\u0430\u0436\u043d\u043e \u0432 Serial \u043f\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c 3 \u0432\u043c\u0435\u0441\u0442\u043e \u0434\u0435\u0444\u043e\u043b\u0442\u043d\u043e\u0439 2-\u043a\u0438, \u0447\u0442\u043e\u0431\u044b bind \u043f\u0440\u0438 \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0443\u0441\u043a\u0435 \u0443\u0432\u0438\u0434\u0435\u043b, \u0447\u0442\u043e \u0432 \u0444\u0430\u0439\u043b \u0432\u043d\u0435\u0441\u0435\u043d\u044b \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f. \u0422\u0430\u043a\u0436\u0435 \u043d\u0443\u0436\u043d\u043e \u0437\u0430\u043f\u043e\u043b\u043d\u0438\u0442\u044c 3 \u0440\u0430\u0437\u0434\u0435\u043b\u0430:<\/p>\n<ul>\n<li>\n<p>NS-\u0437\u0430\u043f\u0438\u0441\u044c \u0441 \u043b\u043e\u043a\u0430\u043b\u0445\u043e\u0441\u0442\u043e\u043c<\/p>\n<\/li>\n<li>\n<p>A-\u0437\u0430\u043f\u0438\u0441\u044c, \u0447\u0442\u043e\u0431\u044b \u0437\u0430\u0434\u0430\u0442\u044c \u0441\u0432\u043e\u0439 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 ip, \u043a\u0430\u043a ip DNS-\u0441\u0435\u0440\u0432\u0435\u0440\u0430<\/p>\n<\/li>\n<li>\n<p>A-\u0437\u0430\u043f\u0438\u0441\u044c, \u0447\u0442\u043e\u0431\u044b \u0437\u0430\u0434\u0430\u0442\u044c \u0441\u0432\u044f\u0437\u044c \u043c\u0435\u0436\u0434\u0443 \u0438\u043c\u0435\u043d\u0435\u043c \u0438 ip \u0430\u0434\u0440\u0435\u0441\u043e\u043c \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0433\u043e \u0445\u043e\u0441\u0442\u0430 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0439 \u0441\u0435\u0442\u0438<\/p>\n<\/li>\n<\/ul>\n<p>\u0422\u0430\u043a\u043e\u0439 \u0444\u0430\u0439\u043b \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c\u0441\u044f \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0445\u043e\u0441\u0442\u0430 \u0432 \u0441\u0435\u0442\u0438.<\/p>\n<p>\u0418 \u043e\u0441\u0442\u0430\u043b\u043e\u0441\u044c \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043a\u043e\u043d\u0444\u0438\u0433 \u0440\u0435\u0432\u0435\u0440\u0441\u043d\u043e\u0439 \u0437\u043e\u043d\u044b <a href=\"https:\/\/gitlab.com\/paap.cloud\/kubos\/-\/blob\/feature\/dns\/docker\/ansible\/dns\/roles\/dns-server\/templates\/db.host.ip.j2\" rel=\"noopener noreferrer nofollow\"><strong>db.host.ip <\/strong><\/a><\/p>\n<pre><code>; ; BIND reverse data file ; $TTL604800 @INSOAlocalhost. root.localhost. (       3; Serial  604800; Refresh   86400; Retry 2419200; Expire  604800 ); Negative Cache TTL ; ; name servers     IN  NS  localhost.  ; PTR Records     IN  PTR {{ item.name }}.  ; {{ item.ip }}<\/code><\/pre>\n<p>\u0422\u0443\u0442 \u0441 \u043f\u043e\u043b\u0435\u043c Serial \u0438 NS-\u0437\u0430\u043f\u0438\u0441\u044c\u044e \u0432\u0441\u0435 \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u043e \u043a\u043e\u043d\u0444\u0438\u0433\u0443 \u0432\u044b\u0448\u0435 \u0434\u043b\u044f \u043d\u0435 \u0440\u0435\u0432\u0435\u0440\u0441\u0438\u0432\u043d\u043e\u0439 \u0437\u043e\u043d\u044b. \u0415\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u0430\u044f \u0440\u0430\u0437\u043d\u0438\u0446\u0430, \u0447\u0442\u043e \u0432\u043c\u0435\u0441\u0442\u043e A-\u0437\u0430\u043f\u0438\u0441\u0438 \u0437\u0430\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u043e\u0434\u043d\u0430 PTR-\u0437\u0430\u043f\u0438\u0441\u044c \u0441 \u0438\u043c\u0435\u043d\u0435\u043c \u043f\u0440\u0438\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u043c \u043a ip-\u0430\u0434\u0440\u0435\u0441\u0443, \u0434\u043b\u044f \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0441\u043e\u0437\u0434\u0430\u0435\u0442\u0441\u044f \u044d\u0442\u043e\u0442 \u0444\u0430\u0439\u043b \u043a\u043e\u043d\u0444\u0438\u0433\u0430.<\/p>\n<p>\u0412\u0435\u0440\u043d\u0435\u043c\u0441\u044f \u043a <a href=\"https:\/\/gitlab.com\/paap.cloud\/kubos\/-\/blob\/feature\/dns\/docker\/ansible\/dns\/roles\/dns-server\/tasks\/main.yml\" rel=\"noopener noreferrer nofollow\">\u0430\u043d\u0441\u0438\u0431\u043b \u0441\u043a\u0440\u0438\u043f\u0442\u0443 \u0441 \u0440\u043e\u043b\u044c\u044e \u0434\u043d\u0441-\u0441\u0435\u0440\u0432\u0435\u0440\u0430<\/a>. \u041f\u043e\u0441\u043b\u0435 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u0432\u0441\u0435 \u0448\u0430\u0431\u043b\u043e\u043d\u044b \u0444\u0430\u0439\u043b\u043e\u0432 \u043a\u043e\u043d\u0444\u0438\u0433\u043e\u0432 \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u044b, \u043d\u0443\u0436\u043d\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e\u0441\u0442\u044c \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 \u0438 \u0440\u0435\u0441\u0442\u0430\u0440\u0442\u043e\u0432\u0430\u0442\u044c \u0434\u043d\u0441-\u0441\u0435\u0440\u0432\u0435\u0440. \u0425\u043e\u0440\u043e\u0448\u043e, \u0447\u0442\u043e \u0434\u043b\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u043a\u043e\u043d\u0444\u0438\u0433\u043e\u0432 bind \u043e\u043d \u043f\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0432\u043c\u0435\u0441\u0442\u0435 \u0441 \u0442\u0430\u043a\u0438\u043c\u0438 \u0443\u0442\u0438\u043b\u0438\u0442\u0430\u043c\u0438, \u043a\u0430\u043a named-checkconf \u0438 named-checkzone. \u0418\u043c\u0438 \u043c\u044b \u0438 \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0441\u044f<\/p>\n<pre><code>- name: Run named-checkconf   shell: |     named-checkconf;   when: bind9_installed.changed  - name: Run named-checkzone for zones   shell: |     named-checkzone {{ item.name }} \/etc\/bind\/zones\/db.{{ item.name }};   with_items: \"{{ vpn_hosts }}\"   when: bind9_installed.changed  - name: Run named-checkzone for reverse zones   shell: |     named-checkzone {{ item.reverse_ip }}.in-addr.arpa \/etc\/bind\/zones\/db.{{ item.ip }};         with_items: \"{{ vpn_hosts }}\"   when: bind9_installed.changed  - name: Restart named   service:     name: named     state: restarted   when: bind9_installed.changed<\/code><\/pre>\n<h2>\u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0442\u044c \u043d\u0438\u043a\u043e\u0433\u0434\u0430 \u043d\u0435 \u043b\u0438\u0448\u043d\u0435<\/h2>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0434\u043d\u0441-\u0441\u0435\u0440\u0432\u0435\u0440 \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043d \u0432\u0435\u0440\u043d\u043e \u0438 \u043d\u0430 \u044d\u0442\u043e\u043c \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u043a\u0430\u043d\u0447\u0438\u0432\u0430\u0442\u044c, \u043d\u043e \u044f \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u044e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0432 \u0430\u043d\u0441\u0438\u0431\u043b \u0441\u043a\u0440\u0438\u043f\u0442\u044b \u0438 \u0441\u043a\u0440\u0438\u043f\u0442 \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u0430\u043d\u0441\u0438\u0431\u043b \u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0432 \u0434\u043e\u043a\u0435\u0440 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0435, \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043a\u043e\u0434 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e\u0441\u0442\u0438 \u043e\u0442\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0432\u0441\u0435\u0445 \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043a<\/p>\n<pre><code>- name: Check DNS working correct   shell: |     # \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c, \u0447\u0442\u043e DNS \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043d \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e     if [ $(nslookup google.com | grep -c \"Address:\\s\\+{{ dns_ip }}#53\") != 1 ]; then       echo \"Using incorrect DNS server\";       exit 1;     fi     if [ $(nslookup google.com | grep -c \"** server can't find\") != 0 ]; then       echo \"DNS not working\";       exit 1;     fi     for (( index=0; index&lt;$(echo \"{{ vpn_hosts }}\" | jq length); index++ )); do       name=$(echo \"{{ vpn_hosts }}\" | jq -sr \".[0][$index].name\");       ip=$(echo \"{{ vpn_hosts }}\" | jq -sr \".[0][$index].ip\");       reverse_ip=$(echo \"{{ vpn_hosts }}\" | jq -sr \".[0][$index].reverse_ip\");       echo \"Check DNS for name=$name ip=$ip reverse_ip=$reverse_ip\";       if [ $(nslookup $name | grep -c \"Address: $ip\") != 1 ]; then         echo \"DNS server's zones configured incorrectly\";         exit 1;       fi       if [ $(nslookup $ip | grep -c \"$reverse_ip.in-addr.arpa\\s\\+name = $name.\") != 1 ]; then              echo \"DNS server's reverse zones configured incorrectly\";         exit 1;       fi     done     echo \"DNS - OK\";      echo \"\" > $HOME\/dns.checked;   args:     creates: $HOME\/dns.checked     executable: \/bin\/bash # \u043c\u0435\u043d\u044f\u044e, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \/bin\/sh \u043d\u0435 \u0441\u043f\u0440\u0430\u0432\u0438\u0442\u0441\u044f \u0441 for \u0432\u044b\u0448\u0435<\/code><\/pre>\n<p>\u0412 \u044d\u0442\u043e\u043c \u043a\u043e\u0434\u0435 \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442\u0441\u044f, \u0447\u0442\u043e \u0438 \u0438\u043d\u0442\u0435\u0440\u043d\u0435\u0442 \u0438\u043c\u0435\u043d\u0430 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 google.com, \u0438 \u0447\u0442\u043e \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b \u0438\u043c\u0435\u043d\u0430 \u0432\u0441\u0435\u0445 \u043d\u0430\u0448\u0438\u0445 \u043c\u0430\u0448\u0438\u043d. \u0414\u043b\u044f \u043d\u0430\u0448\u0438\u0445 \u043c\u0430\u0448\u0438\u043d \u0442\u0430\u043a\u0436\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442\u0441\u044f \u0438 \u0440\u0435\u0432\u0435\u0440\u0441\u0438\u0432\u043d\u044b\u0439 \u0434\u043d\u0441-\u043f\u043e\u0438\u0441\u043a.<\/p>\n<h2>\u041f\u043e\u0434\u0432\u043e\u0434\u0438\u043c \u0438\u0442\u043e\u0433\u0438<\/h2>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0443 \u043d\u0430\u0441 \u043c\u0430\u0448\u0438\u043d\u044b \u0441\u043e\u0441\u0442\u043e\u044f\u0442 \u0432 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0439 \u0441\u0435\u0442\u0438 \u0438 \u0437\u043d\u0430\u044e\u0442 \u0434\u0440\u0443\u0433 \u0434\u0440\u0443\u0433\u0430 \u043f\u043e \u0438\u043c\u0435\u043d\u0430\u043c.<\/p>\n<p>\u041d\u0430\u0441\u0442\u0430\u043b\u043e \u0432\u0440\u0435\u043c\u044f \u0443\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0440\u043e\u043a-\u043d-\u0440\u043e\u043b\u043b \u043d\u0430 \u044d\u0442\u0438\u0445 \u043c\u0430\u0448\u0438\u043d\u0430\u0445. \u041d\u0430 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c \u044d\u0442\u0430\u043f\u0435 \u044f \u043f\u043b\u0430\u043d\u0438\u0440\u0443\u044e \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u043d\u0430 \u043d\u0438\u0445 <a href=\"https:\/\/ru.wikipedia.org\/wiki\/Kubernetes\" rel=\"noopener noreferrer nofollow\">\u043a\u0443\u0431\u0435\u0440<\/a>. \u0422\u0430\u043a \u0448\u0430\u0433 \u0437\u0430 \u0448\u0430\u0433\u043e\u043c \u043c\u044b \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0447\u0442\u043e-\u0442\u043e \u043f\u0440\u0438\u043b\u0438\u0447\u043d\u043e\u0435 \u0432 \u043d\u0430\u0448\u0435\u043c \u043c\u0438\u043a\u0440\u043e\u043e\u0431\u043b\u0430\u043a\u0435.<\/p>\n<p>\u0418 \u0432 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u0438, \u043a\u0430\u043a \u0432\u0441\u0435\u0433\u0434\u0430, \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u044e \u043f\u0440\u0438\u0441\u043e\u0435\u0434\u0438\u043d\u044f\u0442\u044c\u0441\u044f \u043a <a href=\"https:\/\/t.me\/paap_cloud\" rel=\"noopener noreferrer nofollow\">\u043d\u0430\u0448\u0435\u043c\u0443 \u0442\u0435\u043b\u0435\u0433\u0440\u0430\u043c\u043c \u043a\u0430\u043d\u0430\u043b\u0443<\/a> \u0438 <a href=\"https:\/\/t.me\/paap_cloud_chat\" rel=\"noopener noreferrer nofollow\">\u0447\u0430\u0442\u0443<\/a>. \u041e \u0432\u0441\u0435\u0445 \u043a\u0440\u0443\u043f\u043d\u044b\u0445 \u0432\u0435\u0445\u0430\u0445 \u0440\u0430\u0437\u0432\u0438\u0442\u0438\u044f \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u043f\u043b\u0430\u043d\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c\u0441\u044f \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u0438 \u043d\u0430 \u0445\u0430\u0431\u0440\u0435, \u043d\u043e \u0432 \u043a\u0430\u043d\u0430\u043b\u0435 \u0431\u0443\u0434\u0443\u0442 \u043f\u0443\u0431\u043b\u0438\u043a\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0440\u0430\u0437\u043d\u044b\u0435 \u043c\u044b\u0441\u043b\u0438 \u043f\u043e \u043f\u0440\u043e\u0435\u043a\u0442\u0443, \u0432\u044b\u0437\u044b\u0432\u0430\u044e\u0449\u0438\u0435 \u0442\u0440\u0443\u0434\u043d\u043e\u0441\u0442\u0438. \u0422\u0430\u043a\u0436\u0435 \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u0443\u0432\u0435\u0434\u043e\u043c\u043b\u0435\u043d\u0438\u044f \u043e \u0440\u0430\u0437\u043d\u044b\u0445 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f\u0445, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0435\u0441\u043b\u0438 \u0441\u0442\u0430\u043d\u0435\u0442 \u043f\u043e\u043d\u044f\u0442\u043d\u043e, \u0447\u0442\u043e \u043a\u0443\u0431\u0435\u0440 \u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0435\u0449\u0435 \u0440\u0430\u043d\u043e, \u043a\u0430\u043a \u0443\u0436\u0435 \u0431\u044b\u0432\u0430\u043b\u043e \ud83d\ude42 \u0418, \u0440\u0430\u0437\u0443\u043c\u0435\u0435\u0442\u0441\u044f, \u0432\u0435\u0441\u044c \u043a\u043e\u0434 \u043f\u0443\u0431\u043b\u0438\u043a\u0443\u0435\u0442\u0441\u044f \u043d\u0430 <a href=\"https:\/\/gitlab.com\/paap.cloud\/kubos\/-\/tree\/feature\/dns\" rel=\"noopener noreferrer nofollow\">\u0433\u0438\u0442\u043b\u0430\u0431\u0435<\/a>. \u041a\u043e\u0434 \u043e\u0442\u043a\u0440\u044b\u0442, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043d\u0430\u0448\u0430 \u0437\u0430\u0434\u0430\u0447\u0430 &#8212; \u044d\u0442\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c <a href=\"http:\/\/www.paap.cloud\/\" rel=\"noopener noreferrer nofollow\">\u043e\u0431\u043b\u0430\u043a\u043e <\/a>\u043a\u0430\u043a \u043f\u0440\u043e\u0434\u0443\u043a\u0442 \u0438 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e.<\/p>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"v-portal\" style=\"display:none;\"><\/div>\n<\/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\/post\/663868\/\"> https:\/\/habr.com\/ru\/post\/663868\/<\/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\u0432\u043e\u0435\u0439 <a href=\"https:\/\/habr.com\/ru\/post\/661077\/\" rel=\"noopener noreferrer nofollow\">\u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0439 \u0441\u0442\u0430\u0442\u044c\u0435<\/a> \u044f \u0443\u0436\u0435 \u0443\u043f\u043e\u043c\u0438\u043d\u0430\u043b, \u0447\u0442\u043e \u0441\u043e\u0437\u0434\u0430\u044e \u0441\u0432\u043e\u0451 \u043c\u0438\u043a\u0440\u043e\u043e\u0431\u043b\u0430\u043a\u043e. \u0422\u043e\u0447\u043d\u0435\u0435, \u043d\u0443 \u043a\u0430\u043a \u0441\u0432\u043e\u0451, \u044d\u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u043e\u0431\u043b\u0430\u043a\u043e \u043a\u0430\u043a \u043f\u0440\u043e\u0434\u0443\u043a\u0442, \u0430 \u043d\u0435 \u043a\u0430\u043a \u0443\u0441\u043b\u0443\u0433\u0430. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043e\u043d\u043e \u0442\u0430\u043a\u043e\u0435 \u0436\u0435 \u043c\u043e\u0451, \u043a\u0430\u043a \u0438 \u0432\u0430\u0448\u0435. \u041a\u0430\u043a \u0438 \u0432\u0441\u0435\u0433\u043e \u043c\u0438\u0440\u0430. \u0422\u043e \u0435\u0441\u0442\u044c \u043a\u0430\u0436\u0434\u044b\u0439 \u0441\u043c\u043e\u0436\u0435\u0442 \u0435\u0433\u043e \u0440\u0430\u0437\u0432\u0435\u0440\u043d\u0443\u0442\u044c \u043d\u0430 \u0441\u0432\u043e\u0451 \u0436\u0435\u043b\u0435\u0437\u043e, \u0431\u0443\u0434\u044c \u0442\u043e \u0434\u0430\u0442\u0430\u0446\u0435\u043d\u0442\u0440 \u0438\u043b\u0438 \u043f\u0430\u0440\u0430-\u0442\u0440\u043e\u0439\u043a\u0430 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0445 \u043c\u0430\u0448\u0438\u043d \u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0438\u043c \u0432 \u0441\u0432\u043e\u0451 \u0443\u0434\u043e\u0432\u043e\u043b\u044c\u0441\u0442\u0432\u0438\u0435, \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u044f \u043d\u0430 \u043d\u0435\u043c \u0441\u0432\u043e\u0438 \u043f\u043e\u0442\u0440\u044f\u0441\u0430\u044e\u0449\u0438\u0435 \u043f\u0440\u043e\u0435\u043a\u0442\u044b. \u041c\u043e\u0436\u043d\u043e \u0434\u0430\u0436\u0435 \u043d\u0430\u0439\u0442\u0438 \u043a\u0430\u043a\u043e\u0439-\u0442\u043e \u0433\u043e\u0442\u043e\u0432\u044b\u0439 \u043f\u0440\u043e\u0435\u043a\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043b\u0435\u0436\u0438\u0442 \u0433\u0434\u0435-\u043d\u0438\u0431\u0443\u0434\u044c \u043d\u0430 \u0433\u0438\u0442\u0445\u0430\u0431\u0435 \u0438 \u0434\u0430\u0432\u043d\u043e \u043f\u0440\u043e\u0441\u0438\u0442\u0441\u044f \u043d\u0430 \u0441\u0442\u0430\u0440\u0442, \u0442\u043e\u043b\u044c\u043a\u043e \u0430\u0432\u0442\u043e\u0440\u0443 \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c \u0435\u0433\u043e \u0431\u044b\u043b\u043e \u043d\u0435\u0433\u0434\u0435, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u0438\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u043e\u0432 \u0443 \u043d\u0430\u0441 \u0431\u0435\u0441\u043f\u043b\u0430\u0442\u043d\u043e\u0435, \u0430 \u0432\u043e\u0442 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0430 \u0440\u0430\u0431\u043e\u0442\u044b \u0441\u0432\u043e\u0435\u0433\u043e \u0441\u0435\u0440\u0432\u0438\u0441\u0430 \u043a \u0434\u0435\u0448\u0435\u0432\u043e\u043c\u0443 \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u0443 \u044d\u043a\u043e\u043d\u043e\u043c\u0438\u043a\u0438 \u043d\u0430 \u043c\u043e\u0439 \u0432\u0437\u0433\u043b\u044f\u0434 \u043d\u0435 \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0441\u044f. \u0410 \u044f \u0442\u0430\u043a\u043e\u0439 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u043b \u043e\u0431\u043b\u0430\u043a\u043e, \u0432\u043a\u0438\u043d\u0443\u043b \u0442\u0443\u0434\u0430 \u0447\u0443\u0436\u043e\u0439 \u043f\u0440\u043e\u0435\u043a\u0442 \u0438 \u043f\u043e\u043c\u043e\u0433 \u043c\u0438\u0440\u0443 \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u0442\u043e, \u0447\u0442\u043e \u0442\u0430\u043a \u0438 \u043c\u043e\u0433\u043b\u043e \u043e\u0441\u0442\u0430\u0442\u044c\u0441\u044f \u0432 \u0433\u043b\u0443\u0431\u0438\u043d\u0430\u0445 \u0433\u0438\u0442\u0445\u0430\u0431\u0430. \u041d\u043e \u044d\u0442\u043e \u0444\u0430\u043d\u0442\u0430\u0437\u0438\u0438, \u0434\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0435\u0449\u0435 \u0434\u0430\u043b\u0435\u043a\u043e, \u043d\u043e \u043f\u0443\u0442\u0435\u0448\u0435\u0441\u0442\u0432\u0438\u0435 \u0432 \u0442\u044b\u0441\u044f\u0447\u0443 \u043c\u0438\u043b\u044c \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442\u0441\u044f \u0441 \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u0448\u0430\u0433\u0430, \u0433\u043b\u0430\u0432\u043d\u043e\u0435 \u043d\u0435 \u043f\u0440\u0435\u043a\u0440\u0430\u0449\u0430\u0442\u044c \u043f\u0435\u0440\u0435\u0431\u0438\u0440\u0430\u0442\u044c \u043d\u043e\u0433\u0430\u043c\u0438. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043c\u044b \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u0435\u043c&#8230;<\/p>\n<p>\u0422\u0430\u043a \u0432\u043e\u0442 \u0432 <a href=\"https:\/\/habr.com\/ru\/post\/661077\/\" rel=\"noopener noreferrer nofollow\">\u043f\u0440\u043e\u0448\u043b\u043e\u043c \u043f\u043e\u0441\u0442\u0435<\/a> \u0432 \u0440\u0430\u043c\u043a\u0430\u0445 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 <a href=\"https:\/\/gitlab.com\/paap.cloud\/kubos\/-\/tree\/feature\/openvpn\" rel=\"noopener noreferrer nofollow\">kubos <\/a>\u043c\u044b \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043b\u0438\u0441\u044c \u043d\u0430 \u0442\u043e\u043c, \u0447\u0442\u043e \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0438\u043b\u0438 \u0432\u0441\u0435 \u043c\u0430\u0448\u0438\u043d\u043a\u0438 \u043d\u0430\u0448\u0435\u0433\u043e \u0431\u0443\u0434\u0443\u0449\u0435\u0433\u043e \u043e\u0431\u043b\u0430\u043a\u0430 \u0432 \u043e\u0431\u0449\u0443\u044e \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u0443\u044e \u0441\u0435\u0442\u044c. \u0422\u0435\u043f\u0435\u0440\u044c \u043f\u043e\u0440\u0430 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0442\u0430\u043a, \u0447\u0442\u043e\u0431\u044b \u043c\u0430\u0448\u0438\u043d\u043a\u0438 \u0432\u0438\u0434\u0435\u043b\u0438 \u0434\u0440\u0443\u0433 \u0434\u0440\u0443\u0433\u0430 \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e IP-\u0430\u0434\u0440\u0435\u0441\u0430\u043c, \u043d\u043e \u0438 \u043f\u043e \u0438\u043c\u0435\u043d\u0430\u043c. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043d\u0443\u0436\u043d\u043e \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c DNS \u0441\u0435\u0440\u0432\u0435\u0440, \u0447\u0435\u043c \u043c\u044b \u0441\u0435\u0439\u0447\u0430\u0441 \u0438 \u0437\u0430\u0439\u043c\u0435\u043c\u0441\u044f. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u044f \u043e\u0442\u0432\u0435\u043b \u0432 \u0433\u0438\u0442\u043b\u0430\u0431\u0435 <a href=\"https:\/\/gitlab.com\/paap.cloud\/kubos\/-\/tree\/feature\/dns\" rel=\"noopener noreferrer nofollow\">\u043e\u0442\u0434\u0435\u043b\u044c\u043d\u0443\u044e \u0432\u0435\u0442\u043a\u0443<\/a>, \u0433\u0434\u0435 \u0438 \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d \u043f\u043e\u043b\u043d\u044b\u0439 \u043a\u043e\u0434 ansible \u0438 \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0432, \u043e \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043f\u043e\u0439\u0434\u0435\u0442 \u0440\u0435\u0447\u044c \u043d\u0438\u0436\u0435.<\/p>\n<h2>\u0421\u043e\u0431\u0438\u0440\u0430\u0435\u043c \u0438\u043d\u0444\u0443 \u043e \u0445\u043e\u0441\u0442\u0430\u0445<\/h2>\n<p>\u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u043d\u0443\u0436\u043d\u043e \u0441 \u043a\u0430\u0436\u0434\u043e\u0439 \u043c\u0430\u0448\u0438\u043d\u044b \u0432 \u043d\u0430\u0448\u0435\u0439 \u0441\u0435\u0442\u0438 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e \u0442\u043e\u043c, \u043a\u0430\u043a\u043e\u0439 ip-\u0430\u0434\u0440\u0435\u0441 \u0435\u0439 \u0431\u044b\u043b \u0432\u044b\u0434\u0430\u043d \u043f\u0440\u0438 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0438 \u0432 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u0443\u044e \u0441\u0435\u0442\u044c. \u0412\u0435\u0440\u043e\u044f\u0442\u043d\u043e, \u044f \u0441\u0434\u0435\u043b\u0430\u043b \u044d\u0442\u043e \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043a\u043e\u0441\u0442\u044b\u043b\u044c\u043d\u043e, \u043d\u043e \u043d\u0435 \u043d\u0430\u0448\u0435\u043b \u043d\u0438\u0447\u0435\u0433\u043e \u043b\u0443\u0447\u0448\u0435, \u043a\u0430\u043a \u043d\u0430 \u043a\u0430\u0436\u0434\u043e\u0439 \u043c\u0430\u0448\u0438\u043d\u0435 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c json-\u0444\u0430\u0439\u043b \u0441 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435\u043c \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u0435\u0435 \u0437\u043e\u0432\u0443\u0442 \u0438 \u043a\u0430\u043a\u043e\u0439 ip-\u0430\u0434\u0440\u0435\u0441 \u0435\u0439 \u0432\u044b\u0434\u0430\u043d. \u041a\u043e\u0434 \u043d\u0438\u0436\u0435 \u0431\u044b\u043b \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d \u0432 \u0430\u043d\u0441\u0438\u0431\u043b \u0441\u043a\u0440\u0438\u043f\u0442\u044b \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f openvpn \u0441\u0435\u0442\u0438 <a href=\"https:\/\/gitlab.com\/paap.cloud\/kubos\/-\/blob\/feature\/dns\/docker\/ansible\/openvpn\/roles\/openvpn-client\/tasks\/main.yml\" rel=\"noopener noreferrer nofollow\">\u0442\u0443\u0442 <\/a>\u0438 <a href=\"https:\/\/gitlab.com\/paap.cloud\/kubos\/-\/blob\/feature\/dns\/docker\/ansible\/openvpn\/roles\/openvpn-server\/tasks\/main.yml\" rel=\"noopener noreferrer nofollow\">\u0442\u0443\u0442<\/a><\/p>\n<pre><code># \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0430 \u0440\u0435\u0435\u0441\u0442\u0440\u0430 \u043a\u0430\u043a\u043e\u043c\u0443 \u0445\u043e\u0441\u0442\u0443 \u043a\u0430\u043a\u043e\u0439 IP \u0431\u044b\u043b \u0432\u044b\u0434\u0430\u043d \u043f\u0440\u0438 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0438 \u043a \u0441\u0435\u0442\u0438 OpenVPN - name: Create {{inventory_hostname}}.json file   shell: |     VPN_IP=$(ip route | grep tun0 | grep -v via | sed 's\/.* src \\([0-9.]*\\).*\/\\1\/');     REVERSE_VPN_IP=$(echo $VPN_IP | awk -F . '{print $4\".\"$3\".\"$2\".\"$1}');     echo \"{ \\\"vpn_hosts\\\": [ { \\\"name\\\": \\\"{{ inventory_hostname }}\\\", \\\"ip\\\": \\\"$VPN_IP\\\", \\\"reverse_ip\\\": \\\"$REVERSE_VPN_IP\\\" } ] }\" > {{inventory_hostname}}.json;                args:     chdir: $HOME     creates: \"{{inventory_hostname}}.json\"  - name: Fetch {{inventory_hostname}}.json   fetch:     src: \"$HOME\/{{inventory_hostname}}.json\"     dest: \"{{ playbook_dir }}\/inventory\/\"     flat: yes<\/code><\/pre>\n<p>\u0422\u0430\u043a\u043e\u0439 \u0436\u0435 \u043a\u043e\u0434 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442\u0441\u044f \u0438 \u0432 \u0441\u043a\u0440\u0438\u043f\u0442\u0435 \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u0430\u043d\u0441\u0438\u0431\u043b \u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0432, \u0442\u043e \u0435\u0441\u0442\u044c \u0432 \u0444\u0430\u0439\u043b\u0435 <a href=\"https:\/\/gitlab.com\/paap.cloud\/kubos\/-\/blob\/feature\/dns\/docker\/entrypoint.sh\" rel=\"noopener noreferrer nofollow\">entrypoint.sh<\/a>. \u041d\u0430\u043f\u043e\u043c\u0438\u043d\u0430\u044e, \u0447\u0442\u043e \u0441\u043a\u0440\u0438\u043f\u0442 \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u0430\u043d\u0441\u0438\u0431\u043b \u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0432 \u043c\u044b \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u0438\u0437 \u0434\u043e\u043a\u0435\u0440 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0430 \u0438 \u044d\u0442\u043e\u0442 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440 \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u0447\u0430\u0441\u0442\u044c\u044e \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0439 \u0441\u0435\u0442\u0438<\/p>\n<pre><code># \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0430 \u0440\u0435\u0435\u0441\u0442\u0440\u0430 \u043a\u0430\u043a\u043e\u043c\u0443 \u0445\u043e\u0441\u0442\u0443 \u043a\u0430\u043a\u043e\u0439 IP \u0431\u044b\u043b \u0432\u044b\u0434\u0430\u043d \u043f\u0440\u0438 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0438 \u043a \u0441\u0435\u0442\u0438 OpenVPN VPN_IP=$(ip route | grep tun0 | grep -v via | sed 's\/.* src \\([0-9.]*\\).*\/\\1\/'); REVERSE_VPN_IP=$(echo $VPN_IP | awk -F . '{print $4\".\"$3\".\"$2\".\"$1}'); echo \"{ \\\"vpn_hosts\\\": [ { \\\"name\\\": \\\"docker\\\", \\\"ip\\\": \\\"$VPN_IP\\\", \\\"reverse_ip\\\": \\\"$REVERSE_VPN_IP\\\" } ] }\" > openvpn\/inventory\/docker.json;     <\/code><\/pre>\n<p>\u041d\u0438\u0436\u0435 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d \u043f\u0440\u0438\u043c\u0435\u0440 \u0442\u0430\u043a\u043e\u0433\u043e json-\u0444\u0430\u0439\u043b\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0437\u0434\u0430\u043d \u043d\u0430 \u043a\u0430\u0436\u0434\u043e\u0439 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0439 \u043c\u0430\u0448\u0438\u043d\u0435 \u0438 \u0432 \u0434\u043e\u043a\u0435\u0440-\u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0435<\/p>\n<pre><code>{   \"vpn_hosts\": [     {        \"name\": \"worker1\",        \"ip\": \"10.10.0.6\",        \"reverse_ip\": \"6.0.10.10\"     }    ] }<\/code><\/pre>\n<p>\u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0438\u043c\u0435\u043d\u0438 \u0445\u043e\u0441\u0442\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0438\u043c\u044f \u0445\u043e\u0441\u0442\u0430 \u0441 \u0442\u043e\u0447\u043a\u0438 \u0437\u0440\u0435\u043d\u0438\u044f \u0430\u043d\u0441\u0438\u0431\u043b\u0430, ip &#8212; \u044d\u0442\u043e \u0430\u0434\u0440\u0435\u0441 \u0432\u044b\u0434\u0430\u043d\u043d\u044b\u0439 \u0432 openvpn \u0441\u0435\u0442\u0438 (\u043e\u043d \u043f\u043e\u043b\u0443\u0447\u0435\u043d \u0441\u043a\u0440\u0438\u043f\u0442\u043e\u043c \u0432\u044b\u0448\u0435 \u0438\u0437 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430 tun0). \u0422\u0430\u043a\u0436\u0435 \u0432 \u044d\u0442\u043e\u0442 \u0436\u0435 \u0444\u0430\u0439\u043b \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0440\u0435\u0432\u0435\u0440\u0441\u043d\u044b\u0439 ip-\u0430\u0434\u0440\u0435\u0441, \u0442.\u043a. \u043e\u043d \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f \u0432 \u0442\u0430\u043a\u043e\u043c \u0432\u0438\u0434\u0435 \u043f\u0440\u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0435 \u0440\u0435\u0432\u0435\u0440\u0441\u043d\u043e\u0439 DNS-\u0437\u043e\u043d\u044b (\u0442\u0430\u043a \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0437\u043e\u043d\u0430 DNS, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043d\u0443\u0436\u043d\u0430 \u0434\u043b\u044f \u043f\u043e\u0438\u0441\u043a\u0430 \u0438\u043c\u0435\u043d\u0438 \u0445\u043e\u0441\u0442\u0430 \u043f\u043e \u0435\u0433\u043e ip-\u0430\u0434\u0440\u0435\u0441\u0443). \u0420\u0435\u0432\u0435\u0440\u0441\u043d\u0443\u044e \u0437\u043e\u043d\u0443 \u043d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0442\u044c \u043d\u0435\u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e, \u0435\u0441\u043b\u0438 \u044d\u0442\u043e \u0438 \u043f\u0440\u0430\u0432\u0434\u0430 \u043d\u0435 \u043d\u0443\u0436\u043d\u043e. \u041d\u043e \u044f \u0432\u0441\u0435 \u0436\u0435 \u0440\u0435\u0448\u0438\u043b \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043f\u043e\u043b\u043d\u043e\u0446\u0435\u043d\u043d\u0443\u044e \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0443 DNS, \u0447\u0442\u043e\u0431 \u0443\u0436 \u0434\u043e \u043a\u043e\u043d\u0446\u0430 \u0432\u043e \u0432\u0441\u0435\u043c \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c\u0441\u044f. \u0422\u0430\u043a\u0436\u0435 \u043e\u0431\u0440\u0430\u0449\u0430\u044e \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u0447\u0442\u043e \u044f \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u043e \u0432 json \u0441\u043e\u0437\u0434\u0430\u044e \u043c\u0430\u0441\u0441\u0438\u0432 \u0438\u0437 \u043e\u0434\u043d\u043e\u0433\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u0430, \u0447\u0442\u043e\u0431\u044b \u0434\u0430\u043b\u044c\u0448\u0435, \u043f\u043e\u043b\u0443\u0447\u0438\u0432 \u0432\u0441\u0435 \u0442\u0430\u043a\u0438\u0435 \u0444\u0430\u0439\u043b\u044b \u0441\u043e \u0432\u0441\u0435\u043c \u043c\u0430\u0448\u0438\u043d, \u0438\u0445 \u043f\u0440\u043e\u0449\u0435 \u0431\u044b\u043b\u043e \u0441\u043c\u0435\u0440\u0436\u0438\u0442\u044c \u0432 \u043e\u0434\u0438\u043d \u043e\u0431\u0449\u0438\u0439 \u043c\u0430\u0441\u0441\u0438\u0432 \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u0437\u0430\u043c\u0435\u0447\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u043a\u043e\u043d\u0441\u043e\u043b\u044c\u043d\u043e\u0439 \u0443\u0442\u0438\u043b\u0438\u0442\u044b <strong>jq<\/strong>.<\/p>\n<p>\u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043a\u0430\u043a \u0440\u0430\u0437 \u043f\u0435\u0440\u0435\u0439\u0434\u0435\u043c \u043a \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u0438\u044e \u044d\u0442\u043e\u0433\u043e \u043c\u0435\u0440\u0436\u0438\u043d\u0433\u0430 \u0432 \u0441\u043a\u0440\u0438\u043f\u0442\u0435 \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u0432\u0441\u0435\u0445 \u043f\u043b\u0435\u0439\u0431\u0443\u043a\u043e\u0432 <a href=\"https:\/\/gitlab.com\/paap.cloud\/kubos\/-\/blob\/feature\/dns\/docker\/entrypoint.sh\" rel=\"noopener noreferrer nofollow\">entrypoint.sh<\/a><\/p>\n<pre><code># https:\/\/e.printstacktrace.blog\/merging-json-files-recursively-in-the-command-line\/ jq -s '       def deepmerge(a;b):           reduce b[] as $item (a;               reduce ($item | keys_unsorted[]) as $key (.;                   $item[$key] as $val | ($val | type) as $type | .[$key] = if ($type == \"object\") then                             deepmerge({}; [if .[$key] == null then {} else .[$key] end, $val])                   elif ($type == \"array\") then                       (.[$key] + $val)                   else                       $val                   end               )           );       deepmerge({}; .)' openvpn\/inventory\/* > inventories.json;<\/code><\/pre>\n<p>\u042f \u0442\u0443\u0442 \u043d\u0435 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e \u0443\u043a\u0430\u0437\u0430\u043b \u0441\u0441\u044b\u043b\u043a\u0443 \u043d\u0430\u0434 \u0434\u0430\u043d\u043d\u044b\u043c \u043a\u043e\u0434\u043e\u043c, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u0434\u043b\u044f \u043c\u0435\u0440\u0436\u0430 json-\u043e\u0432 \u043c\u043d\u0435 \u043f\u0440\u0438\u0448\u043b\u043e\u0441\u044c \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0434\u0440\u0443\u0433\u0430-\u0438\u043d\u0442\u0435\u0440\u043d\u0435\u0442\u0430, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043f\u0438\u0441\u0430\u0442\u044c \u043f\u043e\u0434\u043e\u0431\u043d\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u043c\u043d\u0435 \u0441\u0430\u043c\u043e\u043c\u0443 \u043d\u0435 \u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c, \u0430 \u0437\u0430\u0434\u0430\u0447\u0430, \u043e\u0447\u0435\u0432\u0438\u0434\u043d\u043e, \u0443\u0436\u0435 \u0431\u044b\u043b\u0430 \u043a\u0435\u043c-\u0442\u043e \u0440\u0435\u0448\u0435\u043d\u0430, \u0447\u0442\u043e \u0438 \u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0434\u0438\u043b\u043e\u0441\u044c \u043f\u043e\u0441\u043b\u0435 \u043d\u0435\u0434\u043e\u043b\u0433\u043e\u0439 \u0433\u0443\u0433\u043b\u0435\u0436\u043a\u0438. \u0417\u0430 <a href=\"https:\/\/e.printstacktrace.blog\/merging-json-files-recursively-in-the-command-line\/\" rel=\"noopener noreferrer nofollow\">\u0434\u0430\u043d\u043d\u044b\u0439 \u043a\u043e\u0434<\/a> \u0432\u044b\u0440\u0430\u0436\u0430\u044e \u0431\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u043d\u043e\u0441\u0442\u044c \u0432 \u0430\u0434\u0440\u0435\u0441 <a href=\"https:\/\/e.printstacktrace.blog\/about\" rel=\"noopener noreferrer nofollow\"><u>Szymon Stepniak<\/u><\/a>. \u042f \u0432\u043d\u0435\u0441 \u0432 \u044d\u0442\u043e\u0442 \u043a\u043e\u0434 \u043b\u0438\u0448\u044c \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0438\u0435 \u043f\u043e\u0447\u0442\u0438 \u043a\u043e\u0441\u043c\u0435\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043a\u043e\u0434 \u0440\u0430\u0431\u043e\u0442\u0430\u043b \u043d\u0435 \u0441\u043e\u0432\u0441\u0435\u043c \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e.<\/p>\n<p>\u041f\u043e \u0438\u0442\u043e\u0433\u0443 \u043e\u0442\u0440\u0430\u0431\u043e\u0442\u043a\u0438 <strong>jq<\/strong> \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0437\u0434\u0430\u043d <strong>inventories.json<\/strong> \u0444\u0430\u0439\u043b \u0432\u0438\u0434\u0430<\/p>\n<pre><code>{   \"vpn_hosts\": [     {        \"name\": \"master\",        \"ip\": \"10.10.0.1\",        \"reverse_ip\": \"1.0.10.10\"     },     {        \"name\": \"worker1\",        \"ip\": \"10.10.0.6\",        \"reverse_ip\": \"6.0.10.10\"     },     {        \"name\": \"worker2\",        \"ip\": \"10.10.0.8\",        \"reverse_ip\": \"8.0.10.10\"     }    ] }<\/code><\/pre>\n<h2>\u041f\u043e\u0440\u0430 \u0443\u0436\u0435 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u044d\u0442\u043e\u0442 \u043f\u0430\u0441\u043f\u043e\u0440\u0442\u043d\u044b\u0439 \u0441\u0442\u043e\u043b<\/h2>\n<p>\u0414\u043b\u044f \u0440\u0430\u0437\u0432\u043e\u0440\u0430\u0447\u0438\u0432\u0430\u043d\u0438\u044f DNS-\u0441\u0435\u0440\u0432\u0435\u0440\u0430 BIND \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u0430\u043d\u0441\u0438\u0431\u043b <a href=\"https:\/\/gitlab.com\/paap.cloud\/kubos\/-\/blob\/feature\/dns\/docker\/ansible\/dns\/playbook.yml\" rel=\"noopener noreferrer nofollow\">playbook<\/a><\/p>\n<pre><code>--- - hosts: master   become: true   become_user: root   become_method: sudo   roles:     - dns-server  - hosts: all,!master   become: true   become_user: root   become_method: sudo   roles:     - dns-client<\/code><\/pre>\n<p>\u0412 \u0434\u0430\u043d\u043d\u043e\u043c \u043f\u043b\u0435\u0439\u0431\u0443\u043a\u0435 2 \u0440\u043e\u043b\u0438: \u0434\u043d\u0441-\u0441\u0435\u0440\u0432\u0435\u0440 \u0438 \u0434\u043d\u0441-\u043a\u043b\u0438\u0435\u043d\u0442. \u042d\u0442\u043e\u0442 \u043f\u043b\u0435\u0439\u0431\u0443\u043a \u043a\u0430\u043a \u0438 \u0440\u0430\u043d\u0435\u0435 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442\u0441\u044f \u0438\u0437 \u0434\u043e\u043a\u0435\u0440\u0430 \u0432 \u0441\u043a\u0440\u0438\u043f\u0442\u0435 <a href=\"https:\/\/gitlab.com\/paap.cloud\/kubos\/-\/blob\/feature\/dns\/docker\/entrypoint.sh\" rel=\"noopener noreferrer nofollow\">entrypoint.sh<\/a> \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0433\u043e \u0440\u044f\u0434\u0430 \u043a\u043e\u043c\u0430\u043d\u0434<\/p>\n<pre><code># \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0430 \u0444\u0430\u0439\u043b\u0430 \u0438\u043d\u0432\u0435\u043d\u0442\u0430\u0440\u0438\u0437\u0430\u0446\u0438\u0438 \u0445\u043e\u0441\u0442\u043e\u0432 \u0434\u043b\u044f \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 DNS {   echo \"[servers]\";   echo \"master ansible_host=host.docker.internal ansible_port=${MASTER_PORT} ansible_user=${USER_NAME} ansible_password=${USER_PASSWORD} ansible_sudo_pass=${USER_PASSWORD}\";   echo \"\";   echo \"[clients]\";   echo \"worker1 ansible_host=host.docker.internal ansible_port=${WORKER1_PORT} ansible_user=${USER_NAME} ansible_password=${USER_PASSWORD} ansible_sudo_pass=${USER_PASSWORD}\";   echo \"worker2 ansible_host=host.docker.internal ansible_port=${WORKER2_PORT} ansible_user=${USER_NAME} ansible_password=${USER_PASSWORD} ansible_sudo_pass=${USER_PASSWORD}\";   echo \"worker3 ansible_host=host.docker.internal ansible_port=${WORKER3_PORT} ansible_user=${USER_NAME} ansible_password=${USER_PASSWORD} ansible_sudo_pass=${USER_PASSWORD}\";   echo \"worker4 ansible_host=host.docker.internal ansible_port=${WORKER4_PORT} ansible_user=${USER_NAME} ansible_password=${USER_PASSWORD} ansible_sudo_pass=${USER_PASSWORD}\";       } > dns\/hosts;  # \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 DNS ansible-playbook -i dns\/hosts dns\/playbook.yml \\   --extra-vars \"dns_ip=$VIRTUAL_NETWORK_GATEWAY\" \\   --extra-vars \"@inventories.json\";<\/code><\/pre>\n<p>\u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u043a\u0430\u043a \u043e\u0431\u044b\u0447\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0435\u0442\u0441\u044f \u0444\u0430\u0439\u043b \u0438\u043d\u0432\u0435\u043d\u0442\u0430\u0440\u0438\u0437\u0430\u0446\u0438\u0438 \u0445\u043e\u0441\u0442\u043e\u0432 \u0434\u043b\u044f \u0430\u043d\u0441\u0438\u0431\u043b\u0430, \u0430 \u0434\u0430\u043b\u0435\u0435 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0441\u0430\u043c\u043e\u0435 \u0433\u043b\u0430\u0432\u043d\u043e\u0435: \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0430 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0432 \u043f\u043b\u0435\u0439\u0431\u0443\u043a. \u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u0447\u0442\u043e \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u043f\u0435\u0440\u0435\u0434\u0430\u044e\u0442\u0441\u044f \u043f\u0443\u0442\u0435\u043c \u0441\u043a\u0430\u0440\u043c\u043b\u0438\u0432\u0430\u043d\u0438\u044f <strong>inventories.json<\/strong> \u0444\u0430\u0439\u043b\u0430, \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0432\u044b\u0448\u0435 \u043f\u043e\u0441\u043b\u0435 \u043c\u0435\u0440\u0436\u0430.<\/p>\n<p>\u041a\u043e\u0433\u0434\u0430 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043f\u043b\u0435\u0439\u0431\u0443\u043a, \u0442\u043e \u043d\u0430 <a href=\"https:\/\/gitlab.com\/paap.cloud\/kubos\/-\/blob\/feature\/dns\/docker\/ansible\/dns\/roles\/dns-server\/tasks\/main.yml\" rel=\"noopener noreferrer nofollow\">\u0434\u043d\u0441-\u0441\u0435\u0440\u0432\u0435\u0440\u0435<\/a> \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0441\u0430\u043c bind, \u0430 \u043f\u043e\u0442\u043e\u043c \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u0435\u0433\u043e \u043a\u043e\u043d\u0444\u0438\u0433\u043e\u0432 \u043f\u0443\u0442\u0435\u043c \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f jinja2 \u0448\u0430\u0431\u043b\u043e\u043d\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0442\u0430\u043a \u043b\u044e\u0431\u044f\u0442 \u0430\u043d\u0441\u0438\u0431\u043b \u0434\u0435\u0432\u043e\u043f\u0441\u044b :). \u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u043f\u0440\u0438\u0432\u0435\u0434\u0443 \u044d\u0442\u0443 \u0447\u0430\u0441\u0442\u044c \u0441\u043a\u0440\u0438\u043f\u0442\u0430 \u0430\u043d\u0441\u0438\u0431\u043b\u0430, \u0430 \u043f\u043e\u0442\u043e\u043c \u0440\u0430\u0437\u0431\u0435\u0440\u0435\u043c \u0441\u0430\u043c\u0438 \u0448\u0430\u0431\u043b\u043e\u043d\u044b<\/p>\n<pre><code>- name: Install bind9   apt:     update_cache: yes     name: [ 'bind9', 'bind9utils', 'bind9-doc' ]     state: present   register: bind9_installed  - name: Replace named.conf.options   template:     src: named.conf.options.j2     dest: \/etc\/bind\/named.conf.options   when: bind9_installed.changed  - name: Replace named.conf.local   template:     src: named.conf.local.j2     dest: \/etc\/bind\/named.conf.local   when: bind9_installed.changed  - name: Ensure \/etc\/bind\/zones directory exists   file:     path: \/etc\/bind\/zones     state: directory  - name: Create db.host.name files   template:     src: db.host.name.j2     dest: \"\/etc\/bind\/zones\/db.{{ item.name }}\"   with_items: \"{{ vpn_hosts }}\"   when: bind9_installed.changed  - name: Create db.host.ip files   template:     src: db.host.ip.j2     dest: \"\/etc\/bind\/zones\/db.{{ item.ip }}\"   with_items: \"{{ vpn_hosts }}\"   when: bind9_installed.changed<\/code><\/pre>\n<p>\u0422\u0443\u0442 \u0432\u0441\u0435\u0433\u043e 4 \u043a\u043e\u043d\u0444\u0438\u0433\u0430, \u0445\u043e\u0442\u044f \u043d\u0435 \u0442\u0430\u043a\u043e\u0435 \u0443\u0436 \u0438 &#171;\u0432\u0441\u0435\u0433\u043e&#187; :). \u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u0441\u043e\u0437\u0434\u0430\u044e\u0442\u0441\u044f \u043e\u043f\u0446\u0438\u0438 <a href=\"https:\/\/gitlab.com\/paap.cloud\/kubos\/-\/blob\/feature\/dns\/docker\/ansible\/dns\/roles\/dns-server\/templates\/named.conf.options.j2\" rel=\"noopener noreferrer nofollow\"><strong>named.conf.options<\/strong><\/a><\/p>\n<pre><code>acl trusted_clients { {% for vpn_host in vpn_hosts %}     {{ vpn_host.ip }}; # {{ vpn_host.name }} {% endfor %} };  options { directory \"\/var\/cache\/bind\";  allow-query { trusted_clients; };  forwarders { 8.8.8.8; 8.8.4.4; };  \/\/======================================================================== \/\/ If BIND logs error messages about the root key being expired, \/\/ you will need to update your keys.  See https:\/\/www.isc.org\/bind-keys \/\/======================================================================== dnssec-validation auto;  listen-on-v6 { any; }; };<\/code><\/pre>\n<p>\u0422\u0443\u0442 \u0438\u0437 \u0432\u0430\u0436\u043d\u043e\u0433\u043e, \u044d\u0442\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 ip \u0430\u0434\u0440\u0435\u0441\u043e\u0432 \u0442\u0435\u0445 \u043c\u0430\u0448\u0438\u043d, \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f DNS-\u0441\u0435\u0440\u0432\u0435\u0440\u043e\u043c (<strong>trusted_clients<\/strong>). \u0412 \u0431\u043b\u043e\u043a\u0435 <strong>acl<\/strong> \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0448\u0430\u0431\u043b\u043e\u043d\u0430 \u0438\u0434\u0435\u0442 \u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0435 \u0432\u0441\u0435\u0445 ip-\u0430\u0434\u0440\u0435\u0441\u043e\u0432 \u0432\u0441\u0435\u0445 \u043c\u0430\u0448\u0438\u043d \u0432 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0439 \u0441\u0435\u0442\u0438. \u0412 \u0431\u043b\u043e\u043a\u0435 <strong>options<\/strong> \u0434\u0430\u043d\u043d\u044b\u0439 acl \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f, \u043a\u0430\u043a \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u043d\u044b\u0439, \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u0434\u0438\u0440\u0435\u043a\u0442\u0438\u0432\u044b <strong>allow-query<\/strong>. \u0422\u0430\u043a\u0436\u0435 \u0432 \u0431\u043b\u043e\u043a\u0435 <strong>options<\/strong> \u0432\u0430\u0436\u043d\u043e \u0437\u0430\u0434\u0430\u0442\u044c \u0440\u0430\u0437\u0434\u0435\u043b <strong>forwarders<\/strong>, \u0447\u0442\u043e\u0431\u044b \u0434\u043b\u044f \u0438\u043c\u0435\u043d, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0435 \u043e\u0442\u043d\u043e\u0441\u044f\u0442\u0441\u044f \u043a \u043d\u0430\u0448\u0435\u0439 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0439 \u0441\u0435\u0442\u0438, \u043f\u043e\u0438\u0441\u043a ip-\u0430\u0434\u0440\u0435\u0441\u043e\u0432 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u043b\u0441\u044f \u043d\u0430 DNS-\u0441\u0435\u0440\u0432\u0435\u0440\u0430\u0445 google. \u0412\u0441\u0435 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u043e\u0435 \u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043e \u0431\u0435\u0437 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439 \u0432 \u0442\u043e\u043c \u0432\u0438\u0434\u0435, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0434\u0430\u043d\u043d\u044b\u0439 \u0444\u0430\u0439\u043b \u043f\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441 bind9.<\/p>\n<p>\u0414\u0430\u043b\u0435\u0435 <\/p>\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-332640","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/332640","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=332640"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/332640\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=332640"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=332640"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=332640"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}