{"id":351053,"date":"2023-07-31T21:00:48","date_gmt":"2023-07-31T21:00:48","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=351053"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=351053","title":{"rendered":"<span>\u0410\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0430\u0446\u0438\u044f \u0440\u0430\u0437\u0432\u0435\u0440\u0442\u044b\u0432\u0430\u043d\u0438\u044f \u0441\u0442\u0435\u043d\u0434\u0430 Kubernetes<\/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>\u041c\u0435\u043d\u044f \u0437\u0430\u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043e\u0432\u0430\u043b\u0430 \u0442\u0435\u043c\u0430 Kubernetes, \u0438 \u044f \u0440\u0435\u0448\u0438\u043b \u043e\u0441\u0432\u043e\u0438\u0442\u044c \u0435\u0433\u043e. \u041d\u0430 \u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e\u043c \u044d\u0442\u0430\u043f\u0435 \u0432\u0441\u0435 \u0448\u043b\u043e \u0445\u043e\u0440\u043e\u0448\u043e, \u043f\u043e\u043a\u0430 \u044f \u0438\u0437\u0443\u0447\u0430\u043b \u0442\u0435\u043e\u0440\u0438\u044e.<\/p>\n<p>\u041e\u0434\u043d\u0430\u043a\u043e \u043a\u0430\u043a \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u0435\u043b\u043e \u0434\u043e\u0448\u043b\u043e \u0434\u043e \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0438 \u0432\u043d\u0435\u0437\u0430\u043f\u043d\u043e \u0432\u044b\u044f\u0441\u043d\u0438\u043b\u043e\u0441\u044c \u0447\u0442\u043e \u043f\u043e \u043a\u0430\u043a\u0438\u043c \u0442\u043e \u043f\u0440\u0438\u0447\u0438\u043d\u0430\u043c \u0441\u0430\u043c\u043e\u0435 \u0431\u044b\u0441\u0442\u0440\u043e\u0435 \u0438 \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0451\u043d\u043d\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 minicube \u043f\u0440\u043e\u0441\u0442\u043e \u043e\u0442\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0440\u0430\u0437\u0432\u043e\u0440\u0430\u0447\u0438\u0432\u0430\u0442\u044c\u0441\u044f \u043d\u0430 \u043c\u043e\u0435\u0439 Fedora. \u0420\u0430\u0437\u0432\u043e\u0440\u0430\u0447\u0438\u0432\u0430\u043d\u0438\u0435 \u043f\u0440\u043e\u0441\u0442\u043e \u0437\u0430\u0432\u0438\u0441\u0430\u043b\u043e \u043d\u0430 \u043e\u0434\u043d\u043e\u043c \u0438\u0437 \u044d\u0442\u0430\u043f\u043e\u0432.\u00a0\u041f\u0440\u0438\u0447\u0438\u043d\u0430\u00a0\u043f\u043e\u0434\u043e\u0437\u0440\u0435\u0432\u0430\u044e \u0431\u044b\u043b\u0430\u00a0\u0432 \u043d\u0435 \u043e\u0442\u043a\u043b\u044e\u0447\u0435\u043d\u043d\u043e\u043c \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e swap \u0440\u0430\u0437\u0434\u0435\u043b\u0435, \u043d\u043e \u043d\u0430 \u0442\u043e\u0442 \u043c\u043e\u043c\u0435\u043d\u0442 \u044f \u043d\u0435 \u0434\u043e\u0434\u0443\u043c\u0430\u043b. <\/p>\n<p>\u041f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0432 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u0432 \u0441 \u0440\u0430\u0437\u043d\u044b\u043c\u0438 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u043c\u0438 \u043c\u0430\u0448\u0438\u043d\u0430\u043c\u0438, \u044f \u0440\u0435\u0448\u0438\u043b \u0447\u0442\u043e \u0440\u0430\u0437 \u043d\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 minicube,\u00a0\u0437\u043d\u0430\u0447\u0438\u0442 \u043d\u0430\u0434\u043e \u0440\u0430\u0437\u0432\u0435\u0440\u043d\u0443\u0442\u044c \u0431\u043e\u043b\u0435\u0435 \u043a\u043e\u043c\u043f\u043b\u0435\u043a\u0441\u043d\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435.\u00a0\u041f\u043e\u0434\u0443\u043c\u0430\u043b\u00a0\u0438 \u043f\u043e\u043b\u0435\u0437 \u0432 \u0438\u043d\u0442\u0435\u0440\u043d\u0435\u0442. \u041f\u043e\u0441\u043b\u0435 \u043f\u0440\u043e\u0447\u0442\u0435\u043d\u0438\u044f \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u0441\u0442\u0430\u0442\u0435\u0439 \u043d\u0430 \u043d\u0430\u0448\u0435\u043c \u0440\u0435\u0441\u0443\u0440\u0441\u0435 \u044f \u0440\u0435\u0448\u0438\u043b \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c\u0441\u044f \u043d\u0430 \u044d\u0442\u043e\u0439: <\/p>\n<p><a class=\"mention\" href=\"\/users\/imbasoft\">@imbasoft<\/a>   &#171;<a href=\"https:\/\/habr.com\/ru\/articles\/725640\/\" rel=\"noopener noreferrer nofollow\">\u0413\u0430\u0439\u0434 \u0434\u043b\u044f \u043d\u043e\u0432\u0438\u0447\u043a\u043e\u0432 \u043f\u043e \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0435 Kubernetes<\/a>&#187;\u00a0  <\/p>\n<p>\u0412 \u043d\u0435\u0439 \u0431\u044b\u043b\u043e \u0432\u0441\u0451 \u0440\u0430\u0437\u043b\u043e\u0436\u0435\u043d\u043e \u043f\u043e \u043f\u043e\u043b\u043e\u0447\u043a\u0430\u043c, \u0432\u0441\u0435 \u0448\u0430\u0433\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u043b\u0438\u0441\u044c \u043b\u0435\u0433\u043a\u043e \u0438 \u043d\u0435\u043f\u0440\u0438\u043d\u0443\u0436\u0434\u0451\u043d\u043d\u043e.\u00a0\u0412\u00a0\u043a\u043e\u043d\u0446\u0435 \u043f\u043e\u043b\u0443\u0447\u0430\u043b\u0441\u044f \u0437\u0430\u043c\u0435\u0447\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u0441\u0442\u0435\u043d\u0434 \u0434\u043b\u044f \u0442\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u043e\u043a.\u00a0\u041f\u0440\u0438\u0447\u0435\u043c\u00a0\u0441\u0442\u0435\u043d\u0434 \u0432\u0430\u0440\u0438\u0430\u0442\u0438\u0432\u043d\u044b\u0439, \u0441 \u0440\u0430\u0437\u043d\u044b\u043c\u0438 \u0434\u0432\u0438\u0436\u043a\u0430\u043c\u0438 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0438\u0437\u0430\u0446\u0438\u0438, \u0438 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0430\u043c\u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u00a0\u043a\u0430\u043a \u0430\u043d\u0430\u043b\u043e\u0433 \u043c\u0438\u043d\u0438\u043a\u0443\u0431\u0430, \u0442\u0430\u043a \u0438\u00a0\u043f\u044f\u0442\u0438 \u0445\u043e\u0441\u0442\u043e\u0432\u044b\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u0441 \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u044e\u0449\u0438\u043c\u0438 \u0438 \u0440\u0430\u0431\u043e\u0447\u0438\u043c\u0438 \u043d\u043e\u0434\u0430\u043c\u0438.<\/p>\n<p>\u041d\u043e \u0441\u043c\u0443\u0449\u0430\u043b \u043c\u0435\u043d\u044f \u043e\u0434\u0438\u043d \u043c\u043e\u043c\u0435\u043d\u0442, \u0432 \u0441\u0442\u0430\u0442\u044c\u0435 \u0431\u044b\u043b\u043e \u043e\u043f\u0438\u0441\u0430\u043d\u043e \u0440\u0430\u0437\u0432\u0451\u0440\u0442\u044b\u0432\u0430\u043d\u0438\u0435 \u0441\u043e \u043c\u043d\u043e\u0433\u0438\u043c\u0438\u00a0\u0441\u043d\u0430\u043f\u0448\u043e\u0442\u0430\u043c\u0438, \u0447\u0442\u043e\u0431\u044b \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0432\u0435\u0440\u043d\u0443\u0442\u044c\u0441\u044f \u0438 \u043f\u0435\u0440\u0435\u0438\u0433\u0440\u0430\u0442\u044c\u00a0\u043f\u043e-\u043d\u043e\u0432\u043e\u043c\u0443.<br \/>\u041a\u0430\u0436\u0434\u044b\u0439\u00a0\u0440\u0430\u0437 \u043e\u0442\u043a\u0430\u0442\u044b\u0432\u0430\u0442\u044c\u0441\u044f \u043f\u043e \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u043c \u043c\u0430\u0448\u0438\u043d\u0430\u043c \u043c\u043d\u0435 \u043d\u0435 \u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c.\u00a0\u0410\u00a0\u0440\u0430\u0437\u0432\u0435\u0440\u043d\u0443\u0442\u044c \u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c.<br \/>\u0420\u0435\u0448\u0435\u043d\u0438\u0435\u00a0\u043f\u0440\u0438\u0448\u043b\u043e \u0431\u044b\u0441\u0442\u0440\u043e. Ansible.\u00a0\u041c\u043e\u0436\u043d\u043e\u00a0\u0440\u0430\u0441\u043a\u0430\u0442\u044b\u0432\u0430\u0442\u044c\u0441\u044f \u0438\u00a0\u043f\u0435\u0440\u0435\u0440\u0430\u0441\u043a\u0430\u0442\u044b\u0432\u0430\u0442\u044c\u0441\u044f\u00a0\u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u00a0\u0431\u044b\u0441\u0442\u0440\u043e.\u00a0\u0412\u00a0\u043b\u044e\u0431\u043e\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u043c\u043e\u0436\u043d\u043e \u0443\u0434\u0430\u043b\u0438\u0442\u044c \u0441\u0442\u0435\u043d\u0434 \u0438 \u043d\u0430\u0447\u0430\u0442\u044c \u0437\u0430\u043d\u043e\u0432\u043e.  <\/p>\n<p>\u0414\u043e \u044d\u0442\u043e\u0433\u043e \u043d\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u043b \u0441 ansible, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u044d\u0442\u043e \u0442\u0430\u043a \u0436\u0435 \u043f\u043e\u043a\u0430\u0437\u0430\u043b\u043e\u0441\u044c \u043c\u043d\u0435 \u0432\u043f\u043e\u043b\u043d\u0435 \u043d\u0435\u043f\u043b\u043e\u0445\u043e\u0439 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u043e\u0439.<\/p>\n<p>\u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u043d\u0435 \u0441\u0430\u043c\u043e\u0435 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u0435, \u043d\u0430\u0434\u0435\u044e\u0441\u044c \u043b\u044e\u0434\u0438 \u0432\u00a0\u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u044f\u0445\u00a0\u043c\u0435\u043d\u044f \u043f\u043e\u043f\u0440\u0430\u0432\u044f\u0442 \u0438\u043b\u0438 \u043f\u043e\u0434\u0441\u043a\u0430\u0436\u0443\u0442 \u0431\u043e\u043b\u0435\u0435 \u0443\u0434\u0430\u0447\u043d\u044b\u0435 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u044b \u0440\u0435\u0448\u0435\u043d\u0438\u0439.\u00a0\u041d\u043e\u00a0\u043f\u043e\u043a\u0430 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u044e \u043d\u0430 \u0441\u0443\u0434 \u0442\u043e \u0447\u0442\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c \u0432 \u0438\u0442\u043e\u0433\u0435.<br \/>\u042f \u0437\u043d\u0430\u044e \u0447\u0442\u043e \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0442 \u0433\u043e\u0442\u043e\u0432\u044b\u0435 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u044b \u0442\u0438\u043f\u0430 kubespray, \u043d\u043e \u0442\u0443\u0442 \u0431\u043e\u043b\u044c\u0448\u0435 \u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u043f\u043e\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0438\u043c\u0435\u043d\u043d\u043e \u0441 ansible, \u0442\u0430\u043a \u0447\u0442\u043e \u044f \u0440\u0435\u0448\u0438\u043b \u043d\u0435 \u0443\u043f\u0443\u0441\u043a\u0430\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438.\u00a0\u0412\u00a0\u043b\u044e\u0431\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043d\u0435 \u043e\u0448\u0438\u0431\u0430\u0435\u0442\u0441\u044f \u0442\u043e\u0442, \u043a\u0442\u043e \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u0434\u0435\u043b\u0430\u0435\u0442, \u0442\u0430\u043a \u0447\u0442\u043e \u043b\u0443\u0447\u0448\u0435 \u044f\u00a0\u0434\u043e\u043f\u0443\u0449\u0443\u00a0\u0434\u0435\u0441\u044f\u0442\u043e\u043a \u043e\u0448\u0438\u0431\u043e\u043a \u043d\u043e\u0432\u0438\u0447\u043a\u0430, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0434\u0430\u0436\u0435 \u0443\u043a\u0430\u0436\u0443\u0442, \u0447\u0435\u043c \u0432\u043e\u043e\u0431\u0449\u0435 \u043d\u0435 \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u044e.<\/p>\n<p>\u0418\u0442\u0430\u043a, \u0441 \u0447\u0435\u0433\u043e \u043d\u0430\u0447\u0430\u0442\u044c?<\/p>\n<p>\u0412\u043e-\u043f\u0435\u0440\u0432\u044b\u0445\u00a0\u043d\u0430\u0434\u043e \u0431\u044b\u043b\u043e \u0432\u044b\u0431\u0440\u0430\u0442\u044c\u00a0\u0432\u0438\u0440\u0442\u0443\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e. KVM \u043f\u043e\u043a\u0430\u0437\u0430\u043b\u0441\u044f \u043c\u043d\u0435 \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u044b\u043c \u0440\u0435\u0448\u0435\u043d\u0438\u0435\u043c, \u043e\u043d \u043c\u043e\u0436\u043d\u043e \u0441\u043a\u0430\u0437\u0430\u0442\u044c \u0440\u043e\u0434\u043d\u043e\u0439 \u0434\u043b\u044f linux, \u0435\u0441\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0440\u0443\u043b\u0438\u0442\u044c \u0438\u0437 \u043a\u043e\u043c\u0430\u043d\u0434\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0438.<\/p>\n<p>\u042f \u043d\u0435 \u0431\u0443\u0434\u0443 \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c \u043a\u0430\u043a \u043d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0442\u044c KVM \u043d\u0430 \u043c\u0430\u0448\u0438\u043d\u0435 \u0438 \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0442\u044c ansible, \u0441\u0442\u0430\u0442\u044c\u044f \u043d\u0435 \u043e\u0431 \u044d\u0442\u043e\u043c.\u00a0\u041f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0438\u043c\u00a0\u0447\u0442\u043e \u0443 \u0432\u0430\u0441 \u0443\u0436\u0435 \u0432\u0441\u0451 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043e.<\/p>\n<p>\u041a\u0430\u043a \u044f \u0443\u0436\u0435 \u043d\u0430\u043f\u0438\u0441\u0430\u043b, \u043e\u043f\u044b\u0442\u0430 \u0441 ansible \u0443 \u043c\u0435\u043d\u044f \u043d\u0435 \u043c\u043d\u043e\u0433\u043e, \u043d\u043e \u0434\u0430\u0436\u0435 \u0441 \u043d\u0438\u043c \u044f \u043f\u043e\u043d\u0438\u043c\u0430\u044e \u0447\u0442\u043e \u043f\u0438\u0441\u0430\u0442\u044c \u043e\u0434\u043d\u0443 \u0431\u043e\u043b\u044c\u0448\u0443\u044e \u043f\u0440\u043e\u0441\u0442\u044b\u043d\u044e \u043a\u043e\u0434\u0430 \u043d\u0435 \u043e\u0441\u043e\u0431\u043e \u0443\u0434\u043e\u0431\u043d\u043e, \u0430 \u043e\u0442\u043b\u0430\u0436\u0438\u0432\u0430\u0442\u044c \u0438 \u0442\u043e\u0433\u043e \u0445\u0443\u0436\u0435.\u00a0\u0411\u044b\u043b\u043e\u00a0\u0440\u0435\u0448\u0435\u043d\u043e \u0440\u0430\u0437\u0431\u0438\u0442\u044c \u0435\u0451 \u043d\u0430 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u043e\u0441\u0442\u044b\u043d\u0435\u0439 \u043f\u043e\u043c\u0435\u043d\u044c\u0448\u0435 \u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u043e\u043c \u0440\u043e\u043b\u0435\u0439.<\/p>\n<p>\u0412\u00a0\u0446\u0435\u043b\u043e\u043c \u0435\u0441\u043b\u0438 \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b\u044c\u043d\u0443\u044e \u0441\u0442\u0430\u0442\u044c\u044e \u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0432\u044b\u0434\u0435\u043b\u0438\u0442\u044c 3 \u044d\u0442\u0430\u043f\u0430:<br \/>1) \u041f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0430 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0445 \u043c\u0430\u0448\u0438\u043d<br \/>2) \u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u0434\u0432\u0438\u0436\u043a\u0430 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0438\u0437\u0430\u0446\u0438\u0438<br \/>3) \u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 all_in_one\/ha_cluster<\/p>\n<p>\u0418\u0441\u0445\u043e\u0434\u044f \u0438\u0437 \u044d\u0442\u043e\u0433\u043e \u0431\u0443\u0434\u0435\u043c \u0433\u043e\u0442\u043e\u0432\u0438\u0442\u044c 4 \u0440\u043e\u043b\u0438 \u0441\u043e \u0441\u0432\u043e\u0438\u043c\u0438 \u0442\u0430\u0441\u043a\u0430\u043c\u0438.<br \/>&#8212; vm_provision<br \/>&#8212; driver_provision<br \/>&#8212; k8s_all_in_one<br \/>&#8212; k8s_ha_cluster <\/p>\n<p>\u0421\u043e\u0437\u0434\u0430\u0451\u043c\u00a0\u043a\u0430\u0442\u0430\u043b\u043e\u0433, \u0443 \u043c\u0435\u043d\u044f \u043e\u043d \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f kvmlab, \u0438 \u0432 \u043d\u0435\u043c \u0444\u0430\u0439\u043b setup_k8s.yaml<\/p>\n<p>\u042d\u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u0433\u043b\u0430\u0432\u043d\u044b\u0439\u00a0playbook, \u0438\u0437 \u043d\u0435\u0433\u043e \u0431\u0443\u0434\u0443\u0442 \u043f\u043e\u0434\u0442\u044f\u0433\u0438\u0432\u0430\u0442\u044c\u0441\u044f \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0435 \u043f\u043e \u043c\u0435\u0440\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438. T\u0430\u043a \u0436\u0435 \u043d\u0430\u043c \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f inventory \u0438 \u0444\u0430\u0439\u043b \u0441 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u043c\u0438 \u043a\u043e\u0442\u043e\u0440\u044b\u043c\u0438 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u0440\u0430\u0437\u0432\u0451\u0440\u0442\u044b\u0432\u0430\u043d\u0438\u0435\u043c.  \u041d\u0443 \u0438 \u043a\u043e\u043d\u0435\u0447\u043d\u043e \u0436\u0435 \u0440\u043e\u043b\u0438. <\/p>\n<p>\u0412 \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u043c, \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0440\u043e\u043b\u0435\u0439.<\/p>\n<pre><code class=\"bash\">ansible-galaxy role init vm_provision ansible-galaxy role init driver_provision ansible-galaxy role init k8s_ha_cluster ansible-galaxy role init k8s_all_in_one<\/code><\/pre>\n<p>\u0424\u0430\u0439\u043b inventory \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442 \u043d\u0430\u0448\u0438 ansible_host \u0434\u043b\u044f \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f:<\/p>\n<pre><code class=\"yaml\">all:   children:     management:       hosts:         node1:           ansible_host: 172.30.0.201         node2:           ansible_host: 172.30.0.202         node3:           ansible_host: 172.30.0.203     workers:       hosts:         node4:           ansible_host: 172.30.0.204         node5:           ansible_host: 172.30.0.205<\/code><\/pre>\n<p>my_vars.yml \u043a\u0430\u043a \u0432\u0438\u0434\u043d\u043e \u0438\u0437 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044f \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435, \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0440\u0430\u0437\u0432\u0435\u0440\u0442\u044b\u0432\u0430\u043d\u0438\u044f, \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0445 \u043c\u0430\u0448\u0438\u043d, \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0438 \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f iso \u0438 \u0434\u0438\u0441\u043a\u043e\u0432 VM:<\/p>\n<pre><code class=\"yaml\">variant: all-in-one #[all-in-one, ha-cluster] engine: cri-o #[container-d, cri-o, docker] libvirt_pool_dir: \"\/home\/alex\/myStorage\/storage_for_VMss\" libvirt_pool_images: \"\/home\/alex\/myStorage\/iso_imagess\" vm_net: k8s_net ssh_key: \"\/home\/alex\/.ssh\/id_rsa.pub\" ansible_ssh_common_args: \"-o StrictHostKeyChecking=no\" version: \"1.26\" os: \"Debian_11\" vm_info:   vm_names:     - name: node1       memory: 2048       cpu: 2       ipaddr: 172.30.0.201     - name: node2       memory: 2048       cpu: 2       ipaddr: 172.30.0.202     - name: node3       memory: 2048       cpu: 2       ipaddr: 172.30.0.203     - name: node4       memory: 3072       cpu: 4       ipaddr: 172.30.0.204     - name: node5       memory: 3072       cpu: 4       ipaddr: 172.30.0.205<\/code><\/pre>\n<p>\u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u0447\u0443\u0442\u044c \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435:<\/p>\n<p>variant &#8212; \u044d\u0442\u043e \u043d\u0430\u0448 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u0431\u0443\u0434\u0435\u043c \u043b\u0438 \u043c\u044b \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0442\u044c \u043a\u043b\u0430\u0441\u0442\u0435\u0440 \u0438\u043b\u0438 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0438\u043c\u0441\u044f \u043e\u0434\u043d\u043e\u0439 \u043c\u0430\u0448\u0438\u043d\u043e\u0439 \u0438 \u0441\u0434\u0435\u043b\u0430\u0435\u043c \u0430\u043d\u0430\u043b\u043e\u0433 minikube.<\/p>\n<p>engine &#8212; \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0434\u0432\u0438\u0436\u043e\u043a \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0438\u0437\u0430\u0446\u0438\u0438<\/p>\n<p>libvirt_pool_dir \u0438 libvirt_pool_images \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0438 \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0434\u0438\u0441\u043a\u043e\u0432 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0445 \u043c\u0430\u0448\u0438\u043d \u0438 \u0441\u043a\u0430\u0447\u0430\u043d\u043d\u044b\u0445 \u043e\u0431\u0440\u0430\u0437\u043e\u0432 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e.<\/p>\n<p>vm_net &#8212; \u0438\u043c\u044f \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0435\u043c\u043e\u0439 \u0441\u0435\u0442\u0438 \u0434\u043b\u044f \u0432\u0430\u0448\u0438\u0445 \u043c\u0430\u0448\u0438\u043d.<\/p>\n<p>ssh_key &#8212; \u0432\u0430\u0448 \u043f\u0443\u0431\u043b\u0438\u0447\u043d\u044b\u0439 \u043a\u043b\u044e\u0447, \u043f\u043e\u0434\u043a\u0438\u0434\u044b\u0432\u0430\u0435\u0442\u0441\u044f   \u043d\u0430 \u0412\u041c \u0432 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0438 \u0438 \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0438\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u044e\u0442\u0441\u044f \u0432\u0430\u0448\u0438\u043c \u043b\u043e\u0433\u0438\u043d\u043e\u043c \u0438\u0437 \u043f\u043e\u0434 root.<\/p>\n<p>ansible_ssh_common_args &#8212; \u043e\u0442\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u0445\u0435\u0448\u0430 \u043a\u043b\u044e\u0447\u0430.<\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0432\u0435\u0440\u043d\u0435\u043c\u0441\u044f \u043a setup_k8s.yaml:<br \/> \u041f\u0435\u0440\u0432\u044b\u0439 play \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u043d\u0430 localhost, \u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u043f\u043e\u0432\u044b\u0448\u0435\u043d\u043d\u044b\u0445 \u043f\u0440\u0430\u0432 \u0438 \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0438\u0437 6 task:<\/p>\n<ol>\n<li>\n<p>\u041f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0430 \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u044f &#8212; \u043d\u0430 \u044d\u0442\u043e\u043c \u044d\u0442\u0430\u043f\u0435 \u043c\u044b \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u043f\u0430\u043a\u0435\u0442\u044b \u0434\u043b\u044f \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f libvirt<\/p>\n<\/li>\n<li>\n<p>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u0441\u0435\u0442\u0438 &#8212; \u043c\u0430\u0448\u0438\u043d\u044b \u0431\u0443\u0434\u0443\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u0432\u043e\u044e \u0441\u0435\u0442\u044c, \u043d\u043e \u0435\u0451 \u043d\u0430\u0434\u043e \u043f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c.<\/p>\n<\/li>\n<li>\n<p>\u041f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0430 \u0448\u0430\u0431\u043b\u043e\u043d\u0430 \u0434\u043b\u044f \u0412\u041c &#8212; \u0432\u0441\u0435 \u043c\u0430\u0448\u0438\u043d\u044b \u0431\u0443\u0434\u0443\u0442 \u0441 \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u043e\u0439 OS, \u0432 \u043c\u043e\u0451\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0441 debian 11, \u0443 \u043d\u0438\u0445 \u0431\u0443\u0434\u0435\u0442 \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b\u0439 \u043d\u0430\u0431\u043e\u0440 \u043d\u0430\u0447\u0430\u043b\u044c\u043d\u044b\u0445 \u043f\u0430\u043a\u0435\u0442\u043e\u0432. \u041a\u0430\u0436\u0434\u044b\u0439 \u0440\u0430\u0437 \u0440\u0430\u0437\u0432\u043e\u0440\u0430\u0447\u0438\u0432\u0430\u0442\u044c \u0441 \u043d\u0443\u043b\u044f \u0434\u043e\u043b\u0433\u043e, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043d\u0430\u0434\u043e \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u0438\u0442\u044c \u0448\u0430\u0431\u043b\u043e\u043d VM \u0438 \u043f\u0435\u0440\u0435\u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0435\u0433\u043e \u043f\u0440\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438.<\/p>\n<\/li>\n<li>\n<p>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0412\u041c \u043d\u043e\u0434 \u0438\u0437 \u0448\u0430\u0431\u043b\u043e\u043d\u043d\u043e\u0433\u043e \u043e\u0431\u0440\u0430\u0437\u0430. \u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043d\u0443\u0436\u043d\u043e\u0433\u043e \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 VM \u0434\u043b\u044f \u0440\u0430\u0437\u0432\u0435\u0440\u0442\u044b\u0432\u0430\u043d\u0438\u044f.<\/p>\n<\/li>\n<li>\n<p>\u041f\u0435\u0440\u0435\u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0430 \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u0445 \u043c\u0430\u0448\u0438\u043d<\/p>\n<\/li>\n<li>\n<p>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0441\u043d\u0430\u043f\u0448\u043e\u0442\u0430. \u042d\u0442\u0430 \u0442\u0430\u0441\u043a\u0430 \u043e\u043f\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u0430, \u043f\u0440\u0438 \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u043c \u0440\u0430\u0437\u0432\u0451\u0440\u0442\u044b\u0432\u0430\u043d\u0438\u0438 \u0447\u0430\u0441\u0442\u043e \u0441\u043b\u0443\u0447\u0430\u043b\u0438\u0441\u044c \u043e\u0448\u0438\u0431\u043a\u0438 \u0438 \u043d\u0430\u0434\u043e \u0431\u044b\u043b\u043e \u043d\u0430\u0447\u0438\u043d\u0430\u0442\u044c \u0441\u043d\u0430\u0447\u0430\u043b\u0430, \u0441\u043d\u0430\u043f\u0448\u043e\u0442 \u0440\u0435\u0448\u0430\u043b \u044d\u0442\u0443 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443. \u0432 \u0446\u0435\u043b\u043e\u043c \u0441\u0435\u0439\u0447\u0430\u0441 \u043e\u043d \u0443\u0436\u0435 \u043d\u0435 \u043d\u0443\u0436\u0435\u043d, \u043d\u043e \u044f \u043e\u0441\u0442\u0430\u0432\u0438\u043b. \u0414\u043b\u044f \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0438 \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0440\u043e\u043b\u044c vm_provision \u043e \u043d\u0435\u0439 \u0447\u0443\u0442\u044c \u043f\u043e\u0437\u0436\u0435, \u0430 \u0441\u0435\u0439\u0447\u0430\u0441 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430 \u0442\u043e \u0447\u0442\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c: <\/p>\n<\/li>\n<\/ol>\n<p>kvmlab\/setup_k8s.yaml:<\/p>\n<pre><code class=\"yaml\">--- - name: \u041f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0430 \u0412\u041c \u043a \u0440\u0430\u0437\u0432\u0451\u0440\u0442\u044b\u0432\u0430\u043d\u0438\u044e k8s   hosts: localhost   gather_facts: yes   become: yes   tasks:     - name: \u041f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0430 \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u044f       package:         name:           - libguestfs-tools           - python3-libvirt         state: present      - name: \u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u0441\u0435\u0442\u0438       include_role:         name: vm_provision         tasks_from: create_network.yml      - name: \u041f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0430 \u0448\u0430\u0431\u043b\u043e\u043d\u0430 \u0434\u043b\u044f \u0412\u041c       include_role:         name: vm_provision         tasks_from: prepare_images_for_cluster.yml      - name: \u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0412\u041c \u043d\u043e\u0434 \u0438\u0437 \u0448\u0430\u0431\u043b\u043e\u043d\u043d\u043e\u0433\u043e \u043e\u0431\u0440\u0430\u0437\u0430.       include_role:         name: vm_provision         tasks_from: create_nodes.yml       vars:         vm_name: \"{{ item.name }}\"         vm_vcpus: \"{{ item.cpu }}\"         vm_ram_mb: \"{{ item.memory }}\"         ipaddr: \"{{ item.ipaddr }}\"       with_items: \"{{ vm_info.vm_names }}\"       when: variant == 'ha-cluster' or (variant == 'all-in-one' and item.name == 'node1')      - name: \u041e\u0436\u0438\u0434\u0430\u043d\u0438\u0435 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u0432\u0441\u0435\u0445 \u0412\u041c \u0438\u0437 \u0441\u043f\u0438\u0441\u043a\u0430       wait_for:         host: \"{{ hostvars[item].ansible_host }}\"         port: 22         timeout: 300         state: started       when: variant == 'ha-cluster' or item == 'node1'       with_items: \"{{ groups['all'] }}\"      - name: \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u0441\u043d\u0438\u043c\u043e\u043a host_provision       include_role:         name: vm_provision         tasks_from: create_snapshot.yml       vars:         vm_name: \"{{ item.name }}\"         snapshot_name: \"host_provision\"         snapshot_description: \"\u041d\u043e\u0434\u0430 \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043b\u0435\u043d\u0430 \u043a \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0435 \u0434\u0432\u0438\u0436\u043a\u0430\"       when: variant == 'ha-cluster' or item.name == 'node1'       with_items: \"{{ vm_info.vm_names }}\"<\/code><\/pre>\n<p>\u0412\u0438\u0437\u0443\u0430\u043b\u044c\u043d\u043e \u043d\u0435 \u043c\u043d\u043e\u0433\u043e, \u0434\u0430\u0432\u0430\u0439 \u0440\u0430\u0437\u0431\u0435\u0440\u0451\u043c \u0447\u0442\u043e \u0441\u043a\u0440\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043f\u043e\u0434 include_role. <\/p>\n<p>\u0410 \u043f\u043e\u0434 \u0440\u043e\u043b\u044c\u044e \u0443 \u043d\u0430\u0441 \u0441\u043a\u0440\u044b\u0432\u0430\u0435\u0442\u0441\u044f:<\/p>\n<p>\u0414\u0435\u0444\u043e\u043b\u0442\u043d\u044b\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u043d\u0430 \u0441\u043b\u0443\u0447\u0430\u0439 \u0435\u0441\u043b\u0438 \u043a\u0430\u043a\u0438\u0435 \u0442\u043e \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u043d\u0435 \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u044b, \u043f\u043e \u0438\u0435\u0440\u0430\u0440\u0445\u0438\u0438 \u0435\u0441\u043b\u0438 \u043d\u0435 \u043e\u0448\u0438\u0431\u0430\u044e\u0441\u044c \u0441\u0442\u043e\u044f\u0442 \u0432 \u0441\u0430\u043c\u043e\u043c \u043d\u0438\u0437\u0443, \u0442.\u0435. \u0435\u0441\u043b\u0438 \u044d\u0442\u0438 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u043f\u0440\u0438\u043b\u0435\u0442\u044f\u0442 \u043e\u0442\u043a\u0443\u0434\u0430 \u043e\u0442 \u0435\u0449\u0435, \u0438\u0445 \u043f\u0440\u0438\u043e\u0440\u0438\u0442\u0435\u0442 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0448\u0435:<\/p>\n<p>kvmlab\/roles\/vm_provision\/defaults\/main.yml:<\/p>\n<pre><code class=\"yaml\">--- # defaults file for vm_provision base_image_name: debian-11-generic-amd64-20230124-1270.qcow2 base_image_url: https:\/\/cdimage.debian.org\/cdimage\/cloud\/bullseye\/20230124-1270\/{{ base_image_name }} base_image_sha: 8db9abe8e68349081cc1942a4961e12fb7f94f460ff170c4bdd590a9203fbf83 libvirt_pool_dir: \"\/var\/lib\/libvirt\/images\" libvirt_pool_images: \"\/var\/lib\/libvirt\/images\" vm_vcpus: 2 vm_ram_mb: 2048 vm_net: vmnet vm_root_pass: test123 ssh_key: \/root\/.ssh\/id_rsa.pub<\/code><\/pre>\n<p>2 \u0448\u0430\u0431\u043b\u043e\u043d\u0430:<\/p>\n<p>roles\/vm_provision\/templates\/<br \/> vm-template.xml.j2 &#8212; \u0428\u0430\u0431\u043b\u043e\u043d \u043f\u043e \u043a\u043e\u0442\u043e\u0440\u043e\u043c\u0443 \u0441\u043e\u0437\u0434\u0430\u0435\u0442\u0441\u044f \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u0430\u044f \u043c\u0430\u0448\u0438\u043d\u0430 \u0432 xml \u0444\u043e\u0440\u043c\u0430\u0442\u0435. \u043f\u0440\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0437\u0430\u043f\u043e\u043b\u043d\u044f\u044e\u0442\u0441\u044f \u0438\u0437 \u0437\u0430\u0434\u0430\u043d\u043d\u044b\u0445 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445.<br \/> vm_network.xml.j2  &#8212; \u0428\u0430\u0431\u043b\u043e\u043d \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0441\u0435\u0442\u0438 \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u0431\u0443\u0434\u0443\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c VM.<\/p>\n<p>\u042f \u043d\u0435 \u0431\u0443\u0434\u0443 \u0438\u0445 \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u0442\u044c, \u0432\u044b \u0441\u043c\u043e\u0436\u0435\u0442\u0435 \u0437\u0430\u0431\u0440\u0430\u0442\u044c \u0438\u0445 \u0432 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0438.<\/p>\n<p>\u041d\u0443 \u0438 \u043d\u0430\u043a\u043e\u043d\u0435\u0446 roles\/vm_provision\/tasks\/<\/p>\n<p>create_network.yml &#8212; \u043d\u0430\u0431\u043e\u0440 \u0437\u0430\u0434\u0430\u0447 \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0441\u0435\u0442\u0438<\/p>\n<p>create_nodes.yml &#8212; \u043d\u0430\u0431\u043e\u0440 \u0437\u0430\u0434\u0430\u0447 \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f\u00a0\u043d\u043e\u0434<\/p>\n<p>create_snapshot.yml &#8212; \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435\u00a0\u0441\u043d\u0430\u043f\u0448\u043e\u0442\u043e\u0432<\/p>\n<p>prepare_images_for_cluster.yml &#8212; \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0430 \u0448\u0430\u0431\u043b\u043e\u043d\u0430<\/p>\n<p>\u041d\u0430\u0447\u043d\u0435\u043c\u00a0\u0441 \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0438 \u0448\u0430\u0431\u043b\u043e\u043d\u0430:<br \/>\u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0438\u0437 4 \u0437\u0430\u0434\u0430\u0447:<\/p>\n<ol>\n<li>\n<p>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0430 \u0434\u043b\u044f \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u043e\u0431\u0440\u0430\u0437\u0430(\u0435\u0441\u043b\u0438 \u043a\u043e\u043d\u0435\u0447\u043d\u043e \u043e\u043d \u043d\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442)<\/p>\n<\/li>\n<li>\n<p>\u0421\u043a\u0430\u0447\u0438\u0432\u0430\u043d\u0438\u0435 \u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u0431\u0430\u0437\u043e\u0432\u043e\u0433\u043e \u043e\u0431\u0440\u0430\u0437\u0430.\u00a0\u041a\u0430\u0436\u0434\u044b\u0439\u00a0\u0440\u0430\u0437 \u043a\u0430\u0447\u0430\u0442\u044c \u0435\u0433\u043e \u043d\u0435\u0442 \u0441\u043c\u044b\u0441\u043b\u0430, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0441\u043a\u0430\u0447\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u043e\u0434\u0438\u043d \u0440\u0430\u0437, \u043f\u0440\u0438 \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u043e\u043c \u0437\u0430\u043f\u0443\u0441\u043a\u0435, \u0435\u0441\u043b\u0438 \u0444\u0430\u0439\u043b \u0443\u0436\u0435 \u043b\u0435\u0436\u0438\u0442 \u043d\u0430 \u043c\u0435\u0441\u0442\u0435 \u044d\u0442\u0430 \u0447\u0430\u0441\u0442\u044c \u0441\u043a\u0438\u043f\u0430\u0435\u0442\u0441\u044f.<\/p>\n<\/li>\n<li>\n<p>\u0411\u0430\u0437\u043e\u0432\u044b\u0439 \u043e\u0431\u0440\u0430\u0437 \u0443\u0436\u0435 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u043a \u0412\u041c \u0438 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u043d\u0438\u043c, \u043e\u0434\u043d\u0430\u043a\u043e \u0442\u043e\u0433\u0434\u0430 \u043e\u043d \u043f\u0435\u0440\u0435\u0441\u0442\u0430\u043d\u0435\u0442 \u0431\u044b\u0442\u044c \u0431\u0430\u0437\u043e\u0432\u044b\u043c, \u0430 \u0443\u0436\u0435 \u0431\u0443\u0434\u0435\u0442 \u043a\u0430\u0441\u0442\u043e\u043c\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u043c.\u00a0\u041e\u0441\u0442\u0430\u0432\u0438\u043c\u00a0\u0435\u0433\u043e \u043a\u0430\u043a \u0435\u0441\u0442\u044c, \u043d\u043e \u0441\u043a\u043e\u043f\u0438\u0440\u0443\u0435\u043c \u0435\u0433\u043e \u043a\u0430\u043a \u0448\u0430\u0431\u043b\u043e\u043d \u0434\u043b\u044f \u0412\u041c<\/p>\n<\/li>\n<li>\n<p>\u043f\u0435\u0440\u0432\u0438\u0447\u043d\u0430\u044f \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u0448\u0430\u0431\u043b\u043e\u043d\u0430. \u0427\u0430\u0441\u0442\u044c \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a \u0438 \u041f\u041e \u0434\u043b\u044f \u043b\u044e\u0431\u043e\u0433\u043e \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0430 \u0440\u0430\u0437\u0432\u0435\u0440\u0442\u044b\u0432\u0430\u043d\u0438\u044f \u0431\u0443\u0434\u0435\u0442 \u043e\u0434\u043d\u0430 \u0438 \u0442\u0430 \u0436\u0435.\u00a0\u041f\u043e\u044d\u0442\u043e\u043c\u0443\u00a0\u043f\u0440\u043e\u0449\u0435 \u043d\u0430\u043a\u0430\u0442\u0438\u0442\u044c \u0438\u0445 \u0441\u0440\u0430\u0437\u0443 \u0432 \u0448\u0430\u0431\u043b\u043e\u043d.\u00a0\u0422\u0430\u043a\u00a0\u0436\u0435 \u0437\u0430\u043f\u043e\u043b\u043d\u0438\u043c hosts,\u00a0\u043f\u043e-\u0445\u043e\u0440\u043e\u0448\u0435\u043c\u0443\u00a0\u0435\u0433\u043e \u0431\u044b \u0437\u0430\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0438 \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430\u00a0\u043d\u043e\u0434, \u043d\u043e \u044f \u043f\u0440\u043e\u043f\u0438\u0441\u0430\u043b 5 \u0448\u0442\u0443\u043a \u0441\u0440\u0430\u0437\u0443.\u00a0\u0421\u0438\u043b\u044c\u043d\u043e\u00a0\u043d\u0435 \u043c\u0435\u0448\u0430\u0435\u0442. <\/p>\n<\/li>\n<\/ol>\n<p>kvmlab\/roles\/vm_provision\/tasks\/prepare_images_for_cluster.yml:<\/p>\n<pre><code class=\"yaml\">--- # tasks file vm_provision, \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435  \u0448\u0430\u0431\u043b\u043e\u043d\u0430 \u0412\u041c - name: \u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0430 {{ libvirt_pool_images }} \u0435\u0441\u043b\u0438 \u043d\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442.   file:     path: \"{{ libvirt_pool_images }}\"     state: directory     mode: 0755  - name: \u0421\u043a\u0430\u0447\u0438\u0432\u0430\u043d\u0438\u0435 \u0431\u0430\u0437\u043e\u0432\u043e\u0433\u043e \u043e\u0431\u0440\u0430\u0437\u0430 \u0435\u0441\u043b\u0438 \u0435\u0433\u043e \u043d\u0435\u0442 \u0432 \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0435   get_url:     url: \"{{ base_image_url }}\"     dest: \"{{ libvirt_pool_images }}\/{{ base_image_name }}\"     checksum: \"sha256:{{ base_image_sha }}\"    - name: \u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043a\u043e\u043f\u0438\u0438 \u0431\u0430\u0437\u043e\u0432\u043e\u0433\u043e \u043e\u0431\u0440\u0430\u0437\u0430, \u0434\u043b\u044f \u0448\u0430\u0431\u043b\u043e\u043d\u0430   copy:     dest: \"{{ libvirt_pool_images }}\/template_with_common_settings.qcow2\"     src: \"{{ libvirt_pool_images }}\/{{ base_image_name }}\"     force: no     remote_src: yes      mode: 0660   register: copy_results  - name: \u041f\u0435\u0440\u0432\u0438\u0447\u043d\u0430\u044f \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u0448\u0430\u0431\u043b\u043e\u043d\u0430.   command: |     virt-customize -a {{ libvirt_pool_images }}\/template_with_common_settings.qcow2 \\     --root-password password:{{ vm_root_pass }} \\     --ssh-inject 'root:file:{{ ssh_key }}' \\     --uninstall cloud-init \\     --run-command 'apt update &amp;&amp; apt install -y ntpdate gnupg gnupg2 curl software-properties-common wget keepalived haproxy' \\     --append-line '\/etc\/hosts:172.30.0.201 node1.internal node1\\n172.30.0.202 node2.internal node2\\n172.30.0.203 node3.internal node3\\n172.30.0.204 node4.internal node4\\n172.30.0.205 node5.internal node5' \\     --run-command 'curl -s https:\/\/packages.cloud.google.com\/apt\/doc\/apt-key.gpg | gpg --dearmour -o \/etc\/apt\/trusted.gpg.d\/cgoogle.gpg' \\     --run-command 'apt-add-repository \"deb http:\/\/apt.kubernetes.io\/ kubernetes-xenial main\"' \\     --run-command 'apt update &amp;&amp; apt install -y kubeadm kubectl' \\     --run-command 'echo 'overlay' > \/etc\/modules-load.d\/k8s.conf &amp;&amp; echo 'br_netfilter' >> \/etc\/modules-load.d\/k8s.conf' \\     --run-command 'echo -e \"net.bridge.bridge-nf-call-ip6tables = 1\\nnet.bridge.bridge-nf-call-iptables = 1\\nnet.ipv4.ip_forward = 1\" > \/etc\/sysctl.d\/10-k8s.conf'    when: copy_results is changed<\/code><\/pre>\n<p>\u041e\u0442\u043b\u0438\u0447\u043d\u043e, \u0448\u0430\u0431\u043b\u043e\u043d \u0433\u043e\u0442\u043e\u0432. \u0434\u0430\u043b\u0435\u0435 \u043d\u0430 \u043e\u0447\u0435\u0440\u0435\u0434\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0441\u0435\u0442\u0438, \u0438\u0431\u043e \u0441\u0435\u0442\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0432 \u0448\u0430\u0431\u043b\u043e\u043d\u0435 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0412\u041c, \u0438 \u0435\u0441\u043b\u0438 \u0435\u0451 \u043d\u0435 \u0431\u0443\u0434\u0435\u0442, \u0442\u043e \u0447\u0443\u0434\u0430 \u043d\u0435 \u0441\u043b\u0443\u0447\u0438\u0442\u0441\u044f.<\/p>\n<p>\u0422\u0443\u0442 \u0432\u0441\u0435 \u043f\u0440\u043e\u0441\u0442\u043e, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f virsh \u043c\u044b \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u043b\u0430\u0441\u044c \u043b\u0438 \u0441\u0435\u0442\u044c \u0440\u0430\u043d\u0435\u0435. \u0435\u0441\u043b\u0438 \u0434\u0430, \u0442\u043e \u0441\u043a\u0438\u043f\u0430\u0435\u043c, \u0435\u0441\u043b\u0438 \u0436\u0435 \u043d\u0435\u0442, \u0442\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0448\u0430\u0431\u043b\u043e\u043d \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043e \u0438\u043c\u044f \u0441\u0435\u0442\u0438 \u0438\u0437 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0430\u043c\u0438 \u0432\u0441\u0451 \u0442\u043e\u0439 \u0436\u0435 virsh \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0437\u0434\u0430\u043d\u0430, \u0437\u0430\u043f\u0443\u0449\u0435\u043d\u0430 \u0438 \u0432\u044b\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0430 \u0432 \u0430\u0432\u0442\u043e\u0437\u0430\u043f\u0443\u0441\u043a \u0441\u0435\u0442\u044c.<\/p>\n<p>kvmlab\/roles\/vm_provision\/tasks\/create_network.yml:<\/p>\n<pre><code class=\"yaml\">--- # tasks file for vm_provision, \u043f\u0435\u0440\u0435\u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0441\u0435\u0442\u0438  - name: \u041f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0441\u043f\u0438\u0441\u043a\u0430 \u0441\u0435\u0442\u0435\u0439 KVM   command: virsh net-list --all   register: net_list_output  - name: \u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u043d\u0430\u043b\u0438\u0447\u0438\u044f \u0441\u0435\u0442\u0438 {{ vm_net }}   shell: echo \"{{ net_list_output.stdout }}\" | grep -w \"{{ vm_net }}\"   register: network_check   ignore_errors: true  - name: \u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u0441\u0435\u0442\u0438 {{ vm_net }}   block:     - name: \u041a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0448\u0430\u0431\u043b\u043e\u043d\u0430 \u0441\u0435\u0442\u0438       template:         src: vm_network.xml.j2         dest: \/tmp\/vm_network.xml      - name: \u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0441\u0435\u0442\u0438 {{ vm_net }}       command: virsh net-define \/tmp\/vm_network.xml      - name: \u0417\u0430\u043f\u0443\u0441\u043a \u0441\u0435\u0442\u0438 {{ vm_net }}       command: virsh net-start {{ vm_net }}      - name: \u0410\u0432\u0442\u043e\u0441\u0442\u0430\u0440\u0442 \u0441\u0435\u0442\u0438 {{ vm_net }}       command: virsh net-autostart {{ vm_net }}   when: network_check.rc != 0<\/code><\/pre>\n<p>\u0422\u0430\u043a. \u0428\u0430\u0431\u043b\u043e\u043d \u0412\u041c \u0435\u0441\u0442\u044c, \u0441\u0435\u0442\u044c \u0435\u0441\u0442\u044c. \u041d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u043c\u0435\u0448\u0430\u0435\u0442 \u043d\u0430\u043c \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043d\u043e\u0434\u0443 \u0438\u043b\u0438 \u043d\u043e\u0434\u044b:<br \/> \u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043d\u043e\u0434 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442\u0441\u044f \u0446\u0438\u043a\u043b\u043e\u043c \u043f\u043e \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u043c. (vm_info.vm_names)<br \/> \u043d\u043e\u0434\u044b \u0441\u043e\u0437\u0434\u0430\u044e\u0442\u0441\u044f \u043f\u043e \u043e\u0434\u043d\u043e\u0439 \u0438 \u043f\u0440\u043e\u0445\u043e\u0434\u044f\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u044d\u0442\u0430\u043f\u044b:<\/p>\n<ol>\n<li>\n<p>\u041e\u043f\u044f\u0442\u044c \u0436\u0435 \u0441\u043e\u0437\u0434\u0430\u0435\u0442\u0441\u044f \u043a\u0430\u0442\u0430\u043b\u043e\u0433 \u0434\u043b\u044f \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0434\u0438\u0441\u043a\u043e\u0432 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0445 \u043c\u0430\u0448\u0438\u043d, \u0435\u0441\u043b\u0438 \u043e\u043d \u043d\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442.<\/p>\n<\/li>\n<li>\n<p>\u041a\u0430\u0436\u0434\u0430\u044f \u043c\u0430\u0448\u0438\u043d\u0430 \u043f\u0435\u0440\u0435\u0434 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435\u043c \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442\u0441\u044f \u043d\u0430 \u043d\u0430\u043b\u0438\u0447\u0438\u0435 \u0435\u0451 \u0432 \u0443\u0436\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0445, \u0435\u0441\u043b\u0438 \u043e\u043d\u0430 \u0435\u0441\u0442\u044c, \u0442\u043e \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043f\u0440\u043e\u043f\u0443\u0441\u043a\u0430\u0435\u0442\u0441\u044f, \u0442\u0430\u043a \u0447\u0442\u043e \u0435\u0441\u043b\u0438 \u0443 \u0432\u0430\u0441 \u043e\u0441\u0442\u0430\u043b\u0430\u0441\u044c \u043c\u0430\u0448\u0438\u043d\u0430 \u0441 \u043f\u0440\u043e\u0448\u043b\u043e\u0433\u043e \u0441\u0442\u0435\u043d\u0434\u0430 \u0442\u043e \u043b\u0443\u0447\u0448\u0435 \u0435\u0451 \u043f\u0435\u0440\u0435\u0441\u043e\u0437\u0434\u0430\u0442\u044c.<\/p>\n<\/li>\n<li>\n<p>\u041a\u043e\u043f\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0448\u0430\u0431\u043b\u043e\u043d\u043d\u044b\u0439 \u043e\u0431\u0440\u0430\u0437 \u0434\u0438\u0441\u043a\u0430 \u0438 \u043f\u0435\u0440\u0435\u0438\u043c\u0435\u043d\u043e\u0432\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0432 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0438 \u0441 \u0438\u043c\u0435\u043d\u0435\u043c \u0412\u041c<\/p>\n<\/li>\n<li>\n<p>\u0418\u0437\u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \u0440\u0430\u0437\u043c\u0435\u0440 \u0434\u0438\u0441\u043a\u0430, \u0440\u0430\u0441\u0448\u0438\u0440\u044f\u0435\u0442\u0441\u044f \u0434\u043e 10 GB, \u044d\u0442\u043e\u0433\u043e \u043e\u0431\u044a\u0435\u043c\u0430 \u043c\u043d\u0435 \u0445\u0432\u0430\u0442\u0438\u043b\u043e \u0434\u043b\u044f \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u0432\u0441\u0435\u0445 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u0432. \u0417\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0437\u0430\u0445\u0430\u0440\u0434\u043a\u043e\u0436\u0435\u043d\u043e, \u043d\u043e \u043f\u0440\u0438 \u0436\u0435\u043b\u0430\u043d\u0438\u0438 \u0435\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u0442\u0430\u043a \u0436\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0438\u0437\u043e\u0432\u0430\u0442\u044c.<\/p>\n<\/li>\n<li>\n<p>\u041d\u0430\u0447\u0430\u043b\u044c\u043d\u043e\u0435 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043d\u043e\u0434\u044b. \u0422\u0443\u0442 \u0443 \u043d\u043e\u0434 \u043f\u043e\u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0438\u043d\u0434\u0438\u0432\u0438\u0434\u0443\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c, \u0438\u043c\u044f, ip \u0438 \u0441\u0432\u043e\u0439 ssh \u043a\u043b\u044e\u0447<\/p>\n<\/li>\n<li>\n<p>\u041a\u043e\u0433\u0434\u0430 \u0432\u0441\u0435 \u0441\u043e\u0441\u0442\u0430\u0432\u043d\u044b\u0435 \u0447\u0430\u0441\u0442\u0438 \u0433\u043e\u0442\u043e\u0432\u044b, \u0441\u043e\u0437\u0434\u0430\u0435\u0442\u0441\u044f \u043c\u0430\u0448\u0438\u043d\u0430 \u0438\u0437 \u0448\u0430\u0431\u043b\u043e\u043d\u0430 xml<\/p>\n<\/li>\n<li>\n<p>\u0417\u0430\u043f\u0443\u0441\u043a \u0412\u041c<\/p>\n<\/li>\n<\/ol>\n<p> kvmlab\/roles\/vm_provision\/tasks\/create_nodes.yml:<\/p>\n<pre><code class=\"yaml\">--- # tasks file for vm_provision, \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043d\u043e\u0434 - name: \u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0430 {{ libvirt_pool_dir }} \u0435\u0441\u043b\u0438 \u043d\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442.   file:     path: \"{{ libvirt_pool_dir }}\"     state: directory     mode: 0755  - name: \u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0441\u043f\u0438\u0441\u043e\u043a \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0445 \u0412\u041c   community.libvirt.virt:     command: list_vms   register: existing_vms   changed_when: no  - name: \u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0412\u041c \u0435\u0441\u043b\u0438 \u0435\u0451 \u0438\u043c\u0435\u043d\u0438 \u043d\u0435\u0442 \u0432 \u0441\u043f\u0438\u0441\u043a\u0435   block:   - name: \u041a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0448\u0430\u0431\u043b\u043e\u043d\u043d\u043e\u0433\u043e \u043e\u0431\u0440\u0430\u0437\u0430 \u0432 \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0435     copy:       dest: \"{{ libvirt_pool_dir }}\/{{ vm_name }}.qcow2\"       src: \"{{ libvirt_pool_images }}\/template_with_common_settings.qcow2\"       force: no       remote_src: yes        mode: 0660     register: copy_results      - name: \u0418\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u0440\u0430\u0437\u043c\u0435\u0440\u0430 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0434\u0438\u0441\u043a\u0430     shell: \"qemu-img resize {{ libvirt_pool_dir }}\/{{ vm_name }}.qcow2 10G\"     - name: \u041d\u0430\u0447\u0430\u043b\u044c\u043d\u043e\u0435 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 hostname:{{ vm_name }}, ip:{{ ipaddr }}     command: |       virt-customize -a {{ libvirt_pool_dir }}\/{{ vm_name }}.qcow2 \\       --hostname {{ vm_name }}.internal \\       --run-command 'echo \"source \/etc\/network\/interfaces.d\/*\\nauto lo\\niface lo inet loopback\\nauto enp1s0\\niface enp1s0 inet static\\naddress {{ ipaddr }}\\nnetmask 255.255.255.0\\ngateway 172.30.0.1\\ndns-nameservers 172.30.0.1\" > \/etc\/network\/interfaces'       --run-command 'ssh-keygen -A'      when: copy_results is changed    - name: \u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0412\u041c \u0438\u0437 \u0448\u0430\u0431\u043b\u043e\u043d\u0430     community.libvirt.virt:       command: define       xml: \"{{ lookup('template', 'vm-template.xml.j2') }}\"          when: \"vm_name not in existing_vms.list_vms\"  - name: \u0412\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u0412\u041c   community.libvirt.virt:     name: \"{{ vm_name }}\"     state: running   register: vm_start_results   until: \"vm_start_results is success\"   retries: 15   delay: 2<\/code><\/pre>\n<p>\u041e\u0442\u043b\u0438\u0447\u043d\u043e, \u043c\u0430\u0448\u0438\u043d\u044b \u0441\u043e\u0437\u0434\u0430\u043d\u044b. \u0442\u0435\u043f\u0435\u0440\u044c \u043f\u0435\u0440\u0435\u0437\u0430\u0433\u0440\u0443\u0437\u0438\u043c \u0438\u0445, \u0434\u043e\u0436\u0434\u0435\u043c\u0441\u044f \u043f\u043e\u043a\u0430 \u0432\u0441\u0435 \u0437\u0430\u0433\u0440\u0443\u0437\u044f\u0442\u0441\u044f \u0438 \u0441\u0434\u0435\u043b\u0430\u0435\u043c \u0441\u043d\u0430\u043f\u0448\u043e\u0442\u044b.<\/p>\n<p>kvmlab\/roles\/vm_provision\/tasks\/create_snapshot.yml:<\/p>\n<pre><code class=\"yaml\">--- # tasks file for vm_provision, \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0441\u043d\u0430\u043f\u0448\u043e\u0442\u043e\u0432 - name: \u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0441\u043d\u0430\u043f\u0448\u043e\u0442\u0430 {{ snapshot_name }}   shell: \"virsh snapshot-create-as --domain {{ vm_name }} --name {{ snapshot_name }} --description '{{ snapshot_description }}'\"   register: snapshot_create_status   ignore_errors: true<\/code><\/pre>\n<p>\u0415\u0441\u043b\u0438 \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u0437\u0430\u0431\u044b\u043b, \u0442\u043e \u043f\u0435\u0440\u0432\u044b\u0439 \u044d\u0442\u0430\u043f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d.<\/p>\n<p>\u0423 \u0432\u0430\u0441 \u0435\u0441\u0442\u044c \u043e\u0434\u043d\u0430 \u0438\u043b\u0438 \u043f\u044f\u0442\u044c \u043d\u043e\u0434, \u0432\u0441\u0435 \u0433\u043e\u0442\u043e\u0432\u044b \u043a \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u0439 \u0440\u0430\u0431\u043e\u0442\u0435. <\/p>\n<p>\u041f\u0440\u0438\u0447\u0435\u043c \u0435\u0441\u043b\u0438 \u0443\u0434\u0430\u043b\u0438\u0442\u044c \u0432\u0441\u0435 \u0412\u041c \u0438 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u043e, \u0442\u043e \u0438\u0437 \u0437\u0430 \u043d\u0430\u043b\u0438\u0447\u0438\u044f \u0433\u043e\u0442\u043e\u0432\u043e\u0433\u043e \u0448\u0430\u0431\u043b\u043e\u043d\u0430 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u043f\u0440\u043e\u0439\u0434\u0451\u0442 \u0433\u043e\u0440\u0430\u0437\u0434\u043e \u0431\u044b\u0441\u0442\u0440\u0435\u0435.<\/p>\n<p>\u041e\u0442\u043b\u0438\u0447\u043d\u043e. \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u043a \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0435 \u0434\u0432\u0438\u0436\u043a\u0430:<\/p>\n<p>\u0432\u0435\u0440\u043d\u0435\u043c\u0441\u044f \u0432 setup_k8s.yaml \u0438 \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 play:<\/p>\n<pre><code class=\"yaml\"> - name: \u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u0434\u0432\u0438\u0436\u043a\u0430 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0438\u0437\u0430\u0446\u0438\u0438 [cri-o, container-d, docker]   hosts: all   gather_facts: true   become: true   remote_user: root   tasks:     - name: \u0421\u0438\u043d\u0445\u0440\u043e\u043d\u0438\u0437\u0430\u0446\u0438\u044f \u0434\u0430\u0442\u044b\/\u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0441 NTP \u0441\u0435\u0440\u0432\u0435\u0440\u043e\u043c       shell: ntpdate 0.europe.pool.ntp.org      - name: \u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 cri-o       include_role:         name: driver_provision         tasks_from: install_crio.yml       when: engine == \"cri-o\"      - name: \u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 container-d       include_role:         name: driver_provision         tasks_from: install_container_d.yml       when: engine == \"container-d\"      - name: \u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 docker cri       include_role:         name: driver_provision         tasks_from: install_docker_cri.yml       when: engine == \"docker\"<\/code><\/pre>\n<p>\u0412 \u0446\u0435\u043b\u043e\u043c \u0432\u0441\u0451 \u043f\u0440\u043e\u0441\u0442\u043e, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0440\u043e\u043b\u044c driver_provision, \u043d\u043e \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u044b\u0445 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u043e\u0434\u043d\u0443 \u0438\u0437 \u0442\u0440\u0435\u0445 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0435\u0439. <\/p>\n<p>\u0412\u0441\u044f \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0439 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0438\u0437 \u0434\u0432\u0438\u0436\u043a\u043e\u0432 \u0431\u044b\u043b\u0430 \u0432\u0437\u044f\u0442\u0430 \u0438\u0437 <a href=\"https:\/\/habr.com\/ru\/articles\/725640\/\" rel=\"noopener noreferrer nofollow\">\u0441\u0442\u0430\u0442\u044c\u0438 <\/a>\u0443\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u0439 \u0432\u043d\u0430\u0447\u0430\u043b\u0435. <\/p>\n<p>\u042f \u043d\u0435 \u0431\u0443\u0434\u0443 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0442\u0430\u0441\u043a\u0438, \u0432 \u0446\u0435\u043b\u043e\u043c \u0438\u0445 \u0438\u043c\u0435\u043d\u0430 \u043e\u0442\u0440\u0430\u0436\u0430\u044e\u0442 \u0441\u0443\u0442\u044c \u0432\u0441\u0435\u0445 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0439.<br \/>\u043f\u0440\u0438\u0432\u0435\u0434\u0451\u043c \u0432\u0441\u0435 \u0442\u0440\u0438 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0430:<\/p>\n<p>kvmlab\/roles\/driver_provision\/tasks\/install_container_d.yml:<\/p>\n<pre><code class=\"yaml\">--- # tasks file for driver_provision, \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 container-d - name: \u0421\u043a\u0430\u0447\u0438\u0432\u0430\u0435\u043c containerd   get_url:     url: \"https:\/\/github.com\/containerd\/containerd\/releases\/download\/v1.7.0\/containerd-1.7.0-linux-amd64.tar.gz\"     dest: \"\/tmp\/containerd-1.7.0-linux-amd64.tar.gz\"  - name: \u0420\u0430\u0441\u043f\u0430\u043a\u043e\u0432\u044b\u0432\u0430\u0435\u043c \u0430\u0440\u0445\u0438\u0432   unarchive:     src: \/tmp\/containerd-1.7.0-linux-amd64.tar.gz     dest: \/usr\/local     copy: no  - name: \u0423\u0434\u0430\u043b\u044f\u0435\u043c \u0441\u043a\u0430\u0447\u0430\u043d\u044b\u0439 \u0430\u0440\u0445\u0438\u0432 \u0437\u0430 \u043d\u0435\u043d\u0430\u0434\u043e\u0431\u043d\u043e\u0441\u0442\u044e   file:     path: \"\/tmp\/containerd-1.7.0-linux-amd64.tar.gz\"     state: absent  - name: \u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0438 \u0434\u043b\u044f \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 containerd   file:     path: \/etc\/containerd\/     state: directory  - name: \u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u0441\u043e\u0437\u0434\u0430\u043d \u043b\u0438 \u043a\u0430\u0442\u0430\u043b\u043e\u0433   stat:     path: \/etc\/containerd   register: containerd_dir  - name: \u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043a\u043e\u043d\u0444\u0438\u0433 \u0444\u0430\u0439\u043b\u0430 containerd   become: true   command: \"sh -c 'containerd config default > \/etc\/containerd\/config.toml'\"   when: containerd_dir.stat.exists  - name: \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 cgroup driver   replace:     path: \"\/etc\/containerd\/config.toml\"     regexp: \"SystemdCgroup = false\"     replace: \"SystemdCgroup = true\"  - name: \u0421\u043a\u0430\u0447\u0438\u0432\u0430\u0435\u043c containerd systemd service file   get_url:     url: \"https:\/\/raw.githubusercontent.com\/containerd\/containerd\/main\/containerd.service\"     dest: \"\/etc\/systemd\/system\/containerd.service\"  - name: \u0421\u043a\u0430\u0447\u0438\u0432\u0430\u0435\u043c \u0438 \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c runc   get_url:     url: \"https:\/\/github.com\/opencontainers\/runc\/releases\/download\/v1.1.4\/runc.amd64\"     dest: \"\/usr\/local\/sbin\/runc\"     mode: \"u+x\"  - name: \u0421\u043a\u0430\u0447\u0438\u0432\u0430\u0435\u043c CNI plugins   get_url:     url: \"https:\/\/github.com\/containernetworking\/plugins\/releases\/download\/v1.2.0\/cni-plugins-linux-amd64-v1.2.0.tgz\"     dest: \"\/tmp\/cni-plugins-linux-amd64-v1.2.0.tgz\"  - name: \u0420\u0430\u0441\u043f\u0430\u043a\u043e\u0432\u044b\u0432\u0430\u0435\u043c CNI plugins archive   unarchive:     src: \"\/tmp\/cni-plugins-linux-amd64-v1.2.0.tgz\"     dest: \"\/opt\/cni\/bin\"     copy: no  - name: \u0423\u0434\u0430\u043b\u044f\u0435\u043c CNI plugins archive   file:     path: \"\/tmp\/cni-plugins-linux-amd64-v1.2.0.tgz\"     state: absent  - name: \u041f\u0435\u0440\u0435\u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0430 systemd   systemd:     daemon_reload: yes  - name: \u0417\u0430\u043f\u0443\u0441\u043a \u0438 \u0430\u043a\u0442\u0438\u0432\u0430\u0446\u0438\u044f containerd service   systemd:     name: containerd     state: started     enabled: yes<\/code><\/pre>\n<p>kvmlab\/roles\/driver_provision\/tasks\/install_crio.yml:<\/p>\n<pre><code class=\"yaml\">--- # tasks file for driver_provision, \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 cri-o - name: \u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u043a\u043b\u044e\u0447\u0430 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u044f cri-o   apt_key:     url: https:\/\/download.opensuse.org\/repositories\/devel:\/kubic:\/libcontainers:\/stable:\/cri-o:\/{{ version }}\/{{ os }}\/Release.key     state: present  - name: \u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u044f cri-o   apt_repository:     repo: 'deb https:\/\/download.opensuse.org\/repositories\/devel:\/kubic:\/libcontainers:\/stable\/{{ os }}\/ \/'     filename: devel:kubic:libcontainers:stable.list  - name: \u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u044f cri-ostable\/cri-o   apt_repository:     repo: 'deb http:\/\/download.opensuse.org\/repositories\/devel:\/kubic:\/libcontainers:\/stable:\/cri-o:\/{{ version }}\/{{ os }}\/ \/'     filename: 'devel:kubic:libcontainers:stable:cri-o:{{ version }}.list'  - name: \u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 cri-o   apt:     name: ['cri-o', 'cri-o-runc']     state: latest  - name: \u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0430 \/var\/lib\/crio   file:     path: \/var\/lib\/crio     state: directory      - name: \u041f\u0435\u0440\u0435\u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0430 systemd   systemd:     daemon_reload: yes  - name: \u0437\u0430\u043f\u0443\u0441\u043a \u0441\u043b\u0443\u0436\u0431 crio   systemd:     name: crio     enabled: yes     state: started<\/code><\/pre>\n<p>kvmlab\/roles\/driver_provision\/tasks\/install_docker_cri.yml:<\/p>\n<pre><code class=\"yaml\">--- # tasks file for driver_provision, \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 docker + cri - name: Create directory \/etc\/apt\/keyrings   file:     path: \/etc\/apt\/keyrings     state: directory     mode: '0755'  - name: Add GPG key Docker   ansible.builtin.shell:  curl -fsSL https:\/\/download.docker.com\/linux\/debian\/gpg | gpg --dearmor -o \/etc\/apt\/trusted.gpg.d\/docker.gpg --yes  - name: Get dpkg architecture   shell: \"dpkg --print-architecture\"   register: architecture  - name: Get lsb release   shell: \"lsb_release -cs\"   register: release_output  - name: Add Docker repository   apt_repository:     repo: \"deb [arch={{ architecture.stdout_lines | join }} signed-by=\/etc\/apt\/trusted.gpg.d\/docker.gpg] https:\/\/download.docker.com\/linux\/debian {{ release_output.stdout_lines | join }} stable\"     state: present   register: docker_repo  - name: Apt Update   ansible.builtin.apt:     update_cache: yes  - name: Install Docker   apt:     name:       - docker-ce       - docker-ce-cli       - containerd.io       - docker-compose-plugin     state: present  - name: Download plugin cri-dockerd   get_url:     url: \"https:\/\/github.com\/Mirantis\/cri-dockerd\/releases\/download\/v0.3.1\/cri-dockerd-0.3.1.amd64.tgz\"     dest: \"\/tmp\/cri-dockerd.tgz\"  - name: Unpack cri-dockerd   unarchive:     src: \"\/tmp\/cri-dockerd.tgz\"     dest: \"\/tmp\/\"     copy: no  - name: Copy unpacked bin cri-dockerd   copy:     dest: \"\/usr\/local\/bin\/\"     src: \"\/tmp\/cri-dockerd\/cri-dockerd\"     force: no     remote_src: yes      mode: 0660   register: copy_results  - name: change alc on cri-dockerd   file:     path: \"\/usr\/local\/bin\/cri-dockerd\"     mode: \"0755\"  - name: Download config file on cri-dockerd.service   get_url:     url: \"https:\/\/raw.githubusercontent.com\/Mirantis\/cri-dockerd\/master\/packaging\/systemd\/cri-docker.service\"     dest: \"\/etc\/systemd\/system\/cri-docker.service\"  - name: Download config file on cri-dockerd.socket   get_url:     url: \"https:\/\/raw.githubusercontent.com\/Mirantis\/cri-dockerd\/master\/packaging\/systemd\/cri-docker.socket\"     dest: \"\/etc\/systemd\/system\/cri-docker.socket\"  - name: Update cri-docker.service   ansible.builtin.shell:  \"sed -i -e 's,\/usr\/bin\/cri-dockerd,\/usr\/local\/bin\/cri-dockerd,' \/etc\/systemd\/system\/cri-docker.service\"  - name: daemon reload   systemd:     daemon_reload: yes  - name: enable cri-docker.service   systemd:     name: cri-docker.service     enabled: yes     state: started  - name: enable cri-dockerd.socket   systemd:     name: cri-docker.socket     enabled: yes     state: started<\/code><\/pre>\n<p>\u0422\u0430\u043a, \u0433\u043e\u0442\u043e\u0432\u043e. \u043f\u043e\u0441\u043b\u0435 \u044d\u0442\u0430\u043f\u0430 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u0434\u0432\u0438\u0436\u043a\u0430 \u0438\u0434\u0451\u0442 \u0435\u0449\u0435 \u043e\u0434\u0438\u043d play \u0434\u043b\u044f localhost \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0441\u043d\u0430\u043f\u0448\u043e\u0442\u0430.<\/p>\n<pre><code class=\"yaml\">- name: \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u0441\u043d\u0430\u043f\u0448\u043e\u0442 driver_provision   hosts: localhost   become: yes   tasks:     - name: \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u0441\u043d\u0438\u043c\u043a\u0438       include_role:         name: vm_provision         tasks_from: create_snapshot.yml       vars:         vm_name: \"{{ item.name }}\"         snapshot_name: \"driver_provision\"         snapshot_description: \"\u0414\u0432\u0438\u0436\u043e\u043a \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d, \u043d\u043e\u0434\u0430 \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043b\u0435\u043d\u0430 \u043a \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 k8s\"       when: variant == 'ha-cluster' or item.name == 'node1'       with_items: \"{{ vm_info.vm_names }}\"<\/code><\/pre>\n<p>\u0412 \u0446\u0435\u043b\u043e\u043c \u0442\u0430\u043a \u0436\u0435 \u043e\u043f\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u044b\u0439, \u043c\u043e\u0436\u043d\u043e \u0443\u0434\u0430\u043b\u0438\u0442\u044c.<\/p>\n<p>B\u0442\u0430\u043a, \u043e\u0441\u0442\u0430\u043b\u043e\u0441\u044c \u0441\u0430\u043c\u043e\u0435 \u0432\u0430\u0436\u043d\u043e\u0435, \u0440\u0430\u0434\u0438 \u0447\u0435\u0433\u043e \u0432\u0441\u0451 \u044d\u0442\u043e \u043d\u0430\u0447\u0438\u043d\u0430\u043b\u043e\u0441\u044c.<\/p>\n<p>\u0418\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043a\u0443\u0431\u0435\u0440\u0430!<\/p>\n<p>\u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u0441\u044f \u0432 setup_k8s.yaml \u0438 \u0434\u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 play.<\/p>\n<pre><code class=\"yaml\">- name: \u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 kubernetes [all-in-one \u043b\u0438\u0431\u043e ha-cluster]   hosts: all   gather_facts: true   become: true   remote_user: root   tasks:     - name: \u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 all-in-one       include_role:         name: k8s_all_in_one         tasks_from: all_in_one.yml       when: variant == \"all-in-one\" and inventory_hostname == 'node1'      - name: \u041f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0430 \u043d\u043e\u0434 \u0434\u043b\u044f ha-cluster       include_role:         name: k8s_ha_cluster         tasks_from: ha_cluster_prepare_managers.yml       when: variant == \"ha-cluster\"      - name: \u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u043f\u0435\u0440\u0432\u043e\u0439 \u043d\u043e\u0434\u044b       include_role:         name: k8s_ha_cluster         tasks_from: ha_cluster_first_node.yml       when: variant == \"ha-cluster\" and inventory_hostname == 'node1' and inventory_hostname in groups['management']       register: first_node_result       - name: \u041f\u0435\u0440\u0435\u0434\u0430\u0447\u0430 \u043a\u043e\u043c\u0430\u043d\u0434 \u043d\u0430 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0435 \u043d\u043e\u0434\u044b       set_fact:         control_plane_join_command: \"{{ hostvars['node1']['control_plane_join_command'] }}\"         worker_join_command: \"{{ hostvars['node1']['worker_join_command'] }}\"       when: variant == \"ha-cluster\" and inventory_hostname != 'node1'      - name: \u0432\u044b\u0432\u043e\u0434 \u043a\u043e\u043c\u0430\u043d\u0434 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f       debug:         msg: |           control_plane_join_command: {{ control_plane_join_command }}           worker_join_command: {{ worker_join_command }}       when: variant == \"ha-cluster\" and inventory_hostname == 'node1'      - name: \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u044b control_plane_join_command       block:         - name: \u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u044e\u0449\u0438\u0445 \u043d\u043e\u0434 \u0434\u043b\u044f ['container-d', 'cri-o']           ansible.builtin.shell:             cmd: \"{{ control_plane_join_command }}\"           until: result.rc == 0           register: result           retries: 5           delay: 30           when: engine in ['container-d', 'cri-o']          - name: \u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u044e\u0449\u0438\u0445 \u043d\u043e\u0434 \u0434\u043b\u044f docker           ansible.builtin.shell:             cmd: \"{{ control_plane_join_command }} --cri-socket unix:\/\/\/var\/run\/cri-dockerd.sock\"           until: result.rc == 0           register: result           retries: 5           delay: 30           when: engine == 'docker'       when: variant == \"ha-cluster\" and inventory_hostname != 'node1' and inventory_hostname in groups['management']       - name: \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u044b worker_join_command       block:         - name: \u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u0440\u0430\u0431\u043e\u0447\u0438\u0445 \u043d\u043e\u0434 \u0434\u043b\u044f ['container-d', 'cri-o']           ansible.builtin.shell:             cmd: \"{{ worker_join_command }}\"           until: result.rc == 0           register: result           retries: 5           delay: 30           when: engine in ['container-d', 'cri-o']          - name: \u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u0440\u0430\u0431\u043e\u0447\u0438\u0445 \u043d\u043e\u0434 \u0434\u043b\u044f docker           ansible.builtin.shell:             cmd: \"{{ worker_join_command }} --cri-socket unix:\/\/\/var\/run\/cri-dockerd.sock\"           until: result.rc == 0           register: result           retries: 5           delay: 30           when: engine == 'docker'       when: variant == \"ha-cluster\" and inventory_hostname != 'node1' and inventory_hostname in groups['workers']      - name: \u0421\u043a\u0430\u0447\u0438\u0432\u0430\u043d\u0438\u0435 \u043a\u043e\u043d\u0444\u0438\u0433\u0430 \u0441 \u043f\u0435\u0440\u0432\u043e\u0439 \u043d\u043e\u0434\u044b (\u043f\u043e\u0434\u0445\u043e\u0434\u0438\u0442 \u0434\u043b\u044f \u043e\u0431\u043e\u0438\u0445 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u0432 all-in-one \u0438 ha-cluster)       ansible.builtin.fetch:         src: \/etc\/kubernetes\/admin.conf         dest: \/tmp\/         flat: yes         force: yes       when: inventory_hostname == 'node1'      - name: \u041f\u0435\u0440\u0435\u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0430 \u0432\u0441\u0435\u0445 \u043c\u0430\u0448\u0438\u043d       ansible.builtin.reboot:         reboot_timeout: 300<\/code><\/pre>\n<p>\u0422\u0443\u0442 \u0434\u043b\u044f \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u0434\u0432\u0435 \u0440\u043e\u043b\u0438 (\u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0438 \u043e\u0434\u043d\u043e\u0439 \u043e\u0431\u043e\u0439\u0442\u0438\u0441\u044c \u043d\u043e \u0442\u0430\u043a \u043d\u0430\u0433\u043b\u044f\u0434\u043d\u0435\u0435).<\/p>\n<p>\u041d\u0430\u0447\u043d\u0435\u043c \u043f\u043e\u0436\u0430\u043b\u0443\u0439 \u0441 all-in-one \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0430 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438, \u043e\u043d \u0441\u0430\u043c\u044b\u0439 \u043f\u0440\u043e\u0441\u0442\u043e\u0439:<\/p>\n<p>roles\/k8s_all_in_one\/tasks\/all_in_one.yml:<\/p>\n<pre><code class=\"yaml\">--- - name: \u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u043d\u0430\u043b\u0438\u0447\u0438\u044f \u0444\u0430\u0439\u043b\u0430 \u043a\u043e\u043d\u0444\u0438\u0433\u0430   stat:     path: \/etc\/kubernetes\/admin.conf   register: file_info  - name: \u0418\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0430 \u0435\u0441\u043b\u0438 \u043a\u043e\u043d\u0444\u0438\u0433 \u043d\u0435 \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d.   block:     - name: \u0418\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0430 \u0434\u043b\u044f \u0434\u0432\u0438\u0436\u043a\u043e\u0432 ['container-d', 'cri-o']       shell: kubeadm init --pod-network-cidr=10.244.0.0\/16       when: engine in ['container-d', 'cri-o']       register: kubeadm_output      - name: \u0418\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0430 \u0434\u043b\u044f \u0434\u0432\u0438\u0436\u043a\u0430 docker       shell: |         kubeadm init \\                --pod-network-cidr=10.244.0.0\/16 \\                --cri-socket unix:\/\/\/var\/run\/cri-dockerd.sock       when: engine == 'docker'       register: kubeadm_output      - name: \u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 KUBECONFIG \u0432 enviroment       become: true       lineinfile:         dest: \/etc\/environment         line: 'export KUBECONFIG=\/etc\/kubernetes\/admin.conf'      - name: \u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 KUBECONFIG \u0432 bashrc       become: true       lineinfile:         dest: '~\/.bashrc'         line: 'export KUBECONFIG=\/etc\/kubernetes\/admin.conf'      - name: \u041f\u043e\u0434\u043e\u0436\u0434\u0435\u043c \u043f\u043e\u043a\u0430 \u0432\u0441\u0451 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u0441\u044f       wait_for:         host: localhost         port: 6443         timeout: 300      - name: \u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u0441\u0435\u0442\u0435\u0432\u043e\u0433\u043e \u043f\u043b\u0430\u0433\u0438\u043d\u0430 Flannel       shell: kubectl apply -f https:\/\/raw.githubusercontent.com\/coreos\/flannel\/master\/Documentation\/kube-flannel.yml      - name: \u0421\u043d\u044f\u0442\u0438\u0435 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f \u043d\u0430 \u0437\u0430\u043f\u0443\u0441\u043a \u0440\u0430\u0431\u043e\u0447\u0438\u0445 \u043d\u0430\u0433\u0440\u0443\u0437\u043e\u043a c {{ ansible_hostname }}       shell: \"kubectl taint nodes --all node-role.kubernetes.io\/control-plane-\"       become:roles\/k8s_all_in_one\/tasks\/all_in_one.yml: true       register: taint_result       failed_when:         - \"'error: taint \\\"node-role.kubernetes.io\/control-plane\\\" not found' not in taint_result.stderr\"         - \"'node\/' + ansible_hostname + '.internal untainted' not in taint_result.stdout\"   when: not file_info.stat.exists  - name: \u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438   shell: \"export KUBECONFIG=\/etc\/kubernetes\/admin.conf &amp;&amp; kubectl get nodes\"   register: kubectl_output   ignore_errors: true  - name: \u0418\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0430.   debug:     msg: '\u0418\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0430! \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u0435 \u043a\u043e\u043c\u043c\u0430\u043d\u0434\u0443 export KUBECONFIG=\/etc\/kubernetes\/admin.conf, \u043f\u0440\u043e\u0432\u0435\u0440\u044c\u0442\u0435 \u0432\u044b\u0432\u043e\u0434 \u043a\u043e\u043c\u0430\u043d\u0434\u044b kubectl get nodes'   when: kubectl_output.rc == 0<\/code><\/pre>\n<p>\u0427\u0442\u043e \u0432 \u043d\u0435\u043c \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442.<\/p>\n<p>\u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u0435\u0441\u0442\u044c \u043b\u0438 \u0444\u0430\u0439\u043b \u043a\u043e\u043d\u0444\u0438\u0433\u0430. \u043b\u043e\u0433\u0438\u043a\u0430 \u043f\u0440\u043e\u0441\u0442\u0430, \u0435\u0441\u043b\u0438 \u0444\u0430\u0439\u043b \u0435\u0441\u0442\u044c \u0442\u043e \u0441 \u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u0434\u043e\u043b\u0435\u0439 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u0438 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0443\u0436\u0435 \u0431\u044b\u043b\u0430 \u0438 \u043e\u0442\u0447\u0430\u0441\u0442\u0438 \u0443\u0441\u043f\u0435\u0448\u043d\u0430. \u0432 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0435\u0441\u043b\u0438 \u043d\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442, \u0442\u043e \u043b\u0443\u0447\u0448\u0435 \u0443\u0431\u0438\u0442\u044c \u043d\u043e\u0434\u0443 \u0438 \u0441\u043e\u0431\u0440\u0430\u0442\u044c \u0437\u0430\u043d\u043e\u0432\u043e.<\/p>\n<p>\u0415\u0441\u043b\u0438 \u0436\u0435 \u0444\u0430\u0439\u043b\u0430 \u043d\u0435\u0442, \u0442\u043e \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0434\u0432\u0438\u0436\u043a\u0430 \u0438\u0434\u0451\u0442 \u043a\u043e\u043c\u0430\u043d\u0434\u0430 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 (\u0434\u043b\u044f \u0434\u043e\u043a\u0435\u0440\u0430 \u043e\u043d\u0430 \u0438\u0434\u0451\u0442 \u0441 \u0434\u043e\u043f \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u043c\u0438).<\/p>\n<p>\u0423\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0441\u0435\u0442\u0435\u0432\u043e\u0439 \u043f\u043b\u0430\u0433\u0438\u043d, \u0441\u043d\u0438\u043c\u0430\u044e\u0442\u0441\u044f \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f \u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442\u0441\u044f \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430.<\/p>\n<p>\u0432\u0441\u0451, \u0441\u0442\u0435\u043d\u0434 \u0433\u043e\u0442\u043e\u0432.<\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0434\u0430\u0432\u0430\u0439 \u043f\u0440\u043e\u0431\u0435\u0436\u0438\u043c\u0441\u044f \u043f\u043e ha_cluster.<\/p>\n<p>\u0422\u0443\u0442 \u0432\u0441\u0451 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0441\u043b\u043e\u0436\u043d\u0435\u0435.<br \/>\u043f\u0435\u0440\u0432\u043e\u0435 \u0447\u0442\u043e \u043d\u0430\u0434\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u044d\u0442\u043e \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u0438\u0442\u044c \u043d\u043e\u0434\u044b, \u0430 \u0438\u043c\u0435\u043d\u043d\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c keepalived \u0438 haproxy, \u0434\u043b\u044f \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0435\u043d\u0438\u044f \u043e\u0442\u043a\u0430\u0437\u043e\u0443\u0441\u0442\u043e\u0439\u0447\u0438\u0432\u043e\u0441\u0442\u0438 \u0438 \u0431\u0430\u043b\u0430\u043d\u0441\u0438\u0440\u043e\u0432\u043a\u0438 \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0438.<\/p>\n<p>roles\/k8s_ha_cluster\/tasks\/ha_cluster_prepare_managers.yml<\/p>\n<pre><code class=\"yaml\">- name: \u0421\u0438\u043d\u0445\u0440\u043e\u043d\u0438\u0437\u0430\u0446\u0438\u044f \u0434\u0430\u0442\u044b\/\u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0441 NTP \u0441\u0435\u0440\u0432\u0435\u0440\u043e\u043c   shell: ntpdate 0.europe.pool.ntp.org  - name: \u041a\u043e\u043f\u0438\u0440\u0443\u0435\u043c \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0443 \u0434\u0435\u043c\u043e\u043d\u0430 keepalived   template:     src: templates\/keepalived.conf.j2     dest: \/etc\/keepalived\/keepalived.conf     mode: '0644'  - name: \u041a\u043e\u043f\u0438\u0440\u0443\u0435\u043c \u0441\u043a\u0440\u0438\u043f\u0442 check_apiserver.sh, \u043f\u0440\u0435\u0434\u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u043d\u044b\u0439 \u0434\u043b\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u043e\u0441\u0442\u0438 \u0441\u0435\u0440\u0432\u0435\u0440\u043e\u0432.   template:     src: templates\/check_apiserver.sh.j2     dest: \/etc\/keepalived\/check_apiserver.sh     mode: '0755'  - name: \u0437\u0430\u043f\u0443\u0441\u043a \u0441\u043b\u0443\u0436\u0431\u044b keepalived   systemd:     name: keepalived     enabled: yes     state: restarted  - name: \u041a\u043e\u043f\u0438\u0440\u0443\u0435\u043c \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0443 \u0434\u0435\u043c\u043e\u043d\u0430 haproxy   template:     src: templates\/haproxy.cfg.j2     dest: \/etc\/haproxy\/haproxy.cfg     mode: '0644'  - name: \u0437\u0430\u043f\u0443\u0441\u043a \u0441\u043b\u0443\u0436\u0431\u044b haproxy   systemd:     name: haproxy     enabled: yes     state: restarted<\/code><\/pre>\n<p>\u0412\u0442\u043e\u0440\u044b\u043c \u0448\u0430\u0433\u043e\u043c \u0443\u0434\u0435\u0442 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u043f\u0435\u0440\u0432\u043e\u0439 \u043d\u043e\u0434\u044b. \u0432\u0430\u0436\u043d\u044b\u0439 \u043f\u0440\u043e\u0446\u0435\u0441\u0441, \u0438\u0431\u043e \u043f\u043e\u0441\u043b\u0435 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043a\u0443\u0431\u0435\u0440\u0430 \u043e\u043d \u0432\u044b\u0434\u0430\u0435\u0442 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u0434\u043b\u044f \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043d\u043e\u0432\u044b\u0445 \u0445\u043e\u0441\u0442\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0430\u043c \u043d\u0430\u0434\u043e \u0431\u0443\u0434\u0435\u0442 \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u043d\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043d\u043e\u0434\u0430\u043c.<\/p>\n<p>\u0412 \u0446\u0435\u043b\u043e\u043c \u0441\u0443\u0442\u044c \u0442\u0430 \u0436\u0435, \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u043a\u043e\u043d\u0444\u0438\u0433, \u0435\u0441\u043b\u0438 \u0435\u0433\u043e \u043d\u0435\u0442, \u0442\u043e \u0434\u0435\u043b\u0430\u0435\u043c \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e. \u0434\u043b\u044f docker \u043a\u043e\u043c\u0430\u043d\u0434\u0430 \u0447\u0443\u0442\u044c \u043f\u043e\u0431\u043e\u043b\u044c\u0448\u0435.<\/p>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0444\u0438\u043b\u044c\u0442\u0440\u0443\u0435\u043c \u0432\u044b\u0432\u043e\u0434 \u0440\u0435\u0433\u0443\u043b\u044f\u0440\u043a\u043e\u0439 \u0438 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u043c \u0434\u043b\u044f \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u043c \u043d\u043e\u0434\u0430\u043c. \u044d\u043a\u0441\u043f\u043e\u0440\u0442\u0438\u0440\u0443\u0435\u043c \u043a\u043e\u043d\u0444\u0438\u0433, \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c \u0441\u0435\u0442\u0435\u0432\u043e\u0439 \u043f\u043b\u0430\u0433\u0438\u043d \u0438 \u0438\u0434\u0451\u043c \u0434\u0430\u043b\u044c\u0448\u0435.<\/p>\n<pre><code class=\"yaml\">ha_cluster_first_node.yml: - name: \u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u043d\u0430\u043b\u0438\u0447\u0438\u044f \u0444\u0430\u0439\u043b\u0430 \u043a\u043e\u043d\u0444\u0438\u0433\u0430   stat:     path: \/etc\/kubernetes\/admin.conf   register: file_info  - name: \u0418\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0430 \u0435\u0441\u043b\u0438 \u043a\u043e\u043d\u0444\u0438\u0433 \u043d\u0435 \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d.   block:     - name: \u0418\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0430 \u0434\u043b\u044f \u0434\u0432\u0438\u0436\u043a\u043e\u0432 ['container-d', 'cri-o']       shell: |         kubeadm init \\                 --pod-network-cidr=10.244.0.0\/16 \\                 --control-plane-endpoint \"172.30.0.210:8888\" \\                 --upload-certs       register: init_output_containerd_crio       when: engine in ['container-d', 'cri-o']       - name: \u0418\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0430 \u0434\u043b\u044f \u0434\u0432\u0438\u0436\u043a\u0430 ['docker']       shell: |         kubeadm init \\                 --cri-socket unix:\/\/\/var\/run\/cri-dockerd.sock \\                 --pod-network-cidr=10.244.0.0\/16 \\                 --control-plane-endpoint \"172.30.0.210:8888\" \\                 --upload-certs       register: init_output_docker       when: engine == 'docker'      - name: \u0421\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f init_output \u0434\u043b\u044f \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f       set_fact:         init_output: \"{{ init_output_containerd_crio if init_output_containerd_crio is defined and init_output_containerd_crio.stdout is defined else init_output_docker }}\"      - name: \u0424\u0438\u043b\u044c\u0442\u0440\u0430\u0446\u0438\u044f \u0432\u044b\u0432\u043e\u0434\u0430 kubeadm init       set_fact:         filtered_output: \"{{ init_output.stdout | regex_replace('(\\\\n|\\\\t|\\\\\\\\n|\\\\\\\\)', ' ') }}\"      - name: \u0424\u0438\u043b\u044c\u0442\u0440 \u043a\u043e\u043c\u043c\u0430\u043d\u0434 \u0434\u043b\u044f \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u044e\u0449\u0438\u0445 \u0438 \u0440\u0430\u0431\u043e\u0447\u0438\u0445 \u043d\u043e\u0434       set_fact:         control_plane_join_command: \"{{ filtered_output | regex_search('kubeadm join(.*?--discovery-token-ca-cert-hash\\\\s+sha256:[\\\\w:]+.*?--control-plane.*?--certificate-key.*?[\\\\w:]+)')}}\"         worker_join_command: \"{{ filtered_output | regex_search('kubeadm join(.*?--discovery-token-ca-cert-hash\\\\s+sha256:[\\\\w:]+)')}}\"      - name: \u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 KUBECONFIG \u0432 enviroment       lineinfile:         dest: \/etc\/environment         line: 'export KUBECONFIG=\/etc\/kubernetes\/admin.conf'      - name: \u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 KUBECONFIG \u0432 bashrc       lineinfile:         dest: '~\/.bashrc'         line: 'export KUBECONFIG=\/etc\/kubernetes\/admin.conf'      - name: \u041f\u043e\u0434\u043e\u0436\u0434\u0435\u043c \u043f\u043e\u043a\u0430 \u0432\u0441\u0451 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u0441\u044f       wait_for:         host: localhost         port: 6443         timeout: 300      - name: \u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u0441\u0435\u0442\u0435\u0432\u043e\u0433\u043e \u043f\u043b\u0430\u0433\u0438\u043d\u0430 Flannel       shell: kubectl apply -f https:\/\/raw.githubusercontent.com\/coreos\/flannel\/master\/Documentation\/kube-flannel.yml    when: not file_info.stat.exists<\/code><\/pre>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0443\u0441\u043f\u0435\u0448\u043d\u043e\u0439 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0430 \u0438 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u043a\u043e\u043c\u0430\u043d\u0434 \u0434\u043b\u044f \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043d\u043e\u0434, \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u044d\u0442\u0438 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u0447\u0442\u043e\u0431\u044b \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u044e\u0449\u0438\u0435 \u0438 \u0440\u0430\u0431\u043e\u0447\u0438\u0435 \u043d\u043e\u0434\u044b. <\/p>\n<p>\u0418 \u0441\u043d\u043e\u0432\u0430 \u0432\u0435\u0442\u0432\u043b\u0435\u043d\u0438\u0435 \u0438\u0431\u043e \u0443 \u0434\u043e\u043a\u0435\u0440\u0430 \u0435\u0441\u0442\u044c \u0434\u043e\u043f \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u043f\u0440\u0438 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0435.<\/p>\n<p>\u0415\u0441\u0442\u044c \u043d\u044e\u0430\u043d\u0441, \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u044e\u0449\u0438\u0435 \u043d\u043e\u0434\u044b \u0438\u043d\u043e\u0433\u0434\u0430 \u043f\u043e \u043d\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043d\u043e\u0439 \u043c\u043d\u0435 \u043f\u0440\u0438\u0447\u0438\u043d\u0435 \u043d\u0435 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u043b\u0438\u0441\u044c. \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u043f\u0440\u0438 \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u043e\u043c \u0437\u0430\u043f\u0443\u0441\u043a\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u0432\u0441\u0451 \u043f\u0440\u043e\u0445\u043e\u0434\u0438\u043b\u043e \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u044f \u0434\u043e\u0431\u0430\u0432\u0438\u043b 5 \u043f\u043e\u043f\u044b\u0442\u043e\u043a \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f. \u043e\u0431\u044b\u0447\u043d\u043e \u0445\u0432\u0430\u0442\u0430\u0435\u0442 \u0434\u0432\u0443\u0445.<\/p>\n<p>\u0421 \u0432\u043e\u0440\u043a\u0435\u0440\u0430\u043c\u0438 \u0442\u0430\u043a\u043e\u0433\u043e \u043d\u0435 \u043d\u0430\u0431\u043b\u044e\u0434\u0430\u043b\u043e\u0441\u044c, \u043e\u0434\u043d\u0430\u043a\u043e \u044f \u0432\u0441\u0451 \u0440\u0430\u0432\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u043b \u0442\u0435 \u0436\u0435 5 \u043f\u043e\u043f\u044b\u0442\u043e\u043a.<\/p>\n<p>\u0412\u043e\u0440\u043a\u0435\u0440 \u0438\u043b\u0438 \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u044e\u0449\u0430\u044f \u043d\u043e\u0434\u0430 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442\u0441\u044f \u0438\u0437 \u0433\u0440\u0443\u043f\u043f\u044b \u0432 inventory.<\/p>\n<p>\u0413\u043e\u0442\u043e\u0432\u043e, \u043f\u0435\u0440\u0435\u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u043c \u0432\u0441\u0435 \u043c\u0430\u0448\u0438\u043d\u044b \u0438 \u0436\u0434\u0435\u043c \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438.<\/p>\n<p>\u041f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 play \u0441\u043a\u043e\u043f\u0438\u0440\u0443\u0435\u0442 \u043a\u043e\u043d\u0444\u0438\u0433 \u0441 \u043f\u0435\u0440\u0432\u043e\u0439 \u043d\u043e\u0434\u044b \u043d\u0430 \u0432\u0430\u0448\u0443 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u0443\u044e \u043c\u0430\u0448\u0438\u043d\u0443. \u0447\u0442\u043e\u0431\u044b \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u043e\u043c \u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0441 \u0445\u043e\u0441\u0442\u0430. \u043e\u043d \u0442\u0430\u043a \u0436\u0435 \u043e\u043f\u0446\u0438\u043e\u043d\u0430\u043b\u0435\u043d, \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u0437\u0430\u0439\u0442\u0438 \u043d\u0430 \u043f\u0435\u0440\u0432\u0443\u044e \u043d\u043e\u0434\u0443 \u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c \u0434\u0435\u043f\u043b\u043e\u0438 \u043e\u0442\u0442\u0443\u0434\u0430.<\/p>\n<pre><code class=\"yaml\">- name: \u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u0445\u043e\u0441\u0442\u043e\u0432\u043e\u0439 \u043c\u0430\u0448\u0438\u043d\u044b, \u0447\u0442\u043e\u0431\u044b \u043d\u0435 \u043b\u0430\u0437\u0438\u0442\u044c \u043f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u043e \u043d\u0430 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0435.   hosts: localhost   gather_facts: false   tasks:     - name: \u041f\u0435\u0440\u0435\u043c\u0435\u0441\u0442\u0438\u0442\u044c \u0444\u0430\u0439\u043b       ansible.builtin.file:         src: \/tmp\/admin.conf         dest: \/etc\/kubernetes\/admin.conf         state: link         force: yes       become: true      - name: \u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 KUBECONFIG \u0432 enviroment       lineinfile:         dest: \/etc\/environment         line: 'export KUBECONFIG=\/etc\/kubernetes\/admin.conf'      - name: \u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 KUBECONFIG \u0432 bashrc       lineinfile:         dest: '~\/.bashrc'         line: 'export KUBECONFIG=\/etc\/kubernetes\/admin.conf'<\/code><\/pre>\n<p>\u0411\u043e\u043d\u0443\u0441\u043e\u043c \u0438\u0434\u0451\u0442 \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u0441\u0442\u0435\u043d\u0434\u0430. \u0440\u0430\u0437 \u043e\u043d \u0431\u044b\u0441\u0442\u0440\u043e \u0441\u043e\u0437\u0434\u0430\u0451\u0442\u0441\u044f \u0442\u043e \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0441\u0442\u0440\u043e \u0438 \u0438\u0441\u0447\u0435\u0437\u0430\u0442\u044c.<\/p>\n<p>\u0423\u0434\u0430\u043b\u044f\u044e\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0412\u041c \u0438\u0445 \u0434\u0438\u0441\u043a\u0438 \u0438 \u0441\u043d\u0430\u043f\u0448\u043e\u0442\u044b, \u0448\u0430\u0431\u043b\u043e\u043d\u044b \u0438 \u043e\u0431\u0440\u0430\u0437\u044b \u043e\u0441\u0442\u0430\u044e\u0442\u0441\u044f \u0432 \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0430\u0445 \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f<br \/>remove_stand.yml:<\/p>\n<pre><code class=\"yaml\">---   - name: \u0423\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u0441\u0442\u0435\u043d\u0434\u0430 kubernetes     hosts: localhost     become: true\u0441     vars_files:       - my_vars.yml     tasks:       - name: \u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0441\u043f\u0438\u0441\u043e\u043a \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0445 \u0412\u041c         community.libvirt.virt:           command: list_vms         register: existing_vms         changed_when: no        - name: \u0423\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u043c\u0430\u0448\u0438\u043d         block:           - name: \u041f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u043e\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c \u0412\u041c             community.libvirt.virt:               command: destroy               name: \"{{ item.name }}\"             loop: \"{{ vm_info.vm_names }}\"             when: \"item.name in existing_vms.list_vms\"             ignore_errors: true            - name: \u0423\u0434\u0430\u043b\u044f\u0435\u043c \u0441\u043d\u0430\u043f\u0448\u043e\u0442\u044b             shell: |               virsh snapshot-delete --domain {{ item.name }} --snapshotname host_provision               virsh snapshot-delete --domain {{ item.name }} --snapshotname driver_provision             ignore_errors: true             loop: \"{{ vm_info.vm_names }}\"             when: \"item.name in existing_vms.list_vms\"            - name: \u041e\u0442\u043c\u0435\u043d\u044f\u0435\u043c \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u044e \u0412\u041c             community.libvirt.virt:               command: undefine               name: \"{{ item.name }}\"             loop: \"{{ vm_info.vm_names }}\"             when: \"item.name in existing_vms.list_vms\"            - name: \u0423\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u0434\u0438\u0441\u043a\u0430 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0439 \u043c\u0430\u0448\u0438\u043d\u044b             ansible.builtin.file:               path: \"{{libvirt_pool_dir}}\/{{ item.name }}.qcow2\"               state: absent             loop: \"{{ vm_info.vm_names }}\"             when: \"item.name in existing_vms.list_vms\"<\/code><\/pre>\n<p>\u0412 \u0446\u0435\u043b\u043e\u043c \u0432\u0441\u0451 \u0433\u043e\u0442\u043e\u0432\u043e. \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c.<\/p>\n<p>\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u0441\u0442\u0435\u043d\u0434\u0430:<\/p>\n<pre><code class=\"bash\">ansible-playbook -K .\/setup_k8s.yaml -i .\/inventory --extra-vars \"@my_vars.yml\"<\/code><\/pre>\n<p>\u0423\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u0441\u0442\u0435\u043d\u0434\u0430:<\/p>\n<pre><code class=\"bash\">ansible-playbook -K .\/remove_stand.yml<\/code><\/pre>\n<p>\u0412 \u043e\u0431\u0449\u0435\u043c \u0438 \u0446\u0435\u043b\u043e\u043c \u044f \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u0435\u0440\u0435\u043d\u0451\u0441 \u0433\u043e\u0442\u043e\u0432\u044b\u0439 <a href=\"https:\/\/habr.com\/ru\/articles\/725640\/\" rel=\"noopener noreferrer nofollow\">\u0433\u0430\u0439\u0434<\/a> \u043d\u0430 \u0440\u0435\u043b\u044c\u0441\u044b \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0430\u0446\u0438\u0438, \u043e\u0442\u0441\u0435\u0431\u044f\u0442\u0438\u043d\u044b \u044f \u0434\u043e\u0431\u0430\u0432\u0438\u043b \u043f\u043e \u043c\u0438\u043d\u0438\u043c\u0443\u043c\u0443. \u0433\u0434\u0435 \u0442\u043e \u0438\u043d\u0430\u0447\u0435 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0438 \u0438 \u043a\u043b\u044e\u0447\u0438, \u0433\u0434\u0435 \u0442\u043e \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u044e \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u0438\u0437\u0430\u0446\u0438\u044e \u0432\u0440\u0435\u043c\u0435\u043d\u0438, \u0438\u0437 \u0437\u0430 \u0442\u043e\u0433\u043e \u0447\u0442\u043e \u043f\u0440\u0438 \u0432\u043e\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0438 \u0441\u043e \u0441\u043d\u0430\u043f\u0448\u043e\u0442\u0430 \u0443 \u043c\u0435\u043d\u044f \u043d\u0430\u0447\u0438\u043d\u0430\u043b\u0438\u0441\u044c \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u0441 \u043a\u043b\u044e\u0447\u0430\u043c\u0438 \u0438\u0437 \u0437\u0430 \u043d\u0435\u0432\u0435\u0440\u043d\u043e\u0439 \u0442\u0435\u043a\u0443\u0449\u0435\u0439 \u0434\u0430\u0442\u044b.<\/p>\n<p>\u0414\u043e\u0431\u0430\u0432\u043b\u044f\u044e <a href=\"https:\/\/github.com\/eldalex\/kvmlab\" rel=\"noopener noreferrer nofollow\">\u0441\u0441\u044b\u043b\u043a\u0443 <\/a>\u043d\u0430 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439 \u0441\u043e \u0432\u0441\u0435\u043c \u044d\u0442\u0438\u043c \u0434\u043e\u0431\u0440\u043e\u043c. <\/p>\n<p>\u0412 \u0440\u0435\u0448\u0435\u043d\u0438\u0438 \u044f \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u043b \u043c\u043d\u043e\u0433\u043e \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f ansible, \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u043e\u0432, \u0446\u0438\u043a\u043b\u044b, \u0432\u0435\u0442\u0432\u043b\u0435\u043d\u0438\u044f, \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u0438 \u043f\u0440\u043e\u0447\u0438\u0435 \u043a\u0438\u0440\u043f\u0438\u0447\u0438 \u0438\u0437 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0432\u044b\u0440\u0430\u0441\u0442\u0430\u0435\u0442 \u0441\u0438\u0441\u0442\u0435\u043c\u0430.<\/p>\n<p>\u0411\u0443\u0434\u0443 \u0440\u0430\u0434 \u0435\u0441\u043b\u0438 \u0432\u044b \u043f\u043e\u0434\u0441\u043a\u0430\u0436\u0435\u0442\u0435 \u043a\u0430\u043a\u0438\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0431\u044b\u043b\u0438 \u0443\u0434\u0430\u0447\u043d\u044b\u043c\u0438, \u0430 \u043a\u0430\u043a\u0438\u0435 \u043d\u0435 \u043e\u0447\u0435\u043d\u044c. \u044d\u0442\u0430 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u0431\u0443\u0434\u0435\u0442 \u043e\u0447\u0435\u043d\u044c \u043f\u043e\u043b\u0435\u0437\u043d\u0430 \u0434\u043b\u044f \u043c\u0435\u043d\u044f.<\/p>\n<p>\u0421\u043f\u0430\u0441\u0438\u0431\u043e \u0447\u0442\u043e \u043e\u0441\u0438\u043b\u0438\u043b\u0438 \u0438 \u043f\u0440\u043e\u0447\u043b\u0438 \u0434\u043e \u043a\u043e\u043d\u0446\u0430!) <\/p>\n<p>\u041e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u0435 \u0441\u043f\u0430\u0441\u0438\u0431\u043e <a class=\"mention\" href=\"\/users\/imbasoft\">@imbasoft<\/a> \u0437\u0430 \u043e\u0442\u043b\u0438\u0447\u043d\u0443\u044e \u0438 \u043f\u043e\u043d\u044f\u0442\u043d\u0443\u044e \u0441\u0442\u0430\u0442\u044c\u044e.<\/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\/751582\/\"> https:\/\/habr.com\/ru\/articles\/751582\/<\/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>\u041c\u0435\u043d\u044f \u0437\u0430\u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043e\u0432\u0430\u043b\u0430 \u0442\u0435\u043c\u0430 Kubernetes, \u0438 \u044f \u0440\u0435\u0448\u0438\u043b \u043e\u0441\u0432\u043e\u0438\u0442\u044c \u0435\u0433\u043e. \u041d\u0430 \u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e\u043c \u044d\u0442\u0430\u043f\u0435 \u0432\u0441\u0435 \u0448\u043b\u043e \u0445\u043e\u0440\u043e\u0448\u043e, \u043f\u043e\u043a\u0430 \u044f \u0438\u0437\u0443\u0447\u0430\u043b \u0442\u0435\u043e\u0440\u0438\u044e.<\/p>\n<p>\u041e\u0434\u043d\u0430\u043a\u043e \u043a\u0430\u043a \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u0435\u043b\u043e \u0434\u043e\u0448\u043b\u043e \u0434\u043e \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0438 \u0432\u043d\u0435\u0437\u0430\u043f\u043d\u043e \u0432\u044b\u044f\u0441\u043d\u0438\u043b\u043e\u0441\u044c \u0447\u0442\u043e \u043f\u043e \u043a\u0430\u043a\u0438\u043c \u0442\u043e \u043f\u0440\u0438\u0447\u0438\u043d\u0430\u043c \u0441\u0430\u043c\u043e\u0435 \u0431\u044b\u0441\u0442\u0440\u043e\u0435 \u0438 \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0451\u043d\u043d\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 minicube \u043f\u0440\u043e\u0441\u0442\u043e \u043e\u0442\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0440\u0430\u0437\u0432\u043e\u0440\u0430\u0447\u0438\u0432\u0430\u0442\u044c\u0441\u044f \u043d\u0430 \u043c\u043e\u0435\u0439 Fedora. \u0420\u0430\u0437\u0432\u043e\u0440\u0430\u0447\u0438\u0432\u0430\u043d\u0438\u0435 \u043f\u0440\u043e\u0441\u0442\u043e \u0437\u0430\u0432\u0438\u0441\u0430\u043b\u043e \u043d\u0430 \u043e\u0434\u043d\u043e\u043c \u0438\u0437 \u044d\u0442\u0430\u043f\u043e\u0432.\u00a0\u041f\u0440\u0438\u0447\u0438\u043d\u0430\u00a0\u043f\u043e\u0434\u043e\u0437\u0440\u0435\u0432\u0430\u044e \u0431\u044b\u043b\u0430\u00a0\u0432 \u043d\u0435 \u043e\u0442\u043a\u043b\u044e\u0447\u0435\u043d\u043d\u043e\u043c \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e swap \u0440\u0430\u0437\u0434\u0435\u043b\u0435, \u043d\u043e \u043d\u0430 \u0442\u043e\u0442 \u043c\u043e\u043c\u0435\u043d\u0442 \u044f \u043d\u0435 \u0434\u043e\u0434\u0443\u043c\u0430\u043b. <\/p>\n<p>\u041f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0432 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u0432 \u0441 \u0440\u0430\u0437\u043d\u044b\u043c\u0438 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u043c\u0438 \u043c\u0430\u0448\u0438\u043d\u0430\u043c\u0438, \u044f \u0440\u0435\u0448\u0438\u043b \u0447\u0442\u043e \u0440\u0430\u0437 \u043d\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 minicube,\u00a0\u0437\u043d\u0430\u0447\u0438\u0442 \u043d\u0430\u0434\u043e \u0440\u0430\u0437\u0432\u0435\u0440\u043d\u0443\u0442\u044c \u0431\u043e\u043b\u0435\u0435 \u043a\u043e\u043c\u043f\u043b\u0435\u043a\u0441\u043d\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435.\u00a0\u041f\u043e\u0434\u0443\u043c\u0430\u043b\u00a0\u0438 \u043f\u043e\u043b\u0435\u0437 \u0432 \u0438\u043d\u0442\u0435\u0440\u043d\u0435\u0442. \u041f\u043e\u0441\u043b\u0435 \u043f\u0440\u043e\u0447\u0442\u0435\u043d\u0438\u044f \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u0441\u0442\u0430\u0442\u0435\u0439 \u043d\u0430 \u043d\u0430\u0448\u0435\u043c \u0440\u0435\u0441\u0443\u0440\u0441\u0435 \u044f \u0440\u0435\u0448\u0438\u043b \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c\u0441\u044f \u043d\u0430 \u044d\u0442\u043e\u0439: <\/p>\n<p><a class=\"mention\" href=\"\/users\/imbasoft\">@imbasoft<\/a>   &#171;<a href=\"https:\/\/habr.com\/ru\/articles\/725640\/\" rel=\"noopener noreferrer nofollow\">\u0413\u0430\u0439\u0434 \u0434\u043b\u044f \u043d\u043e\u0432\u0438\u0447\u043a\u043e\u0432 \u043f\u043e \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0435 Kubernetes<\/a>&#187;\u00a0  <\/p>\n<p>\u0412 \u043d\u0435\u0439 \u0431\u044b\u043b\u043e \u0432\u0441\u0451 \u0440\u0430\u0437\u043b\u043e\u0436\u0435\u043d\u043e \u043f\u043e \u043f\u043e\u043b\u043e\u0447\u043a\u0430\u043c, \u0432\u0441\u0435 \u0448\u0430\u0433\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u043b\u0438\u0441\u044c \u043b\u0435\u0433\u043a\u043e \u0438 \u043d\u0435\u043f\u0440\u0438\u043d\u0443\u0436\u0434\u0451\u043d\u043d\u043e.\u00a0\u0412\u00a0\u043a\u043e\u043d\u0446\u0435 \u043f\u043e\u043b\u0443\u0447\u0430\u043b\u0441\u044f \u0437\u0430\u043c\u0435\u0447\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u0441\u0442\u0435\u043d\u0434 \u0434\u043b\u044f \u0442\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u043e\u043a.\u00a0\u041f\u0440\u0438\u0447\u0435\u043c\u00a0\u0441\u0442\u0435\u043d\u0434 \u0432\u0430\u0440\u0438\u0430\u0442\u0438\u0432\u043d\u044b\u0439, \u0441 \u0440\u0430\u0437\u043d\u044b\u043c\u0438 \u0434\u0432\u0438\u0436\u043a\u0430\u043c\u0438 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0438\u0437\u0430\u0446\u0438\u0438, \u0438 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0430\u043c\u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u00a0\u043a\u0430\u043a \u0430\u043d\u0430\u043b\u043e\u0433 \u043c\u0438\u043d\u0438\u043a\u0443\u0431\u0430, \u0442\u0430\u043a \u0438\u00a0\u043f\u044f\u0442\u0438 \u0445\u043e\u0441\u0442\u043e\u0432\u044b\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u0441 \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u044e\u0449\u0438\u043c\u0438 \u0438 \u0440\u0430\u0431\u043e\u0447\u0438\u043c\u0438 \u043d\u043e\u0434\u0430\u043c\u0438.<\/p>\n<p>\u041d\u043e \u0441\u043c\u0443\u0449\u0430\u043b \u043c\u0435\u043d\u044f \u043e\u0434\u0438\u043d \u043c\u043e\u043c\u0435\u043d\u0442, \u0432 \u0441\u0442\u0430\u0442\u044c\u0435 \u0431\u044b\u043b\u043e \u043e\u043f\u0438\u0441\u0430\u043d\u043e \u0440\u0430\u0437\u0432\u0451\u0440\u0442\u044b\u0432\u0430\u043d\u0438\u0435 \u0441\u043e \u043c\u043d\u043e\u0433\u0438\u043c\u0438\u00a0\u0441\u043d\u0430\u043f\u0448\u043e\u0442\u0430\u043c\u0438, \u0447\u0442\u043e\u0431\u044b \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0432\u0435\u0440\u043d\u0443\u0442\u044c\u0441\u044f \u0438 \u043f\u0435\u0440\u0435\u0438\u0433\u0440\u0430\u0442\u044c\u00a0\u043f\u043e-\u043d\u043e\u0432\u043e\u043c\u0443.<br \/>\u041a\u0430\u0436\u0434\u044b\u0439\u00a0\u0440\u0430\u0437 \u043e\u0442\u043a\u0430\u0442\u044b\u0432\u0430\u0442\u044c\u0441\u044f \u043f\u043e \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u043c \u043c\u0430\u0448\u0438\u043d\u0430\u043c \u043c\u043d\u0435 \u043d\u0435 \u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c.\u00a0\u0410\u00a0\u0440\u0430\u0437\u0432\u0435\u0440\u043d\u0443\u0442\u044c \u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c.<br \/>\u0420\u0435\u0448\u0435\u043d\u0438\u0435\u00a0\u043f\u0440\u0438\u0448\u043b\u043e \u0431\u044b\u0441\u0442\u0440\u043e. Ansible.\u00a0\u041c\u043e\u0436\u043d\u043e\u00a0\u0440\u0430\u0441\u043a\u0430\u0442\u044b\u0432\u0430\u0442\u044c\u0441\u044f \u0438\u00a0\u043f\u0435\u0440\u0435\u0440\u0430\u0441\u043a\u0430\u0442\u044b\u0432\u0430\u0442\u044c\u0441\u044f\u00a0\u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u00a0\u0431\u044b\u0441\u0442\u0440\u043e.\u00a0\u0412\u00a0\u043b\u044e\u0431\u043e\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u043c\u043e\u0436\u043d\u043e \u0443\u0434\u0430\u043b\u0438\u0442\u044c \u0441\u0442\u0435\u043d\u0434 \u0438 \u043d\u0430\u0447\u0430\u0442\u044c \u0437\u0430\u043d\u043e\u0432\u043e.  <\/p>\n<p>\u0414\u043e \u044d\u0442\u043e\u0433\u043e \u043d\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u043b \u0441 ansible, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u044d\u0442\u043e \u0442\u0430\u043a \u0436\u0435 \u043f\u043e\u043a\u0430\u0437\u0430\u043b\u043e\u0441\u044c \u043c\u043d\u0435 \u0432\u043f\u043e\u043b\u043d\u0435 \u043d\u0435\u043f\u043b\u043e\u0445\u043e\u0439 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u043e\u0439.<\/p>\n<p>\u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u043d\u0435 \u0441\u0430\u043c\u043e\u0435 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u0435, \u043d\u0430\u0434\u0435\u044e\u0441\u044c \u043b\u044e\u0434\u0438 \u0432\u00a0\u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u044f\u0445\u00a0\u043c\u0435\u043d\u044f \u043f\u043e\u043f\u0440\u0430\u0432\u044f\u0442 \u0438\u043b\u0438 \u043f\u043e\u0434\u0441\u043a\u0430\u0436\u0443\u0442 \u0431\u043e\u043b\u0435\u0435 \u0443\u0434\u0430\u0447\u043d\u044b\u0435 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u044b \u0440\u0435\u0448\u0435\u043d\u0438\u0439.\u00a0\u041d\u043e\u00a0\u043f\u043e\u043a\u0430 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u044e \u043d\u0430 \u0441\u0443\u0434 \u0442\u043e \u0447\u0442\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c \u0432 \u0438\u0442\u043e\u0433\u0435.<br \/>\u042f \u0437\u043d\u0430\u044e \u0447\u0442\u043e \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0442 \u0433\u043e\u0442\u043e\u0432\u044b\u0435 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u044b \u0442\u0438\u043f\u0430 kubespray, \u043d\u043e \u0442\u0443\u0442 \u0431\u043e\u043b\u044c\u0448\u0435 \u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u043f\u043e\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0438\u043c\u0435\u043d\u043d\u043e \u0441 ansible, \u0442\u0430\u043a \u0447\u0442\u043e \u044f \u0440\u0435\u0448\u0438\u043b \u043d\u0435 \u0443\u043f\u0443\u0441\u043a\u0430\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438.\u00a0\u0412\u00a0\u043b\u044e\u0431\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043d\u0435 \u043e\u0448\u0438\u0431\u0430\u0435\u0442\u0441\u044f \u0442\u043e\u0442, \u043a\u0442\u043e \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u0434\u0435\u043b\u0430\u0435\u0442, \u0442\u0430\u043a \u0447\u0442\u043e \u043b\u0443\u0447\u0448\u0435 \u044f\u00a0\u0434\u043e\u043f\u0443\u0449\u0443\u00a0\u0434\u0435\u0441\u044f\u0442\u043e\u043a \u043e\u0448\u0438\u0431\u043e\u043a \u043d\u043e\u0432\u0438\u0447\u043a\u0430, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0434\u0430\u0436\u0435 \u0443\u043a\u0430\u0436\u0443\u0442, \u0447\u0435\u043c \u0432\u043e\u043e\u0431\u0449\u0435 \u043d\u0435 \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u044e.<\/p>\n<p>\u0418\u0442\u0430\u043a, \u0441 \u0447\u0435\u0433\u043e \u043d\u0430\u0447\u0430\u0442\u044c?<\/p>\n<p>\u0412\u043e-\u043f\u0435\u0440\u0432\u044b\u0445\u00a0\u043d\u0430\u0434\u043e \u0431\u044b\u043b\u043e \u0432\u044b\u0431\u0440\u0430\u0442\u044c\u00a0\u0432\u0438\u0440\u0442\u0443\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e. KVM \u043f\u043e\u043a\u0430\u0437\u0430\u043b\u0441\u044f \u043c\u043d\u0435 \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u044b\u043c \u0440\u0435\u0448\u0435\u043d\u0438\u0435\u043c, \u043e\u043d \u043c\u043e\u0436\u043d\u043e \u0441\u043a\u0430\u0437\u0430\u0442\u044c \u0440\u043e\u0434\u043d\u043e\u0439 \u0434\u043b\u044f linux, \u0435\u0441\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0440\u0443\u043b\u0438\u0442\u044c \u0438\u0437 \u043a\u043e\u043c\u0430\u043d\u0434\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0438.<\/p>\n<p>\u042f \u043d\u0435 \u0431\u0443\u0434\u0443 \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c \u043a\u0430\u043a \u043d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0442\u044c KVM \u043d\u0430 \u043c\u0430\u0448\u0438\u043d\u0435 \u0438 \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0442\u044c ansible, \u0441\u0442\u0430\u0442\u044c\u044f \u043d\u0435 \u043e\u0431 \u044d\u0442\u043e\u043c.\u00a0\u041f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0438\u043c\u00a0\u0447\u0442\u043e \u0443 \u0432\u0430\u0441 \u0443\u0436\u0435 \u0432\u0441\u0451 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043e.<\/p>\n<p>\u041a\u0430\u043a \u044f \u0443\u0436\u0435 \u043d\u0430\u043f\u0438\u0441\u0430\u043b, \u043e\u043f\u044b\u0442\u0430 \u0441 ansible \u0443 \u043c\u0435\u043d\u044f \u043d\u0435 \u043c\u043d\u043e\u0433\u043e, \u043d\u043e \u0434\u0430\u0436\u0435 \u0441 \u043d\u0438\u043c \u044f \u043f\u043e\u043d\u0438\u043c\u0430\u044e \u0447\u0442\u043e \u043f\u0438\u0441\u0430\u0442\u044c \u043e\u0434\u043d\u0443 \u0431\u043e\u043b\u044c\u0448\u0443\u044e \u043f\u0440\u043e\u0441\u0442\u044b\u043d\u044e \u043a\u043e\u0434\u0430 \u043d\u0435 \u043e\u0441\u043e\u0431\u043e \u0443\u0434\u043e\u0431\u043d\u043e, \u0430 \u043e\u0442\u043b\u0430\u0436\u0438\u0432\u0430\u0442\u044c \u0438 \u0442\u043e\u0433\u043e \u0445\u0443\u0436\u0435.\u00a0\u0411\u044b\u043b\u043e\u00a0\u0440\u0435\u0448\u0435\u043d\u043e \u0440\u0430\u0437\u0431\u0438\u0442\u044c \u0435\u0451 \u043d\u0430 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u043e\u0441\u0442\u044b\u043d\u0435\u0439 \u043f\u043e\u043c\u0435\u043d\u044c\u0448\u0435 \u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u043e\u043c \u0440\u043e\u043b\u0435\u0439.<\/p>\n<p>\u0412\u00a0\u0446\u0435\u043b\u043e\u043c \u0435\u0441\u043b\u0438 \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b\u044c\u043d\u0443\u044e \u0441\u0442\u0430\u0442\u044c\u044e \u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0432\u044b\u0434\u0435\u043b\u0438\u0442\u044c 3 \u044d\u0442\u0430\u043f\u0430:<br \/>1) \u041f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0430 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0445 \u043c\u0430\u0448\u0438\u043d<br \/>2) \u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u0434\u0432\u0438\u0436\u043a\u0430 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0438\u0437\u0430\u0446\u0438\u0438<br \/>3) \u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 all_in_one\/ha_cluster<\/p>\n<p>\u0418\u0441\u0445\u043e\u0434\u044f \u0438\u0437 \u044d\u0442\u043e\u0433\u043e \u0431\u0443\u0434\u0435\u043c \u0433\u043e\u0442\u043e\u0432\u0438\u0442\u044c 4 \u0440\u043e\u043b\u0438 \u0441\u043e \u0441\u0432\u043e\u0438\u043c\u0438 \u0442\u0430\u0441\u043a\u0430\u043c\u0438.<br \/>&#8212; vm_provision<br \/>&#8212; driver_provision<br \/>&#8212; k8s_all_in_one<br \/>&#8212; k8s_ha_cluster <\/p>\n<p>\u0421\u043e\u0437\u0434\u0430\u0451\u043c\u00a0\u043a\u0430\u0442\u0430\u043b\u043e\u0433, \u0443 \u043c\u0435\u043d\u044f \u043e\u043d \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f kvmlab, \u0438 \u0432 \u043d\u0435\u043c \u0444\u0430\u0439\u043b setup_k8s.yaml<\/p>\n<p>\u042d\u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u0433\u043b\u0430\u0432\u043d\u044b\u0439\u00a0playbook, \u0438\u0437 \u043d\u0435\u0433\u043e \u0431\u0443\u0434\u0443\u0442 \u043f\u043e\u0434\u0442\u044f\u0433\u0438\u0432\u0430\u0442\u044c\u0441\u044f \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0435 \u043f\u043e \u043c\u0435\u0440\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438. T\u0430\u043a \u0436\u0435 \u043d\u0430\u043c \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f inventory \u0438 \u0444\u0430\u0439\u043b \u0441 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u043c\u0438 \u043a\u043e\u0442\u043e\u0440\u044b\u043c\u0438 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u0440\u0430\u0437\u0432\u0451\u0440\u0442\u044b\u0432\u0430\u043d\u0438\u0435\u043c.  \u041d\u0443 \u0438 \u043a\u043e\u043d\u0435\u0447\u043d\u043e \u0436\u0435 \u0440\u043e\u043b\u0438. <\/p>\n<p>\u0412 \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u043c, \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0440\u043e\u043b\u0435\u0439.<\/p>\n<pre><code class=\"bash\">ansible-galaxy role init vm_provision ansible-galaxy role init driver_provision ansible-galaxy role init k8s_ha_cluster ansible-galaxy role init k8s_all_in_one<\/code><\/pre>\n<p>\u0424\u0430\u0439\u043b inventory \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442 \u043d\u0430\u0448\u0438 ansible_host \u0434\u043b\u044f \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f:<\/p>\n<pre><code class=\"yaml\">all:   children:     management:       hosts:         node1:           ansible_host: 172.30.0.201         node2:           ansible_host: 172.30.0.202         node3:           ansible_host: 172.30.0.203     workers:       hosts:         node4:           ansible_host: 172.30.0.204         node5:           ansible_host: 172.30.0.205<\/code><\/pre>\n<p>my_vars.yml \u043a\u0430\u043a \u0432\u0438\u0434\u043d\u043e \u0438\u0437 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044f \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435, \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0440\u0430\u0437\u0432\u0435\u0440\u0442\u044b\u0432\u0430\u043d\u0438\u044f, \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0445 \u043c\u0430\u0448\u0438\u043d, \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0438 \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f iso \u0438 \u0434\u0438\u0441\u043a\u043e\u0432 VM:<\/p>\n<pre><code class=\"yaml\">variant: all-in-one #[all-in-one, ha-cluster] engine: cri-o #[container-d, cri-o, docker] libvirt_pool_dir: \"\/home\/alex\/myStorage\/storage_for_VMss\" libvirt_pool_images: \"\/home\/alex\/myStorage\/iso_imagess\" vm_net: k8s_net ssh_key: \"\/home\/alex\/.ssh\/id_rsa.pub\" ansible_ssh_common_args: \"-o StrictHostKeyChecking=no\" version: \"1.26\" os: \"Debian_11\" vm_info:   vm_names:     - name: node1       memory: 2048       cpu: 2       ipaddr: 172.30.0.201     - name: node2       memory: 2048       cpu: 2       ipaddr: 172.30.0.202     - name: node3       memory: 2048       cpu: 2       ipaddr: 172.30.0.203     - name: node4       memory: 3072       cpu: 4       ipaddr: 172.30.0.204     - name: node5       memory: 3072       cpu: 4       ipaddr: 172.30.0.205<\/code><\/pre>\n<p>\u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u0447\u0443\u0442\u044c \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435:<\/p>\n<p>variant &#8212; \u044d\u0442\u043e \u043d\u0430\u0448 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u0431\u0443\u0434\u0435\u043c \u043b\u0438 \u043c\u044b \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0442\u044c \u043a\u043b\u0430\u0441\u0442\u0435\u0440 \u0438\u043b\u0438 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0438\u043c\u0441\u044f \u043e\u0434\u043d\u043e\u0439 \u043c\u0430\u0448\u0438\u043d\u043e\u0439 \u0438 \u0441\u0434\u0435\u043b\u0430\u0435\u043c \u0430\u043d\u0430\u043b\u043e\u0433 minikube.<\/p>\n<p>engine &#8212; \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0434\u0432\u0438\u0436\u043e\u043a \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0438\u0437\u0430\u0446\u0438\u0438<\/p>\n<p>libvirt_pool_dir \u0438 libvirt_pool_images \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0438 \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0434\u0438\u0441\u043a\u043e\u0432 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0445 \u043c\u0430\u0448\u0438\u043d \u0438 \u0441\u043a\u0430\u0447\u0430\u043d\u043d\u044b\u0445 \u043e\u0431\u0440\u0430\u0437\u043e\u0432 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e.<\/p>\n<p>vm_net &#8212; \u0438\u043c\u044f \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0435\u043c\u043e\u0439 \u0441\u0435\u0442\u0438 \u0434\u043b\u044f \u0432\u0430\u0448\u0438\u0445 \u043c\u0430\u0448\u0438\u043d.<\/p>\n<p>ssh_key &#8212; \u0432\u0430\u0448 \u043f\u0443\u0431\u043b\u0438\u0447\u043d\u044b\u0439 \u043a\u043b\u044e\u0447, \u043f\u043e\u0434\u043a\u0438\u0434\u044b\u0432\u0430\u0435\u0442\u0441\u044f   \u043d\u0430 \u0412\u041c \u0432 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0438 \u0438 \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0438\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u044e\u0442\u0441\u044f \u0432\u0430\u0448\u0438\u043c \u043b\u043e\u0433\u0438\u043d\u043e\u043c \u0438\u0437 \u043f\u043e\u0434 root.<\/p>\n<p>ansible_ssh_common_args &#8212; \u043e\u0442\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u0445\u0435\u0448\u0430 \u043a\u043b\u044e\u0447\u0430.<\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0432\u0435\u0440\u043d\u0435\u043c\u0441\u044f \u043a setup_k8s.yaml:<br \/> \u041f\u0435\u0440\u0432\u044b\u0439 play \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u043d\u0430 localhost, \u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u043f\u043e\u0432\u044b\u0448\u0435\u043d\u043d\u044b\u0445 \u043f\u0440\u0430\u0432 \u0438 \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0438\u0437 6 task:<\/p>\n<ol>\n<li>\n<p>\u041f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0430 \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u044f &#8212; \u043d\u0430 \u044d\u0442\u043e\u043c \u044d\u0442\u0430\u043f\u0435 \u043c\u044b \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u043f\u0430\u043a\u0435\u0442\u044b \u0434\u043b\u044f \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f libvirt<\/p>\n<\/li>\n<li>\n<p>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u0441\u0435\u0442\u0438 &#8212; \u043c\u0430\u0448\u0438\u043d\u044b \u0431\u0443\u0434\u0443\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u0432\u043e\u044e \u0441\u0435\u0442\u044c, \u043d\u043e \u0435\u0451 \u043d\u0430\u0434\u043e \u043f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c.<\/p>\n<\/li>\n<li>\n<p>\u041f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0430 \u0448\u0430\u0431\u043b\u043e\u043d\u0430 \u0434\u043b\u044f \u0412\u041c &#8212; \u0432\u0441\u0435 \u043c\u0430\u0448\u0438\u043d\u044b \u0431\u0443\u0434\u0443\u0442 \u0441 \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u043e\u0439 OS, \u0432 \u043c\u043e\u0451\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0441 debian 11, \u0443 \u043d\u0438\u0445 \u0431\u0443\u0434\u0435\u0442 \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b\u0439 \u043d\u0430\u0431\u043e\u0440 \u043d\u0430\u0447\u0430\u043b\u044c\u043d\u044b\u0445 \u043f\u0430\u043a\u0435\u0442\u043e\u0432. \u041a\u0430\u0436\u0434\u044b\u0439 \u0440\u0430\u0437 \u0440\u0430\u0437\u0432\u043e\u0440\u0430\u0447\u0438\u0432\u0430\u0442\u044c \u0441 \u043d\u0443\u043b\u044f \u0434\u043e\u043b\u0433\u043e, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043d\u0430\u0434\u043e \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u0438\u0442\u044c \u0448\u0430\u0431\u043b\u043e\u043d VM \u0438 \u043f\u0435\u0440\u0435\u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0435\u0433\u043e \u043f\u0440\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438.<\/p>\n<\/li>\n<li>\n<p>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0412\u041c \u043d\u043e\u0434 \u0438\u0437 \u0448\u0430\u0431\u043b\u043e\u043d\u043d\u043e\u0433\u043e \u043e\u0431\u0440\u0430\u0437\u0430. \u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043d\u0443\u0436\u043d\u043e\u0433\u043e \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 VM \u0434\u043b\u044f \u0440\u0430\u0437\u0432\u0435\u0440\u0442\u044b\u0432\u0430\u043d\u0438\u044f.<\/p>\n<\/li>\n<li>\n<p>\u041f\u0435\u0440\u0435\u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0430 \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u0445 \u043c\u0430\u0448\u0438\u043d<\/p>\n<\/li>\n<li>\n<p>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0441\u043d\u0430\u043f\u0448\u043e\u0442\u0430. \u042d\u0442\u0430 \u0442\u0430\u0441\u043a\u0430 \u043e\u043f\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u0430, \u043f\u0440\u0438 \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u043c \u0440\u0430\u0437\u0432\u0451\u0440\u0442\u044b\u0432\u0430\u043d\u0438\u0438 \u0447\u0430\u0441\u0442\u043e \u0441\u043b\u0443\u0447\u0430\u043b\u0438\u0441\u044c \u043e\u0448\u0438\u0431\u043a\u0438 \u0438 \u043d\u0430\u0434\u043e \u0431\u044b\u043b\u043e \u043d\u0430\u0447\u0438\u043d\u0430\u0442\u044c \u0441\u043d\u0430\u0447\u0430\u043b\u0430, \u0441\u043d\u0430\u043f\u0448\u043e\u0442 \u0440\u0435\u0448\u0430\u043b \u044d\u0442\u0443 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443. \u0432 \u0446\u0435\u043b\u043e\u043c \u0441\u0435\u0439\u0447\u0430\u0441 \u043e\u043d \u0443\u0436\u0435 \u043d\u0435 \u043d\u0443\u0436\u0435\u043d, \u043d\u043e \u044f \u043e\u0441\u0442\u0430\u0432\u0438\u043b. \u0414\u043b\u044f \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0438 \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0440\u043e\u043b\u044c vm_provision \u043e \u043d\u0435\u0439 \u0447\u0443\u0442\u044c \u043f\u043e\u0437\u0436\u0435, \u0430 \u0441\u0435\u0439\u0447\u0430\u0441 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430 \u0442\u043e \u0447\u0442\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c: <\/p>\n<\/li>\n<\/ol>\n<p>kvmlab\/setup_k8s.yaml:<\/p>\n<pre><code class=\"yaml\">--- - name: \u041f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0430 \u0412\u041c \u043a \u0440\u0430\u0437\u0432\u0451\u0440\u0442\u044b\u0432\u0430\u043d\u0438\u044e k8s   hosts: localhost   gather_facts: yes   become: yes   tasks:     - name: \u041f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0430 \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u044f       package:         name:           - libguestfs-tools           - python3-libvirt         state: present      - name: \u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u0441\u0435\u0442\u0438       include_role:         name: vm_provision         tasks_from: create_network.yml      - name: \u041f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0430 \u0448\u0430\u0431\u043b\u043e\u043d\u0430 \u0434\u043b\u044f \u0412\u041c       include_role:         name: vm_provision         tasks_from: prepare_images_for_cluster.yml      - name: \u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0412\u041c \u043d\u043e\u0434 \u0438\u0437 \u0448\u0430\u0431\u043b\u043e\u043d\u043d\u043e\u0433\u043e \u043e\u0431\u0440\u0430\u0437\u0430.       include_role:         name: vm_provision         tasks_from: create_nodes.yml       vars:         vm_name: \"{{ item.name }}\"         vm_vcpus: \"{{ item.cpu }}\"         vm_ram_mb: \"{{ item.memory }}\"         ipaddr: \"{{ item.ipaddr }}\"       with_items: \"{{ vm_info.vm_names }}\"       when: variant == 'ha-cluster' or (variant == 'all-in-one' and item.name == 'node1')      - name: \u041e\u0436\u0438\u0434\u0430\u043d\u0438\u0435 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u0432\u0441\u0435\u0445 \u0412\u041c \u0438\u0437 \u0441\u043f\u0438\u0441\u043a\u0430       wait_for:         host: \"{{ hostvars[item].ansible_host }}\"         port: 22         timeout: 300         state: started       when: variant == 'ha-cluster' or item == 'node1'       with_items: \"{{ groups['all'] }}\"      - name: \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u0441\u043d\u0438\u043c\u043e\u043a host_provision       include_role:         name: vm_provision         tasks_from: create_snapshot.yml       vars:         vm_name: \"{{ item.name }}\"         snapshot_name: \"host_provision\"         snapshot_description: \"\u041d\u043e\u0434\u0430 \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043b\u0435\u043d\u0430 \u043a \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0435 \u0434\u0432\u0438\u0436\u043a\u0430\"       when: variant == 'ha-cluster' or item.name == 'node1'       with_items: \"{{ vm_info.vm_names }}\"<\/code><\/pre>\n<p>\u0412\u0438\u0437\u0443\u0430\u043b\u044c\u043d\u043e \u043d\u0435 \u043c\u043d\u043e\u0433\u043e, \u0434\u0430\u0432\u0430\u0439 \u0440\u0430\u0437\u0431\u0435\u0440\u0451\u043c \u0447\u0442\u043e \u0441\u043a\u0440\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043f\u043e\u0434 include_role. <\/p>\n<p>\u0410 \u043f\u043e\u0434 \u0440\u043e\u043b\u044c\u044e \u0443 \u043d\u0430\u0441 \u0441\u043a\u0440\u044b\u0432\u0430\u0435\u0442\u0441\u044f:<\/p>\n<p>\u0414\u0435\u0444\u043e\u043b\u0442\u043d\u044b\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u043d\u0430 \u0441\u043b\u0443\u0447\u0430\u0439 \u0435\u0441\u043b\u0438 \u043a\u0430\u043a\u0438\u0435 \u0442\u043e \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u043d\u0435 \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u044b, \u043f\u043e \u0438\u0435\u0440\u0430\u0440\u0445\u0438\u0438 \u0435\u0441\u043b\u0438 \u043d\u0435 \u043e\u0448\u0438\u0431\u0430\u044e\u0441\u044c \u0441\u0442\u043e\u044f\u0442 \u0432 \u0441\u0430\u043c\u043e\u043c \u043d\u0438\u0437\u0443, \u0442.\u0435. \u0435\u0441\u043b\u0438 \u044d\u0442\u0438 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u043f\u0440\u0438\u043b\u0435\u0442\u044f\u0442 \u043e\u0442\u043a\u0443\u0434\u0430 \u043e\u0442 \u0435\u0449\u0435, \u0438\u0445 \u043f\u0440\u0438\u043e\u0440\u0438\u0442\u0435\u0442 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0448\u0435:<\/p>\n<p>kvmlab\/roles\/vm_provision\/defaults\/main.yml:<\/p>\n<pre><code class=\"yaml\">--- # defaults file for vm_provision base_image_name: debian-11-generic-amd64-20230124-1270.qcow2 base_image_url: https:\/\/cdimage.debian.org\/cdimage\/cloud\/bullseye\/20230124-1270\/{{ base_image_name }} base_image_sha: 8db9abe8e68349081cc1942a4961e12fb7f94f460ff170c4bdd590a9203fbf83 libvirt_pool_dir: \"\/var\/lib\/libvirt\/images\" libvirt_pool_images: \"\/var\/lib\/libvirt\/images\" vm_vcpus: 2 vm_ram_mb: 2048 vm_net: vmnet vm_root_pass: test123 ssh_key: \/root\/.ssh\/id_rsa.pub<\/code><\/pre>\n<p>2 \u0448\u0430\u0431\u043b\u043e\u043d\u0430:<\/p>\n<p>roles\/vm_provision\/templates\/<br \/> vm-template.xml.j2 &#8212; \u0428\u0430\u0431\u043b\u043e\u043d \u043f\u043e \u043a\u043e\u0442\u043e\u0440\u043e\u043c\u0443 \u0441\u043e\u0437\u0434\u0430\u0435\u0442\u0441\u044f \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u0430\u044f \u043c\u0430\u0448\u0438\u043d\u0430 \u0432 xml \u0444\u043e\u0440\u043c\u0430\u0442\u0435. \u043f\u0440\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0437\u0430\u043f\u043e\u043b\u043d\u044f\u044e\u0442\u0441\u044f \u0438\u0437 \u0437\u0430\u0434\u0430\u043d\u043d\u044b\u0445 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445.<br \/> vm_network.xml.j2  &#8212; \u0428\u0430\u0431\u043b\u043e\u043d \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0441\u0435\u0442\u0438 \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u0431\u0443\u0434\u0443\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c VM.<\/p>\n<p>\u042f \u043d\u0435 \u0431\u0443\u0434\u0443 \u0438\u0445 \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u0442\u044c, \u0432\u044b \u0441\u043c\u043e\u0436\u0435\u0442\u0435 \u0437\u0430\u0431\u0440\u0430\u0442\u044c \u0438\u0445 \u0432 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0438.<\/p>\n<p>\u041d\u0443 \u0438 \u043d\u0430\u043a\u043e\u043d\u0435\u0446 roles\/vm_provision\/tasks\/<\/p>\n<p>create_network.yml &#8212; \u043d\u0430\u0431\u043e\u0440 \u0437\u0430\u0434\u0430\u0447 \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0441\u0435\u0442\u0438<\/p>\n<p>create_nodes.yml &#8212; \u043d\u0430\u0431\u043e\u0440 \u0437\u0430\u0434\u0430\u0447 \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f\u00a0\u043d\u043e\u0434<\/p>\n<p>create_snapshot.yml &#8212; \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435\u00a0\u0441\u043d\u0430\u043f\u0448\u043e\u0442\u043e\u0432<\/p>\n<p>prepare_images_for_cluster.yml &#8212; \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0430 \u0448\u0430\u0431\u043b\u043e\u043d\u0430<\/p>\n<p>\u041d\u0430\u0447\u043d\u0435\u043c\u00a0\u0441 \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0438 \u0448\u0430\u0431\u043b\u043e\u043d\u0430:<br \/>\u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0438\u0437 4 \u0437\u0430\u0434\u0430\u0447:<\/p>\n<ol>\n<li>\n<p>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0430 \u0434\u043b\u044f \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u043e\u0431\u0440\u0430\u0437\u0430(\u0435\u0441\u043b\u0438 \u043a\u043e\u043d\u0435\u0447\u043d\u043e \u043e\u043d \u043d\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442)<\/p>\n<\/li>\n<li>\n<p>\u0421\u043a\u0430\u0447\u0438\u0432\u0430\u043d\u0438\u0435 \u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u0431\u0430\u0437\u043e\u0432\u043e\u0433\u043e \u043e\u0431\u0440\u0430\u0437\u0430.\u00a0\u041a\u0430\u0436\u0434\u044b\u0439\u00a0\u0440\u0430\u0437 \u043a\u0430\u0447\u0430\u0442\u044c \u0435\u0433\u043e \u043d\u0435\u0442 \u0441\u043c\u044b\u0441\u043b\u0430, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0441\u043a\u0430\u0447\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u043e\u0434\u0438\u043d \u0440\u0430\u0437, \u043f\u0440\u0438 \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u043e\u043c \u0437\u0430\u043f\u0443\u0441\u043a\u0435, \u0435\u0441\u043b\u0438 \u0444\u0430\u0439\u043b \u0443\u0436\u0435 \u043b\u0435\u0436\u0438\u0442 \u043d\u0430 \u043c\u0435\u0441\u0442\u0435 \u044d\u0442\u0430 \u0447\u0430\u0441\u0442\u044c \u0441\u043a\u0438\u043f\u0430\u0435\u0442\u0441\u044f.<\/p>\n<\/li>\n<li>\n<p>\u0411\u0430\u0437\u043e\u0432\u044b\u0439 \u043e\u0431\u0440\u0430\u0437 \u0443\u0436\u0435 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u043a \u0412\u041c \u0438 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u043d\u0438\u043c, \u043e\u0434\u043d\u0430\u043a\u043e \u0442\u043e\u0433\u0434\u0430 \u043e\u043d \u043f\u0435\u0440\u0435\u0441\u0442\u0430\u043d\u0435\u0442 \u0431\u044b\u0442\u044c \u0431\u0430\u0437\u043e\u0432\u044b\u043c, \u0430 \u0443\u0436\u0435 \u0431\u0443\u0434\u0435\u0442 \u043a\u0430\u0441\u0442\u043e\u043c\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u043c.\u00a0\u041e\u0441\u0442\u0430\u0432\u0438\u043c\u00a0\u0435\u0433\u043e \u043a\u0430\u043a \u0435\u0441\u0442\u044c, \u043d\u043e \u0441\u043a\u043e\u043f\u0438\u0440\u0443\u0435\u043c \u0435\u0433\u043e \u043a\u0430\u043a \u0448\u0430\u0431\u043b\u043e\u043d \u0434\u043b\u044f \u0412\u041c<\/p>\n<\/li>\n<li>\n<p>\u043f\u0435\u0440\u0432\u0438\u0447\u043d\u0430\u044f \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u0448\u0430\u0431\u043b\u043e\u043d\u0430. \u0427\u0430\u0441\u0442\u044c \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a \u0438 \u041f\u041e \u0434\u043b\u044f \u043b\u044e\u0431\u043e\u0433\u043e \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0430 \u0440\u0430\u0437\u0432\u0435\u0440\u0442\u044b\u0432\u0430\u043d\u0438\u044f \u0431\u0443\u0434\u0435\u0442 \u043e\u0434\u043d\u0430 \u0438 \u0442\u0430 \u0436\u0435.\u00a0\u041f\u043e\u044d\u0442\u043e\u043c\u0443\u00a0\u043f\u0440\u043e\u0449\u0435 \u043d\u0430\u043a\u0430\u0442\u0438\u0442\u044c \u0438\u0445 \u0441\u0440\u0430\u0437\u0443 \u0432 \u0448\u0430\u0431\u043b\u043e\u043d.\u00a0\u0422\u0430\u043a\u00a0\u0436\u0435 \u0437\u0430\u043f\u043e\u043b\u043d\u0438\u043c hosts,\u00a0\u043f\u043e-\u0445\u043e\u0440\u043e\u0448\u0435\u043c\u0443\u00a0\u0435\u0433\u043e \u0431\u044b \u0437\u0430\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0438 \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430\u00a0\u043d\u043e\u0434, \u043d\u043e \u044f \u043f\u0440\u043e\u043f\u0438\u0441\u0430\u043b 5 \u0448\u0442\u0443\u043a \u0441\u0440\u0430\u0437\u0443.\u00a0\u0421\u0438\u043b\u044c\u043d\u043e\u00a0\u043d\u0435 \u043c\u0435\u0448\u0430\u0435\u0442. <\/p>\n<\/li>\n<\/ol>\n<p>kvmlab\/roles\/vm_provision\/tasks\/prepare_images_for_cluster.yml:<\/p>\n<pre><code class=\"yaml\">--- # tasks file vm_provision, \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435<\/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-351053","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/351053","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=351053"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/351053\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=351053"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=351053"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=351053"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}