{"id":435987,"date":"2024-10-19T03:03:48","date_gmt":"2024-10-19T03:03:48","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=435987"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=435987","title":{"rendered":"<span>\u041a\u0430\u0440\u043c\u0430\u043d\u043d\u044b\u0439 Ansible \u0438 \u0437\u0430\u0449\u0438\u0442\u0430 \u043e\u0442 \u0431\u0440\u0443\u0442\u0444\u043e\u0440\u0441-\u0430\u0442\u0430\u043a<\/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<h2>\u0412\u0432\u0435\u0434\u0435\u043d\u0438\u0435<\/h2>\n<p>\u0417\u0434\u0440\u0430\u0432\u0441\u0442\u0432\u0443\u0439\u0442\u0435! \u0412 \u0441\u0432\u043e\u0435\u0439 \u043f\u0440\u043e\u0444\u0435\u0441\u0441\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0439 \u0434\u0435\u044f\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u044f \u0447\u0430\u0441\u0442\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u044e \u0441 \u0441\u0438\u0441\u0442\u0435\u043c\u0430\u043c\u0438, \u043d\u0430\u0445\u043e\u0434\u044f\u0449\u0438\u043c\u0438\u0441\u044f \u0432 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u0441\u0435\u0442\u044f\u0445, \u0438\u0437\u043e\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u043a\u0430\u043a \u0434\u0440\u0443\u0433 \u043e\u0442 \u0434\u0440\u0443\u0433\u0430, \u0442\u0430\u043a \u0438 \u043e\u0442 \u0418\u043d\u0442\u0435\u0440\u043d\u0435\u0442\u0430.<\/p>\n<p>\u0427\u0430\u0441\u0442\u043e \u044d\u0442\u0438 \u0441\u0435\u0442\u0438 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442 Linux-\u0445\u043e\u0441\u0442\u044b \u0441 \u0440\u0430\u0437\u043d\u043e\u043e\u0431\u0440\u0430\u0437\u043d\u044b\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u043e\u043c, \u043d\u043e, \u043a\u0430\u043a \u043f\u0440\u0430\u0432\u0438\u043b\u043e, \u0438\u043c\u0435\u044e\u0442 \u0440\u044f\u0434 \u043e\u0431\u0449\u0438\u0445 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0439. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u0442\u043e\u0447\u0435\u043a \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u043a \u043e\u0431\u0449\u0438\u043c \u0441\u0435\u0442\u0435\u0432\u044b\u043c \u043f\u0430\u043f\u043a\u0430\u043c, \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u044c, \u0437\u0435\u0440\u043a\u0430\u043b\u0430 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0435\u0432 \u0438 \u0434\u0440\u0443\u0433\u0438\u0435 \u0430\u0441\u043f\u0435\u043a\u0442\u044b \u2014 \u0432\u0441\u0435 \u044d\u0442\u043e \u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0437\u0430\u0442\u0440\u0430\u0442, \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u0441 \u0443\u0447\u0435\u0442\u043e\u043c \u0431\u043e\u043b\u044c\u0448\u043e\u0433\u043e \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u0442\u0430\u043a\u0438\u0445 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432.<\/p>\n<p>\u0414\u043b\u044f \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043c\u043d\u043e\u0433\u0438\u043c\u0438 Linux-\u0445\u043e\u0441\u0442\u0430\u043c\u0438 (\u0434\u0430 \u0438 Windows, \u043a\u0441\u0442\u0430\u0442\u0438, \u0442\u043e\u0436\u0435) \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u043e\u0442\u043b\u0438\u0447\u043d\u044b\u0439 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u044f \u043e\u0447\u0435\u043d\u044c \u043b\u044e\u0431\u043b\u044e \u2014 Ansible. \u041e\u0434\u043d\u0430\u043a\u043e \u0434\u043b\u044f \u0435\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0441\u0435\u0440\u0432\u0435\u0440, \u0441 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0431\u0443\u0434\u0443\u0442 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c\u0441\u044f \u043f\u043b\u0435\u0439\u0431\u0443\u043a\u0438. \u042d\u0442\u043e \u043f\u043e\u0434\u0440\u0430\u0437\u0443\u043c\u0435\u0432\u0430\u0435\u0442 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u044c \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0440\u0430\u0431\u043e\u0447\u0435\u0439 \u043c\u0430\u0448\u0438\u043d\u044b \u043d\u0430 Linux \u0438\u043b\u0438 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0439 \u043c\u0430\u0448\u0438\u043d\u044b.<\/p>\n<p>\u041d\u0435 \u0432\u0441\u0435\u0433\u0434\u0430 \u0443\u0434\u043e\u0431\u043d\u043e \u0438 \u0446\u0435\u043b\u0435\u0441\u043e\u043e\u0431\u0440\u0430\u0437\u043d\u043e \u043d\u043e\u0441\u0438\u0442\u044c \u0441 \u0441\u043e\u0431\u043e\u0439 \u043d\u043e\u0443\u0442\u0431\u0443\u043a, \u0438 \u044f \u043f\u0440\u0435\u0434\u043f\u043e\u0447\u0438\u0442\u0430\u044e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c Windows \u043d\u0430 \u0441\u0432\u043e\u0435\u043c \u0440\u0430\u0431\u043e\u0447\u0435\u043c \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0435, \u0445\u043e\u0442\u044f \u0445\u043e\u0440\u043e\u0448\u043e \u043e\u0440\u0438\u0435\u043d\u0442\u0438\u0440\u0443\u044e\u0441\u044c \u0432 \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b\u0435 Linux. \u042f \u0441\u0447\u0438\u0442\u0430\u044e, \u0447\u0442\u043e \u043e\u0442 \u043a\u0430\u0436\u0434\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u0441\u0442\u043e\u0438\u0442 \u0437\u0430\u0438\u043c\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u043b\u0443\u0447\u0448\u0435\u0435: Windows \u0434\u043b\u044f \u0434\u0435\u0441\u043a\u0442\u043e\u043f\u0430, \u0430 Linux \u2014 \u0434\u043b\u044f \u0441\u0435\u0440\u0432\u0435\u0440\u043e\u0432 \u0438 open-source \u0440\u0435\u0448\u0435\u043d\u0438\u0439 (\u044d\u0442\u043e \u043c\u043e\u0435 \u043b\u0438\u0447\u043d\u043e\u0435 \u043c\u043d\u0435\u043d\u0438\u0435, \u0438 \u044f \u0443\u0432\u0435\u0440\u0435\u043d, \u0447\u0442\u043e \u043c\u043d\u043e\u0433\u0438\u0435 \u0441 \u043d\u0438\u043c \u043d\u0435 \u0441\u043e\u0433\u043b\u0430\u0441\u044f\u0442\u0441\u044f, \u043d\u043e \u043e \u0432\u043a\u0443\u0441\u0430\u0445 \u043d\u0435 \u0441\u043f\u043e\u0440\u044f\u0442).<\/p>\n<p>\u041a\u0430\u043a \u0443\u043f\u0440\u043e\u0441\u0442\u0438\u0442\u044c \u0441\u0435\u0431\u0435 \u0436\u0438\u0437\u043d\u044c? \u041e\u0434\u0438\u043d \u0438\u0437 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u0432 \u2014 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c OrangePi, \u0430 \u0435\u0441\u043b\u0438 \u043d\u0435\u0442 \u0440\u0430\u0431\u043e\u0447\u0435\u0433\u043e \u043d\u043e\u0443\u0442\u0431\u0443\u043a\u0430, \u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u0432\u0441\u0435\u043c \u044d\u0442\u0438\u043c \u0441 \u043c\u043e\u0431\u0438\u043b\u044c\u043d\u043e\u0433\u043e \u0442\u0435\u043b\u0435\u0444\u043e\u043d\u0430. \u041a \u0441\u0447\u0430\u0441\u0442\u044c\u044e, \u0437\u0430\u043f\u0443\u0441\u043a \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0445 \u043f\u043b\u0435\u0439\u0431\u0443\u043a\u043e\u0432 \u043d\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0434\u0430\u0436\u0435 \u043d\u0430 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u043c \u044d\u043a\u0440\u0430\u043d\u0435 \u043c\u043e\u0431\u0438\u043b\u044c\u043d\u043e\u0433\u043e \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430.<\/p>\n<h2>\u0421\u043e\u0434\u0435\u0440\u0436\u0430\u043d\u0438\u0435:<\/h2>\n<ol>\n<li>\n<p>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 \u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0440\u043e\u043b\u0435\u0439 Ansible \u0434\u043b\u044f \u0434\u043b\u044f Debian-\u0445\u043e\u0441\u0442\u043e\u0432<\/p>\n<\/li>\n<li>\n<p>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0430 Ansible \u043d\u0430 Orange PI \u0438 \u0441\u043f\u0440\u044f\u0436\u0435\u043d\u0438\u0435 \u0435\u0433\u043e \u0441 \u043c\u043e\u0431\u0438\u043b\u044c\u043d\u044b\u043c \u0442\u0435\u043b\u0435\u0444\u043e\u043d\u043e\u043c<\/p>\n<\/li>\n<\/ol>\n<h4>\u0417\u0430\u0447\u0435\u043c \u044d\u0442\u043e \u043d\u0443\u0436\u043d\u043e?<\/h4>\n<p>\u041f\u043e\u0434\u044b\u0442\u043e\u0436\u0438\u043c \u0432\u044b\u0448\u0435\u0441\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u0435 \u0438 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043c\u0441\u044f, \u0447\u0435\u043c \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043f\u043e\u043b\u0435\u0437\u0435\u043d \u0442\u0430\u043a\u043e\u0439 \u043f\u0440\u043e\u0435\u043a\u0442:<\/p>\n<ul>\n<li>\n<p>\u041f\u0440\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0430\u0443\u0434\u0438\u0442\u0430 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0439 \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u0438<\/p>\n<\/li>\n<li>\n<p>\u0420\u0430\u0431\u043e\u0442\u0430 \u0441 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u043c\u0438, \u0438\u0437\u043e\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u043c\u0438 \u0434\u0440\u0443\u0433 \u043e\u0442 \u0434\u0440\u0443\u0433\u0430 \u0441\u0435\u0442\u044f\u043c\u0438<\/p>\n<\/li>\n<li>\n<p>\u0420\u0430\u0431\u043e\u0442\u0430 \u0432 \u0441\u0435\u0442\u0438 \u0431\u0435\u0437 \u0438\u043d\u0442\u0435\u0440\u043d\u0435\u0442\u0430 (\u043f\u0440\u0438 \u043d\u0430\u043b\u0438\u0447\u0438\u0438 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0437\u0435\u0440\u043a\u0430\u043b\u0430 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u044f)<\/p>\n<\/li>\n<li>\n<p>\u041c\u043e\u0431\u0438\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0438 \u043f\u0440\u043e\u0441\u0442\u043e\u0442\u0430 \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u044f<\/p>\n<\/li>\n<\/ul>\n<h4>\u0427\u0442\u043e \u043c\u044b \u0438\u043c\u0435\u0435\u043c:<\/h4>\n<ol>\n<li>\n<p>\u0422\u0435\u0441\u0442\u043e\u0432\u044b\u0439 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0439 \u0445\u043e\u0441\u0442<\/p>\n<\/li>\n<li>\n<p>Orange Pi 3 LTS<\/p>\n<\/li>\n<li>\n<p>\u041c\u043e\u0431\u0438\u043b\u044c\u043d\u044b\u0439 \u0442\u0435\u043b\u0435\u0444\u043e\u043d \u0441 \u041e\u0421 Android<\/p>\n<\/li>\n<\/ol>\n<h4>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 Ansible<\/h4>\n<p>\u0412 \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u043c\u044b \u043a\u043e\u0441\u043d\u0435\u043c\u0441\u044f \u0442\u0435\u043c\u044b \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0439 \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u0438 \u0438 \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u0438\u043c \u0440\u043e\u043b\u0438, \u0446\u0435\u043d\u0442\u0440\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u043e \u0437\u0430\u043a\u0440\u044b\u0432\u0430\u044e\u0449\u0438\u0435 \u043d\u0430 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u044b\u0445 \u0445\u043e\u0441\u0442\u0430\u0445 \u0432\u0441\u0435 \u043f\u043e\u0440\u0442\u044b, \u043a\u0440\u043e\u043c\u0435 \u0442\u0435\u0445, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u044b. \u0422\u0430\u043a\u0436\u0435 \u043c\u044b \u0437\u0430\u0449\u0438\u0442\u0438\u043c \u043d\u0430\u0448\u0438 \u043c\u0430\u0448\u0438\u043d\u044b \u043e\u0442 \u0431\u0440\u0443\u0442\u0444\u043e\u0440\u0441\u0430 (\u043f\u0435\u0440\u0435\u0431\u043e\u0440\u0430 \u043f\u0430\u0440\u043e\u043b\u0435\u0439) \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e fail2ban. \u041e\u0431\u044b\u0447\u043d\u043e \u044f \u043d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u044e sudo \u0438 \u0434\u0435\u043b\u0430\u044e \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u044e \u043f\u043e RSA-\u043a\u043b\u044e\u0447\u0430\u043c, \u043d\u043e \u0432 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u043c\u044b \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0442\u044c \u044d\u0442\u043e \u043d\u0435 \u0431\u0443\u0434\u0435\u043c, \u0447\u0442\u043e\u0431\u044b \u043d\u0435 \u0434\u0435\u043b\u0430\u0442\u044c \u0441\u0442\u0430\u0442\u044c\u044e \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u043e\u0431\u044a\u0435\u043c\u043d\u043e\u0439. \u0415\u0441\u043b\u0438 \u044d\u0442\u043e\u0442 \u0432\u043e\u043f\u0440\u043e\u0441 \u0432\u0430\u043c \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0435\u043d, \u043d\u0430\u043f\u0438\u0448\u0438\u0442\u0435 \u0432 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u044f\u0445, \u0438 \u043c\u044b \u0435\u0433\u043e \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0432 \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u043c.<\/p>\n<p>\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043c Ansible<\/p>\n<p><code>sudo apt install ansible<\/code><\/p>\n<p>\u0420\u043e\u043b\u0438 \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u0438\u043c \u0437\u0430\u0440\u0430\u043d\u0435\u0435 \u0432 \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u0439 \u0441\u0440\u0435\u0434\u0435, \u0430 \u043f\u043e\u0442\u043e\u043c \u0447\u0435\u0440\u0435\u0437 git \u043f\u0435\u0440\u0435\u043d\u0435\u0441\u0435\u043c \u043d\u0430 \u043d\u0430\u0448 \u043c\u043e\u0431\u0438\u043b\u044c\u043d\u044b\u0439 \u0441\u0435\u0440\u0432\u0435\u0440 \u0434\u043b\u044f \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u0439 \u0440\u0430\u0431\u043e\u0442\u044b. \u041d\u0430\u0447\u043d\u0435\u043c \u0441 \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043a\u0440\u0430\u0439\u043d\u0435 \u0432\u0430\u0436\u043d\u043e \u0434\u043b\u044f Ansible. \u0414\u043b\u044f \u0435\u0433\u043e \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e\u0439 \u0440\u0430\u0431\u043e\u0442\u044b \u0434\u043e\u043b\u0436\u043d\u0430 \u0431\u044b\u0442\u044c \u0441\u043e\u0437\u0434\u0430\u043d\u0430 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u0430\u044f \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u043e\u0432. \u041a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0439 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e, \u043d\u043e \u043c\u043e\u0439 \u0440\u0430\u0431\u043e\u0447\u0438\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u0431\u0435\u0437 \u043b\u0438\u0448\u043d\u0438\u0445 \u0434\u0435\u0442\u0430\u043b\u0435\u0439 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<p>.<br \/>\u251c\u2500\u2500 ansible.cfg<br \/>\u251c\u2500\u2500 inventory<br \/>\u2502 \u251c\u2500\u2500 group_vars<br \/>\u2502 \u251c\u2500\u2500 hosts<br \/>\u2502 \u251c\u2500\u2500 host_vars<br \/>\u2502 \u2502 \u2514\u2500\u2500 ansible-test<br \/>\u2502 \u2514\u2500\u2500 secrets.yml<br \/>\u251c\u2500\u2500 playbooks<br \/>\u2502 \u2514\u2500\u2500 test<br \/>\u2502 \u2514\u2500\u2500 test.yml<br \/>\u251c\u2500\u2500 requirements.txt<br \/>\u251c\u2500\u2500 requirements.yml<br \/>\u251c\u2500\u2500 roles<br \/>\u2502 \u2514\u2500\u2500 secure<br \/>\u2502 \u251c\u2500\u2500 fail2ban<br \/>\u2502 \u2514\u2500\u2500 ufw<br \/>\u2514\u2500\u2500 Vagrantfile<\/p>\n<p><strong>requirements.txt \u0438 requirements.yml<\/strong><\/p>\n<p>\u043f\u0440\u0435\u0434\u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u044b \u0434\u043b\u044f \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0435\u0439: requirements.yml \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0435\u0439 \u0441 ansible-galaxy, \u0430 requirements.txt \u2014 \u0434\u043b\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a \u0432 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0435 \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u0435 Python. \u0422\u0430\u043a\u0436\u0435 \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u044e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c Ansible-lint \u2014 \u043e\u0442\u043b\u0438\u0447\u043d\u0443\u044e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 \u0434\u043b\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u0440\u043e\u043b\u0435\u0439. \u041d\u0430\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u043e \u0441\u043e\u0432\u0435\u0442\u0443\u044e \u0438\u0437\u0443\u0447\u0438\u0442\u044c \u044d\u0442\u043e\u0442 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442, \u0435\u0441\u043b\u0438 \u0432\u044b \u0445\u043e\u0442\u0438\u0442\u0435 \u043f\u0438\u0441\u0430\u0442\u044c \u0447\u0438\u0441\u0442\u044b\u0435 \u0440\u043e\u043b\u0438 \u0438 \u0438\u0437\u0431\u0435\u0433\u0430\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0445 \u043e\u0448\u0438\u0431\u043e\u043a \u0432 \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u043c \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u0438.<\/p>\n<h4>ansible.cfg<\/h4>\n<p>\u0412 \u044d\u0442\u043e\u043c \u0444\u0430\u0439\u043b\u0435 \u043c\u044b \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c \u043f\u0443\u0442\u0438 \u043a \u043d\u0430\u0448\u0438\u043c \u0440\u043e\u043b\u044f\u043c, \u043a\u043b\u044e\u0447\u0430\u043c, \u043c\u0435\u0442\u043e\u0434\u0430\u043c \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0441\u043f\u043e\u0441\u043e\u0431\u0443 \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u043a\u044d\u0448\u0430, \u0447\u0442\u043e \u0441\u043e\u043a\u0440\u0430\u0449\u0430\u0435\u0442 \u0432\u0440\u0435\u043c\u044f \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043d\u043e\u0432\u044b\u0445 \u0440\u043e\u043b\u0435\u0439.<\/p>\n<pre><code class=\"yaml\">[defaults] skip_ansible_lint = True host_key_checking = False inventory = inventory\/hosts roles_path = roles\/secure private_key_file = ~\/.ssh\/id_rsa become_method = sudo become_user = root # \u043a\u0435\u0448\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0444\u0430\u043a\u0442\u043e\u0432 gathering = smart # 1 \u0447\u0430\u0441\u00a0 fact_caching_timeout = 3600\u00a0 # \u043a\u0435\u0448 \u0432 jsonfact_caching = jsonfile fact_caching_connection = \/tmp\/ansible_fact_cache<\/code><\/pre>\n<h4>inventory<\/h4>\n<p>\u0414\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044f \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043c\u044b \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u043c \u0441 \u0447\u0435\u043c \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c.<\/p>\n<p><strong>group_vars\/all.yml<\/strong>\u00a0\u0443\u0434\u043e\u0431\u0435\u043d \u0434\u043b\u044f \u0443\u043a\u0430\u0437\u0430\u043d\u0438\u044f \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445, \u043e\u0431\u0449\u0438\u0445 \u0434\u043b\u044f \u0432\u0441\u0435\u0445 \u0440\u043e\u043b\u0435\u0439. \u042d\u0442\u043e \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u0430\u0434\u0440\u0435\u0441\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u043e\u0432, \u0438\u043c\u0435\u043d\u0430 \u0441\u043b\u0443\u0436\u0431, \u043f\u0440\u043e\u043a\u0441\u0438 \u0438, \u0432 \u043e\u0431\u0449\u0435\u043c, \u0432\u0441\u0435, \u0447\u0442\u043e \u043f\u0435\u0440\u0438\u043e\u0434\u0438\u0447\u0435\u0441\u043a\u0438 \u043d\u0443\u0436\u043d\u043e \u0432 \u043d\u0430\u0448\u0438\u0445 \u0440\u043e\u043b\u044f\u0445 \u0438 \u0447\u0442\u043e \u043d\u0435 \u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u0431\u044b \u0434\u0443\u0431\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c.<\/p>\n<p>\u0424\u0430\u0439\u043b\u044b, \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u044e\u0449\u0438\u0435 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044e \u0445\u043e\u0441\u0442\u043e\u0432, \u0445\u0440\u0430\u043d\u044f\u0442\u0441\u044f \u0432 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0438\u00a0<strong>host_vars<\/strong>, \u0432 \u0444\u0430\u0439\u043b\u0435\u00a0<strong>secrets.yml<\/strong>\u00a0\u0443\u0434\u043e\u0431\u043d\u043e \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u043f\u0430\u0440\u043e\u043b\u0438 \u0438 \u043f\u0440\u043e\u0447\u0438\u0435 \u043a\u043e\u043d\u0444\u0438\u0434\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435. \u042d\u0442\u0438 \u0444\u0430\u043a\u0442\u044b \u044f \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u044e \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0432 \u0448\u0438\u0444\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u043c \u0432\u0438\u0434\u0435 \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c\u00a0<strong>Ansible Vault<\/strong>. \u0422\u0430\u043a\u0436\u0435 \u0432\u0430\u0436\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u044d\u0442\u043e\u0442 \u0444\u0430\u0439\u043b\u044b \u0432\u00a0<strong>.gitignore<\/strong>, \u0447\u0442\u043e\u0431\u044b \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0435\u0433\u043e \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e \u043d\u0430 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0435 \u0438 \u043d\u0435 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u0432 \u0443\u0434\u0430\u043b\u0435\u043d\u043d\u044b\u0439 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439.<\/p>\n<h4>.gitignore<\/h4>\n<pre><code class=\"yaml\"># \u0418\u0433\u043d\u043e\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432\u0441\u0435 \u0444\u0430\u0439\u043b\u044b \u0432 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0438 inventory\/host_vars\/ inventory\/host_vars\/*<\/code><\/pre>\n<p>\u041f\u0440\u0438 \u0448\u0438\u0444\u0440\u043e\u0432\u0430\u043d\u0438\u0438 \u043c\u044b \u0432\u0432\u043e\u0434\u0438\u043c \u043f\u0430\u0440\u043e\u043b\u044c, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432 \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u043c \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0435 \u043f\u043b\u0435\u0439\u0431\u0443\u043a\u043e\u0432:<\/p>\n<p><code>ansible-vault encrypt inventory\/secrets.yml # \u0448\u0438\u0444\u0440\u043e\u0432\u0430\u0442\u044c<\/code><\/p>\n<p><code>ansible-vault edit inventory\/secrets.yml\u00a0 \u00a0 # \u0440\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c<\/code><\/p>\n<p><code>ansible-vault decrypt inventory\/secrets.yml # \u0440\u0430\u0441\u0448\u0438\u0444\u0440\u043e\u0432\u0430\u0442\u044c<\/code><\/p>\n<h4>hosts<\/h4>\n<p>\u0412 \u044d\u0442\u043e\u043c \u0444\u0430\u0439\u043b\u0435 \u043c\u044b \u0443\u043a\u0430\u0436\u0435\u043c \u0445\u043e\u0441\u0442\u044b, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0433\u0440\u0443\u043f\u043f\u044b, \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u0445\u043e\u0434\u044f\u0442 \u044d\u0442\u0438 \u0445\u043e\u0441\u0442\u044b.<\/p>\n<pre><code>[test] ansible-test  [localhost] 127.0.0.1 ansible_connection=local<\/code><\/pre>\n<p>\u0422\u0430\u043a\u0436\u0435 \u0432 \u044d\u0442\u043e\u043c \u0444\u0430\u0439\u043b\u0435 \u043c\u043e\u0436\u043d\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u0430\u0434\u0440\u0435\u0441\u0430 \u0438 \u043f\u0430\u0440\u043e\u043b\u0438 \u043d\u0430\u0448\u0438\u0445 \u0445\u043e\u0441\u0442\u043e\u0432, \u043d\u043e \u0441 \u0442\u043e\u0447\u043a\u0438 \u0437\u0440\u0435\u043d\u0438\u044f \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u0438 \u044d\u0442\u043e \u043d\u0435 \u0441\u0430\u043c\u043e\u0435 \u043b\u0443\u0447\u0448\u0435\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0438\u0445 \u043c\u044b \u0443\u043a\u0430\u0436\u0435\u043c \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0445 \u0444\u0430\u0439\u043b\u0430\u0445, \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0445 \u0438\u043c\u0435\u043d\u0430\u043c \u0445\u043e\u0441\u0442\u043e\u0432 \u0432 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0438 host_vars<\/p>\n<p><strong>host_vars\/ansible-test<\/strong><\/p>\n<pre><code>ansible_become: true ansible_host: 192.168.2.16 ansible_user: vagrant ansible_ssh_pass: vagrant ansible_become_pass: vagrant<\/code><\/pre>\n<p>\u041d\u0435 \u0437\u0430\u0431\u044b\u0432\u0430\u0435\u043c \u0437\u0430\u0448\u0438\u0444\u0440\u043e\u0432\u0430\u0442\u044c \u0444\u0430\u0439\u043b \u0447\u0435\u0440\u0435\u0437\u00a0<strong>ansible-vault<\/strong><\/p>\n<p><code>ansible-vault encrypt inventory\/host_vars\/ansible-test<\/code><\/p>\n<p><strong>Vagrantfile<\/strong><\/p>\n<p>\u042d\u0442\u043e\u0442 \u0444\u0430\u0439\u043b \u043c\u044b \u043d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u043c \u0441 \u0443\u0447\u0435\u0442\u043e\u043c \u043d\u0430\u0448\u0435\u0433\u043e \u0433\u0438\u043f\u0435\u0440\u0432\u0438\u0437\u043e\u0440\u0430, \u043a \u0442\u0435\u043c\u0435 \u043d\u0430\u0448\u0435\u0439 \u0441\u0442\u0430\u0442\u044c\u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 vagrant \u043d\u0435 \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0441\u044f, \u043d\u043e \u0435\u0441\u043b\u0438 \u043a\u0440\u0430\u0442\u043a\u043e, \u0442\u043e \u044d\u0442\u043e\u0442 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0439 \u0444\u0430\u0439\u043b \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0442 \u043e\u043f\u0438\u0441\u0430\u0442\u044c \u0432\u0441\u0435 \u0430\u0441\u043f\u0435\u043a\u0442\u044b \u0436\u0435\u043b\u0430\u0435\u043c\u043e\u0439 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0439 \u043c\u0430\u0448\u0438\u043d\u044b \u0438 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0435\u0435 \u043e\u0434\u043d\u043e\u0439 \u043a\u043e\u043c\u0430\u043d\u0434\u043e\u0439.<\/p>\n<p>\u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u043d\u0430\u0448 Vagrantfile \u043d\u0430 \u0433\u0438\u043f\u0435\u0440\u0432\u0438\u0437\u043e\u0440\u0435 \u0438\u043b\u0438 \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u0442\u0435\u0441\u0442\u043e\u0432\u0443\u044e \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u0443\u044e \u043c\u0430\u0448\u0438\u043d\u0443 \u0441\u0430\u043c\u043e\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u043e. \u042f \u043f\u0440\u0435\u0434\u043f\u043e\u0447\u0438\u0442\u0430\u044e \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0430\u0446\u0438\u044e, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0434\u043e\u0432\u0435\u0440\u044e \u0432\u0441\u0435 \u0437\u0430\u0440\u0430\u043d\u0435\u0435 \u043f\u0440\u043e\u043f\u0438\u0441\u0430\u043d\u043d\u043e\u043c\u0443 \u043a\u043e\u0434\u0443.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/bcf\/b3f\/824\/bcfb3f82424473079b0c56d9c530e949.jpeg\" alt=\"\u0421\u043e\u0437\u0434\u0430\u0435\u043c \u0442\u0435\u0441\u0442\u043e\u0432\u0443\u044e \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u0443\u044e \u043c\u0430\u0448\u0438\u043d\u0443\" title=\"\u0421\u043e\u0437\u0434\u0430\u0435\u043c \u0442\u0435\u0441\u0442\u043e\u0432\u0443\u044e \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u0443\u044e \u043c\u0430\u0448\u0438\u043d\u0443\" width=\"1172\" height=\"902\" data-src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/bcf\/b3f\/824\/bcfb3f82424473079b0c56d9c530e949.jpeg\" data-blurred=\"true\"\/><\/p>\n<div><figcaption>\u0421\u043e\u0437\u0434\u0430\u0435\u043c \u0442\u0435\u0441\u0442\u043e\u0432\u0443\u044e \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u0443\u044e \u043c\u0430\u0448\u0438\u043d\u0443<\/figcaption><\/div>\n<\/figure>\n<p>\u0414\u043b\u044f \u0442\u043e\u0433\u043e \u0447\u0442\u043e\u0431\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u0430\u0440\u043e\u043b\u044c\u043d\u0443\u044e \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044e Ansible \u0432\u043c\u0435\u0441\u0442\u043e \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u043f\u043e \u043a\u043b\u044e\u0447\u0430\u043c, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u043e\u0439 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e, \u043d\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0443\u044e \u0443\u0442\u0438\u043b\u0438\u0442\u0443:<\/p>\n<p><code>sudo apt install sshpass<\/code><\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043c\u044b \u0433\u043e\u0442\u043e\u0432\u044b \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c, \u043d\u0430\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043d \u043d\u0430\u0448 \u0438\u043d\u0432\u0435\u043d\u0442\u0430\u0440\u044c. \u041d\u0435 \u0437\u0430\u0431\u044b\u0432\u0430\u0439\u0442\u0435 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u0437\u0430\u043f\u0440\u043e\u0441 \u043f\u0430\u0440\u043e\u043b\u044f \u0434\u043b\u044f Ansible Vault:<\/p>\n<p><code>ansible all -m ping --ask-vault-pass<\/code><\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/4f4\/424\/b2a\/4f4424b2a2d902779ac8015da6e8f317.jpeg\" alt=\"\u0423\u0441\u043f\u0435\u0448\u043d\u044b\u0439 \u043e\u0442\u0447\u0435\u0442 \u043e \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438 \u0441\u0432\u044f\u0437\u0438 \u0441 \u0445\u043e\u0441\u0442\u0430\u043c\u0438\" title=\"\u0423\u0441\u043f\u0435\u0448\u043d\u044b\u0439 \u043e\u0442\u0447\u0435\u0442 \u043e \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438 \u0441\u0432\u044f\u0437\u0438 \u0441 \u0445\u043e\u0441\u0442\u0430\u043c\u0438\" width=\"983\" height=\"326\" data-src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/4f4\/424\/b2a\/4f4424b2a2d902779ac8015da6e8f317.jpeg\" data-blurred=\"true\"\/><\/p>\n<div><figcaption>\u0423\u0441\u043f\u0435\u0448\u043d\u044b\u0439 \u043e\u0442\u0447\u0435\u0442 \u043e \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438 \u0441\u0432\u044f\u0437\u0438 \u0441 \u0445\u043e\u0441\u0442\u0430\u043c\u0438<\/figcaption><\/div>\n<\/figure>\n<h3>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u0440\u043e\u043b\u0435\u0439<\/h3>\n<h4>\u0420\u043e\u043b\u044c UFW<\/h4>\n<p>\u0415\u0441\u0442\u044c \u0434\u0432\u0430 \u043f\u043e\u0434\u0445\u043e\u0434\u0430 \u0432 \u0440\u0430\u0431\u043e\u0442\u0435 \u0441 Ansible, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0437\u0430\u0432\u0438\u0441\u044f\u0442 \u043e\u0442 \u043c\u0430\u0441\u0448\u0442\u0430\u0431\u043d\u043e\u0441\u0442\u0438 \u0432\u0430\u0448\u0438\u0445 \u0437\u0430\u0434\u0430\u0447. \u0415\u0441\u043b\u0438 \u0432\u044b \u0445\u043e\u0442\u0438\u0442\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u043f\u0440\u043e\u0441\u0442\u043e\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u043f\u0430\u043a\u0435\u0442\u044b, \u0441\u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0444\u0430\u0439\u043b\u044b \u0438\u043b\u0438 \u043f\u0435\u0440\u0435\u043d\u0435\u0441\u0442\u0438 \u0434\u0430\u043d\u043d\u044b\u0435, \u0432\u0430\u043c \u0431\u0443\u0434\u0435\u0442 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043e\u0434\u0438\u043d\u043e\u0447\u043d\u044b\u0439 Ansible \u0444\u0430\u0439\u043b \u0441 \u0443\u043a\u0430\u0437\u0430\u043d\u0438\u0435\u043c \u0445\u043e\u0441\u0442\u043e\u0432, \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0438 \u043f\u043b\u0435\u0439\u0431\u0443\u043a\u043e\u0432. \u041e\u043d \u043b\u0435\u0433\u043a\u043e \u043f\u0435\u0440\u0435\u043d\u043e\u0441\u0438\u0442\u0441\u044f, \u043f\u0440\u043e\u0441\u0442 \u0432 \u043e\u0444\u043e\u0440\u043c\u043b\u0435\u043d\u0438\u0438 \u0438 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0443\u0434\u043e\u0431\u0435\u043d \u0434\u043b\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0441\u0442\u044b\u0445 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0439. \u041e\u0434\u043d\u0430\u043a\u043e \u0441 \u0440\u043e\u0441\u0442\u043e\u043c \u043c\u0430\u0441\u0448\u0442\u0430\u0431\u043e\u0432 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u0442\u0430\u043a\u0438\u043c\u0438 \u0444\u0430\u0439\u043b\u0430\u043c\u0438 \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u0441\u043b\u043e\u0436\u043d\u0435\u0435, \u0438 \u0442\u0443\u0442 \u043d\u0430 \u043f\u043e\u043c\u043e\u0449\u044c \u043f\u0440\u0438\u0445\u043e\u0434\u044f\u0442 \u0440\u043e\u043b\u0438.<\/p>\n<p>\u0420\u043e\u043b\u0438 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0442 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432\u0430\u0448\u0438 \u043f\u043b\u0435\u0439\u0431\u0443\u043a\u0438 \u0438 \u0443\u043f\u0440\u043e\u0441\u0442\u0438\u0442\u044c \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0435\u0439, \u0440\u0430\u0437\u0431\u0438\u0432\u0430\u044f \u0435\u0433\u043e \u043d\u0430 \u0431\u043e\u043b\u0435\u0435 \u043c\u0435\u043b\u043a\u0438\u0435 \u0438 \u043f\u043e\u043d\u044f\u0442\u043d\u044b\u0435 \u0447\u0430\u0441\u0442\u0438. \u041a\u0430\u0436\u0434\u0430\u044f \u0440\u043e\u043b\u044c \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u043e\u0431\u043e\u0439 \u043d\u0430\u0431\u043e\u0440 \u0437\u0430\u0434\u0430\u0447, \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432, \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0438 \u0434\u0440\u0443\u0433\u0438\u0445 \u0444\u0430\u0439\u043b\u043e\u0432, \u0441\u0433\u0440\u0443\u043f\u043f\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u043f\u043e \u0432\u0430\u0448\u0435\u043c\u0443 \u0432\u044b\u0431\u043e\u0440\u0443. \u042d\u0442\u043e \u0443\u043f\u0440\u043e\u0449\u0430\u0435\u0442 \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u043e\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u043a\u043e\u0434\u0430 \u0438 \u0434\u0435\u043b\u0430\u0435\u0442 \u0435\u0433\u043e \u0431\u043e\u043b\u0435\u0435 \u0447\u0438\u0442\u0430\u0435\u043c\u044b\u043c. \u0413\u043b\u0430\u0432\u043d\u043e\u0435 \u043f\u0440\u0430\u0432\u0438\u043b\u043e \u2013 \u043a\u0430\u0436\u0434\u0430\u044f \u0440\u043e\u043b\u044c \u0434\u043e\u043b\u0436\u043d\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0435 \u0437\u0430\u0432\u0435\u0440\u0448\u0451\u043d\u043d\u043e\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u0438 \u0431\u044b\u0442\u044c \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u0443\u043d\u0438\u0432\u0435\u0440\u0441\u0430\u043b\u044c\u043d\u043e\u0439. \u0412 \u0441\u043b\u043e\u0436\u043d\u044b\u0445 \u0440\u043e\u043b\u044f\u0445 \u044f, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u044e \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u043e\u043f\u0446\u0438\u0439 \u0434\u043b\u044f \u0431\u043e\u043b\u044c\u0448\u0435\u0439 \u0432\u0430\u0440\u0438\u0430\u0442\u0438\u0432\u043d\u043e\u0441\u0442\u0438 \u0438 \u0443\u043d\u0438\u0432\u0435\u0440\u0441\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u0438, \u0447\u0442\u043e\u0431\u044b \u043d\u0435 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u0440\u043e\u043b\u0435\u0439, \u0430 \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u044f\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u043c\u0435\u0436\u043d\u044b\u0445 \u0432 \u043e\u0434\u043d\u0443.<\/p>\n<p>\u0412 \u043d\u0430\u0448\u0435\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u043c\u044b \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0434\u0432\u0435 \u0440\u043e\u043b\u0438: \u043f\u0435\u0440\u0432\u0430\u044f \u2014 ufw, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442 \u0444\u0430\u0439\u0440\u0432\u043e\u043b, \u0438 \u0432\u0442\u043e\u0440\u0430\u044f \u2014 fail2ban, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0442 \u0437\u0430\u0449\u0438\u0442\u0443 \u043e\u0442 \u0431\u0440\u0443\u0442\u0444\u043e\u0440\u0441-\u0430\u0442\u0430\u043a.<\/p>\n<p>\u0414\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0432\u0441\u0435\u0439 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u043e\u0432 \u0440\u043e\u043b\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u043a\u043e\u043c\u0430\u043d\u0434\u0443<\/p>\n<p><code>ansible-galaxy role init roles\/secure\/ufw<\/code><\/p>\n<p>\u043f\u0435\u0440\u0435\u0439\u0434\u0435\u043c \u0432 \u043a\u0430\u0442\u0430\u043b\u043e\u0433 \u0440\u043e\u043b\u0438<\/p>\n<p><code>cd roles\/secure\/ufw<\/code><\/p>\n<p>\u0418\u0437\u0443\u0447\u0438\u043c \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443<\/p>\n<p><code>tree<\/code><\/p>\n<p>.<br \/>\u251c\u2500\u2500 defaults<br \/>\u2502 \u2514\u2500\u2500 main.yml<br \/>\u251c\u2500\u2500 files<br \/>\u251c\u2500\u2500 handlers<br \/>\u2502 \u2514\u2500\u2500 main.yml<br \/>\u251c\u2500\u2500 meta<br \/>\u2502 \u2514\u2500\u2500 main.yml<br \/>\u251c\u2500\u2500 README.md<br \/>\u251c\u2500\u2500 tasks<br \/>\u2502 \u2514\u2500\u2500 main.yml<br \/>\u251c\u2500\u2500 templates<br \/>\u251c\u2500\u2500 tests<br \/>\u2502 \u251c\u2500\u2500 inventory<br \/>\u2502 \u2514\u2500\u2500 test.yml<br \/>\u2514\u2500\u2500 vars<br \/>\u2514\u2500\u2500 main.yml<\/p>\n<p>\u0420\u043e\u043b\u044c \u043f\u0440\u043e\u0441\u0442\u0430\u044f, \u0442\u0443\u0442 \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e 2 \u0444\u0430\u0439\u043b\u0430, \u0444\u0430\u0439\u043b \u0441 \u0437\u0430\u0434\u0430\u0447\u0430\u043c\u0438\u00a0<strong>tasks\/main.yml<\/strong>\u00a0\u0438 \u0444\u0430\u0439\u043b \u0441 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u043c\u0438 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e\u00a0<strong>defaults\/main.yml<\/strong><\/p>\n<h4>tasks\/main.yml<\/h4>\n<pre><code class=\"yaml\">--- # tasks file for roles\/common\/ufw - name: Ensure UFW is installed     ansible.builtin.apt:         name: ufw         state: present     become: true  - name: Set default outgoing policy to allow     community.general.ufw:         default: allow         direction: outgoing     become: true  - name: Allow SSH connections     community.general.ufw:         rule: allow         port: 22         proto: tcp     become: true  - name: Ensure UFW is enabled and set to start on boot     community.general.ufw:         state: enabled     become: true  - name: Add custom rules     community.general.ufw:         rule: \"{{ item.rule }}\"         port: \"{{ item.port }}\"         proto: \"{{ item.proto }}\"     loop: \"{{ ufw__rules }}\"     become: true<\/code><\/pre>\n<p>\u0412 \u043f\u0435\u0440\u0432\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0435 \u043c\u044b \u0443\u0431\u0435\u0436\u0434\u0430\u0435\u043c\u0441\u044f, \u0447\u0442\u043e ufw \u0443 \u043d\u0430\u0441 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d. \u0415\u0441\u043b\u0438 \u043e\u043d \u043d\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d, Ansible \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442 \u0435\u0433\u043e \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0443. \u041f\u0440\u0435\u043a\u0440\u0430\u0441\u043d\u043e\u0435 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e Ansible, \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u043c\u043e\u0435 \u0438\u0434\u0435\u043c\u043f\u043e\u0442\u0435\u043d\u0442\u043d\u043e\u0441\u0442\u044c\u044e, \u043d\u0435 \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u043e\u0434\u043d\u043e \u0438 \u0442\u043e \u0436\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0440\u0430\u0437, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043d\u0435 \u0431\u0435\u0441\u043f\u043e\u043a\u043e\u0438\u0442\u044c\u0441\u044f \u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0445 \u043e\u0448\u0438\u0431\u043a\u0430\u0445 \u043f\u0440\u0438 \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u043e\u043c \u0437\u0430\u043f\u0443\u0441\u043a\u0435 \u043a\u043e\u0434\u0430.<\/p>\n<p>\u041e\u0434<em>\u043d\u0430\u043a\u043e \u0432\u0430\u0436\u043d\u043e \u043f\u043e\u043c\u043d\u0438\u0442\u044c, \u0447\u0442\u043e \u044d\u0442\u043e \u043f\u0440\u0430\u0432\u0438\u043b\u043e \u043a\u0430\u0441\u0430\u0435\u0442\u0441\u044f \u0437\u0430\u0434\u0430\u0447, \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c\u044b\u0445 \u043c\u043e\u0434\u0443\u043b\u044f\u043c\u0438 Ansible, \u0438 \u043d\u0435 \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0441\u044f \u043a \u043a\u043e\u043c\u0430\u043d\u0434\u0430\u043c, \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u043c\u044b\u043c \u0447\u0435\u0440\u0435\u0437 \u043c\u043e\u0434\u0443\u043b\u0438 \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b\u0430!<\/em><\/p>\n<p><em>\u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u0442\u0430\u043a\u043e\u0439 \u043c\u043e\u0434\u0443\u043b\u044c \u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u0438\u043c\u0435\u0442\u044c \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 \u0438\u0434\u0435\u043c\u043f\u043e\u0442\u0435\u043d\u0442\u043d\u043e\u0441\u0442\u0438<\/em><\/p>\n<pre><code class=\"yaml\">- name: \u0423\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u043f\u0430\u043a\u0435\u0442 ufw \u0447\u0435\u0440\u0435\u0437 \u043a\u043e\u043c\u0430\u043d\u0434\u0443        command: apt-get install -y ufw<\/code><\/pre>\n<p><em>\u0410 \u0442\u0430\u043a\u043e\u0439 \u0431\u0443\u0434\u0435\u0442<\/em><\/p>\n<pre><code class=\"yaml\">- name: Ensure UFW is installed     ansible.builtin.apt:         name: ufw         state: present     become: true<\/code><\/pre>\n<p><em>\u0421\u043f\u0438\u0441\u043e\u043a \u0432\u0441\u0435\u0445 \u043c\u043e\u0434\u0443\u043b\u0435\u0439 \u0438 \u043e\u043f\u0446\u0438\u0439 \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043d\u0430 \u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u043c \u0441\u0430\u0439\u0442\u0435<\/em><a href=\"https:\/\/docs.ansible.com\/ansible\/latest\/collections\/ansible\/builtin\/\" rel=\"noopener noreferrer nofollow\"><em>\u00a0<u>Ansible<\/u><\/em><\/a><\/p>\n<pre><code class=\"yaml\">- name: Set default outgoing policy to allow     community.general.ufw:         default: allow         direction: outgoing     become: true<\/code><\/pre>\n<p>\u042d\u0442\u0430 \u0437\u0430\u0434\u0430\u0447\u0430 \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u0442 \u043f\u043e\u043b\u0438\u0442\u0438\u043a\u0443 \u0434\u043b\u044f \u0438\u0441\u0445\u043e\u0434\u044f\u0449\u0438\u0445 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0439 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0432 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0438 &#171;\u0440\u0430\u0437\u0440\u0435\u0448\u0438\u0442\u044c&#187;. \u042d\u0442\u043e \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442, \u0447\u0442\u043e \u0432\u0441\u0435 \u0438\u0441\u0445\u043e\u0434\u044f\u0449\u0438\u0435 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f (\u0442.\u0435. \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f, \u0438\u043d\u0438\u0446\u0438\u0438\u0440\u0443\u0435\u043c\u044b\u0435 \u0441 \u0432\u0430\u0448\u0435\u0433\u043e \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u043a \u0432\u043d\u0435\u0448\u043d\u0438\u043c \u0440\u0435\u0441\u0443\u0440\u0441\u0430\u043c) \u0431\u0443\u0434\u0443\u0442 \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u044b, \u0435\u0441\u043b\u0438 \u043d\u0435 \u0443\u043a\u0430\u0437\u0430\u043d\u043e \u0438\u043d\u043e\u0435 \u0432 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u043f\u0440\u0430\u0432\u0438\u043b\u0430\u0445 \u0431\u0440\u0430\u043d\u0434\u043c\u0430\u0443\u044d\u0440\u0430.<\/p>\n<pre><code class=\"yaml\">- name: Allow SSH connections     community.general.ufw:         rule: allow         port: 22         proto: tcp     become: true<\/code><\/pre>\n<p>\u0412 \u044d\u0442\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u043c\u044b \u0440\u0430\u0437\u0440\u0435\u0448\u0430\u0435\u043c 22 \u043f\u043e\u0440\u0442 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u043f\u043e ssh \u0438 \u0432\u043a\u043b\u044e\u0447\u0430\u0435\u043c ufw \u0432 \u0430\u0432\u0442\u043e\u0437\u0430\u043f\u0443\u0441\u043a, \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u044f \u0435\u0433\u043e \u0441 \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u043c\u0438 \u043f\u0440\u0430\u0432\u0438\u043b\u0430\u043c\u0438.<\/p>\n<pre><code class=\"yaml\">- name: Add custom rules     community.general.ufw:         rule: \"{{ item.rule }}\"         port: \"{{ item.port }}\"         proto: \"{{ item.proto }}\"     loop: \"{{ ufw__rules }}\"     become: true<\/code><\/pre>\n<p>\u0417\u0434\u0435\u0441\u044c \u0443\u0436\u0435 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u0435\u0435, \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0446\u0438\u043a\u043b \u0434\u043b\u044f \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u044b\u0445 \u043f\u043e\u0440\u0442\u043e\u0432, \u0438\u0437 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439\u00a0<strong>ufw__rules<\/strong>, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u0443\u043a\u0430\u0436\u0435\u043c \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0438 \u0441\u043c\u043e\u0436\u0435\u043c \u043f\u0435\u0440\u0435\u043d\u0430\u0437\u043d\u0430\u0447\u0430\u0442\u044c \u043f\u0440\u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0435 \u043f\u043b\u0435\u0439\u0431\u0443\u043a\u0430.<\/p>\n<p>\u0417\u0430\u0434\u0430\u0434\u0438\u043c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e:<\/p>\n<h4>defaults\/main.yml<\/h4>\n<pre><code class=\"yaml\">--- # defaults file for roles\/common\/ufw ufw__rules:      # \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 UFW     - { rule: 'allow', port: '80', proto: 'tcp' }     - { rule: 'allow', port: '443', proto: 'tcp' }<\/code><\/pre>\n<p>\u0420\u043e\u043b\u044c \u0433\u043e\u0442\u043e\u0432\u0430, \u043e\u0441\u0442\u0430\u043b\u043e\u0441\u044c \u0435\u0435 \u043f\u0440\u043e\u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043f\u043b\u0435\u0439\u0431\u0443\u043a \u0438 \u0437\u0430\u043f\u043e\u043b\u043d\u0438\u043c \u0435\u0433\u043e:<\/p>\n<p><code>mkdir -p playbooks\/test<\/code><\/p>\n<p><code>touch playbooks\/test\/test.yml<\/code><\/p>\n<h4>playbooks\/test\/test.yml<\/h4>\n<pre><code class=\"yaml\">- name: Testing ufw     hosts: test     roles:         - ufw      vars:         # - ufw         ufw__rules:                   - { rule: 'allow', port: '53', proto: 'udp' }<\/code><\/pre>\n<p>\u0412 \u044d\u0442\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u043c\u044b \u043e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u043c \u043f\u043e\u0440\u0442 \u0434\u043b\u044f \u0441\u043b\u0443\u0436\u0431\u044b DNS, \u0447\u0442\u043e\u0431\u044b \u043f\u0440\u043e\u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c, \u043a\u0430\u043a \u0438\u0433\u043d\u043e\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0438\u0437 \u0440\u043e\u043b\u0438 UFW.<\/p>\n<h4>\u0417\u0430\u043f\u0443\u0441\u043a \u043f\u043b\u0435\u0439\u0431\u0443\u043a\u0430 &#8212; Testing ufw<\/h4>\n<p>\u041f\u043e\u0441\u043b\u0435 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u043f\u043b\u0435\u0439\u0431\u0443\u043a\u0430, \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u043c \u0435\u0433\u043e \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u043a\u043e\u043c\u0430\u043d\u0434\u044b:<\/p>\n<p><code>ansible-playbook playbooks\/test\/test.yml --ask-vault-pass<\/code><\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/4b6\/e4f\/8e6\/4b6e4f8e6afa99751d4c99ce969571a9.jpeg\" alt=\"\u0418\u0437 \u0432\u044b\u0432\u043e\u0434\u0430 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0432\u044b\u0432\u043e\u0434, \u0447\u0442\u043e \u0432\u0441\u0435 \u043f\u0440\u043e\u0448\u043b\u043e \u0443\u0441\u043f\u0435\u0448\u043d\u043e\" title=\"\u0418\u0437 \u0432\u044b\u0432\u043e\u0434\u0430 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0432\u044b\u0432\u043e\u0434, \u0447\u0442\u043e \u0432\u0441\u0435 \u043f\u0440\u043e\u0448\u043b\u043e \u0443\u0441\u043f\u0435\u0448\u043d\u043e\" width=\"1304\" height=\"643\" data-src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/4b6\/e4f\/8e6\/4b6e4f8e6afa99751d4c99ce969571a9.jpeg\" data-blurred=\"true\"\/><\/p>\n<div><figcaption>\u0418\u0437 \u0432\u044b\u0432\u043e\u0434\u0430 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0432\u044b\u0432\u043e\u0434, \u0447\u0442\u043e \u0432\u0441\u0435 \u043f\u0440\u043e\u0448\u043b\u043e \u0443\u0441\u043f\u0435\u0448\u043d\u043e<\/figcaption><\/div>\n<\/figure>\n<p>\u0418\u0437 \u0432\u044b\u0432\u043e\u0434\u0430 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0432\u044b\u0432\u043e\u0434, \u0447\u0442\u043e \u0432\u0441\u0435 \u043f\u0440\u043e\u0448\u043b\u043e \u0443\u0441\u043f\u0435\u0448\u043d\u043e \u0438 \u0432\u0441\u0435 \u043f\u043e\u0440\u0442\u044b, \u043a\u0440\u043e\u043c\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0445 \u0443 \u043d\u0430\u0441 \u0437\u0430\u043a\u0440\u044b\u0442\u044b.<\/p>\n<h3>\u0420\u043e\u043b\u044c fail2ban<\/h3>\n<p>\u0414\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0432\u0441\u0435\u0439 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u043e\u0432 \u0440\u043e\u043b\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u043a\u043e\u043c\u0430\u043d\u0434\u0443<\/p>\n<p><code>ansible-galaxy role init roles\/secure\/fail2ban<\/code><\/p>\n<p>\u043f\u0435\u0440\u0435\u0439\u0434\u0435\u043c \u0432 \u043a\u0430\u0442\u0430\u043b\u043e\u0433 \u0440\u043e\u043b\u0438<\/p>\n<p><code>cd roles\/secure\/fail2ban<\/code><\/p>\n<h4>tasks\/main.yml<\/h4>\n<pre><code class=\"yaml\">--- # tasks file for roles\/secure\/fail2ban # sshd logs - name: Update_apt_cache     ansible.builtin.apt:         update_cache: yes  - name: Install rsyslog     ansible.builtin.apt:         name: rsyslog         state: present  - name: Install iptables     ansible.builtin.apt:         name: iptables         state: present  - name: Ensure the log directory exists     ansible.builtin.file:         path: \/var\/log\/sshd\/         state: directory         mode: '0755'  - name: Create SSH log file     ansible.builtin.file:         path: \/var\/log\/sshd\/sshd.log         state: touch         owner: sshd         group: adm         mode: '0640'  - name: Configure rsyslog for SSH logging     ansible.builtin.copy:         dest: \/etc\/rsyslog.d\/50-ssh.conf         content: |             if $programname == 'sshd' then \/var\/log\/sshd\/sshd.log             &amp; stop         owner: root         group: root         mode: '0644'  - name: Restart rsyslog service     ansible.builtin.systemd:         name: rsyslog         state: restarted  - name: Enable log sshd     ansible.builtin.lineinfile:         path: \/etc\/ssh\/sshd_config         regexp: '^#SyslogFacility AUTH'         line: 'SyslogFacility AUTH'         state: present  - name: Level log sshd     ansible.builtin.lineinfile:         path: \/etc\/ssh\/sshd_config         regexp: '^#LogLevel INFO'         line: 'LogLevel INFO'         state: present  # fail2ban - name: Install Fail2Ban     ansible.builtin.apt:         name: fail2ban         state: present  - name: Restart sshd service to apply changes     ansible.builtin.systemd:         name: sshd         state: restarted  - name: Config fail2ban     ansible.builtin.template:         src: jail.local.j2         dest: \/etc\/fail2ban\/jail.local         owner: root         group: root         mode: '0644'     notify:         - Restart_service  - name: Start and autostart fail2ban     ansible.builtin.service:         name: fail2ban         state: started         enabled: true  # test - name: Pause     ansible.builtin.pause:         seconds: 3     tags: test  - name: Check service status     ansible.builtin.service:         name: fail2ban         state: started     register: service_status     tags: test  - name: Info     ansible.builtin.assert:         that:             - service_status.status.ActiveState == 'active'         fail_msg: \"[error] - \u0421\u043b\u0443\u0436\u0431\u0430 \u043d\u0435 \u0437\u0430\u043f\u0443\u0449\u0435\u043d\u0430\"         success_msg: \"[info] - \u0421\u043b\u0443\u0436\u0431\u0430 \u0437\u0430\u043f\u0443\u0449\u0435\u043d\u0430\"<\/code><\/pre>\n<p>\u0412 \u044d\u0442\u043e\u043c \u0444\u0430\u0439\u043b\u0435 \u0437\u0430\u0434\u0430\u0447\u0438 \u0440\u0430\u0437\u0431\u0438\u0442\u044b \u043d\u0430 3 \u0447\u0430\u0441\u0442\u0438:<\/p>\n<ol>\n<li>\n<p>\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 rsyslog \u0438 iptables \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0447\u0438\u0442\u0430\u0435\u0442 fail2ban<\/p>\n<\/li>\n<li>\n<p>\u041d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u0442 fail2ban, \u0430 \u0438\u043c\u0435\u043d\u043d\u043e \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u0442 \u0448\u0430\u0431\u043b\u043e\u043d jinja \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0433\u043e \u0444\u0430\u043b\u0430<\/p>\n<\/li>\n<li>\n<p>\u0422\u0435\u0441\u0442\u0438\u0440\u0443\u0435\u043c \u0443\u0441\u043f\u0435\u0448\u043d\u043e\u0441\u0442\u044c \u043f\u0440\u043e\u0432\u0435\u0434\u0435\u043d\u043d\u043e\u0439 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u043f\u0443\u0442\u0435\u043c \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u0441\u0442\u0430\u0442\u0443\u0441\u0430 \u0441\u043b\u0443\u0436\u0431\u044b<\/p>\n<\/li>\n<\/ol>\n<p>\u0418\u0437\u0443\u0447\u0438\u043c \u0448\u0430\u0431\u043b\u043e\u043d \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430<\/p>\n<h4>templates\/jail.local.j2<\/h4>\n<pre><code class=\"yaml\">[DEFAULT] bantime  = {{ fail2ban__bantime }} findtime  = {{ fail2ban__findtime }} maxretry = {{ fail2ban__maxretry }} allowipv6 = true [sshd] enabled = true port = ssh filter = sshd action = iptables-multiport[name=sshd, port=ssh, protocol=tcp] logpath = \/var\/log\/sshd\/sshd.log<\/code><\/pre>\n<p>\u0412 \u044d\u0442\u043e\u0442 \u0448\u0430\u0431\u043b\u043e\u043d \u043c\u044b \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u043c 3 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043c \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e\u044e.<\/p>\n<h4>defaults\/main.yml<\/h4>\n<pre><code class=\"yaml\">--- # defaults file for roles\/secure\/fail2ban fail2ban__bantime: 600  # \u0432\u0440\u0435\u043c\u044f \u0431\u0430\u043d\u0430 fail2ban__findtime: 600 # \u0447\u0430\u0441\u0442\u043e\u0442\u0430 \u0431\u0430\u043d\u0430 fail2ban__maxretry: 5   # \u0447\u0438\u0441\u043b\u043e \u043d\u0435\u0443\u0434\u0430\u0447\u043d\u044b\u0445 \u043f\u043e\u043f\u044b\u0442\u043e\u043a<\/code><\/pre>\n<p>\u041d\u0435 \u0437\u0430\u0431\u044b\u0432\u0430\u0435\u043c \u043f\u0440\u043e \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u043c \u0432 \u0437\u0430\u0434\u0430\u0447\u0435 \u043f\u043e\u0434 \u0438\u043c\u0435\u043d\u0435\u043c\u00a0<strong>Restart_service<\/strong><\/p>\n<h4>handlers\/main.yml<\/h4>\n<pre><code class=\"yaml\">--- # handlers file for roles\/secure\/fail2ban - name: Restart_service     ansible.builtin.systemd:         name: fail2ban         state: restarted<\/code><\/pre>\n<p>\u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0432 \u043f\u043b\u0435\u0439\u0431\u0443\u043a \u043d\u0430\u0448\u0443 \u0440\u043e\u043b\u044c<\/p>\n<h4>playbooks\/test\/test.yml<\/h4>\n<pre><code class=\"yaml\">- name: Testing ufw + fail2ban     hosts: test     roles:         - ufw         - fail2ban        vars:         # - ufw         ufw__rules:                   - { rule: 'allow', port: '53', proto: 'udp' }         # - fail2ban         fail2ban__bantime: 600  # \u0432\u0440\u0435\u043c\u044f \u0431\u0430\u043d\u0430         fail2ban__findtime: 600 # \u0447\u0430\u0441\u0442\u043e\u0442\u0430 \u0431\u0430\u043d\u0430         fail2ban__maxretry: 3   # \u0447\u0438\u0441\u043b\u043e \u043d\u0435\u0443\u0434\u0430\u0447\u043d\u044b\u0445 \u043f\u043e\u043f\u044b\u0442\u043e\u043a<\/code><\/pre>\n<p>\u042f \u043b\u044e\u0431\u043b\u044e \u043f\u0435\u0440\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0442\u044c \u043a\u043b\u044e\u0447\u0435\u0432\u044b\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u0432 \u043f\u043b\u0435\u0439\u0431\u0443\u043a\u0430\u0445 \u0434\u043b\u044f \u0431\u043e\u043b\u0435\u0435 \u0433\u0438\u0431\u043a\u043e\u0433\u043e \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0440\u043e\u043b\u044f\u043c\u0438.<\/p>\n<h4>\u0417\u0430\u043f\u0443\u0441\u043a \u043f\u043b\u0435\u0439\u0431\u0443\u043a\u0430 &#8212; Testing ufw + fail2ban<\/h4>\n<p><code>ansible-playbook playbooks\/test\/test.yml --ask-vault-pass<\/code><\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/091\/540\/c44\/091540c44601b98e80dac364dd33738e.jpg\" alt=\"\u0412\u0441\u0435  \u043f\u0440\u043e\u0448\u043b\u043e \u0443\u0441\u043f\u0435\u0448\u043d\u043e\" title=\"\u0412\u0441\u0435 \u043f\u0440\u043e\u0448\u043b\u043e \u0443\u0441\u043f\u0435\u0448\u043d\u043e\" width=\"795\" height=\"893\" data-src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/091\/540\/c44\/091540c44601b98e80dac364dd33738e.jpg\" data-blurred=\"true\"\/><\/p>\n<div><figcaption>\u0412\u0441\u0435 \u043f\u0440\u043e\u0448\u043b\u043e \u0443\u0441\u043f\u0435\u0448\u043d\u043e<\/figcaption><\/div>\n<\/figure>\n<p>\u041f\u0440\u043e\u0432\u0435\u0440\u0438\u043c \u0440\u0430\u0431\u043e\u0442\u0443 fail2ban \u0443\u043c\u044b\u0448\u043b\u0435\u043d\u043d\u043e \u043e\u0448\u0438\u0431\u0430\u044f\u0441\u044c \u0432 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438 \u043f\u043e ssh \u043f\u0440\u0438 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0438 \u043a \u043d\u0430\u0448\u0435\u043c\u0443 \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u043c\u0443 \u0441\u0435\u0440\u0432\u0435\u0440\u0443<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/42d\/c20\/1e2\/42dc201e25a95b9da8233eec2d4c5bdd.jpg\" alt=\"\u041f\u043e\u0441\u043b\u0435 \u0442\u0440\u0435\u0445 \u043f\u043e\u043f\u044b\u0442\u043e\u043a \u043d\u0435\u0432\u0435\u0440\u043d\u043e\u0433\u043e \u0432\u0432\u043e\u0434\u0430 \u0443\u0447\u0435\u0442\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u043d\u0430\u0448 \u0445\u043e\u0441\u0442 \u0437\u0430\u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u0430\u043d \u043d\u0430 10 \u043c\u0438\u043d\u0443\u0442\" title=\"\u041f\u043e\u0441\u043b\u0435 \u0442\u0440\u0435\u0445 \u043f\u043e\u043f\u044b\u0442\u043e\u043a \u043d\u0435\u0432\u0435\u0440\u043d\u043e\u0433\u043e \u0432\u0432\u043e\u0434\u0430 \u0443\u0447\u0435\u0442\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u043d\u0430\u0448 \u0445\u043e\u0441\u0442 \u0437\u0430\u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u0430\u043d \u043d\u0430 10 \u043c\u0438\u043d\u0443\u0442\" width=\"635\" height=\"318\" data-src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/42d\/c20\/1e2\/42dc201e25a95b9da8233eec2d4c5bdd.jpg\" data-blurred=\"true\"\/><\/p>\n<div><figcaption>\u041f\u043e\u0441\u043b\u0435 \u0442\u0440\u0435\u0445 \u043f\u043e\u043f\u044b\u0442\u043e\u043a \u043d\u0435\u0432\u0435\u0440\u043d\u043e\u0433\u043e \u0432\u0432\u043e\u0434\u0430 \u0443\u0447\u0435\u0442\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u043d\u0430\u0448 \u0445\u043e\u0441\u0442 \u0437\u0430\u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u0430\u043d \u043d\u0430 10 \u043c\u0438\u043d\u0443\u0442<\/figcaption><\/div>\n<\/figure>\n<p>1. Fail2ban \u0447\u0435\u0440\u0435\u0437 \u043b\u043e\u0433\u0438 ssh \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u043b 3 \u043d\u0435\u0432\u0435\u0440\u043d\u044b\u0435 \u043f\u043e\u043f\u044b\u0442\u043a\u0438 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438<\/p>\n<p>2. Fail2ban \u0441\u043e\u0437\u0434\u0430\u043b \u043f\u0440\u0430\u0432\u0438\u043b\u043e \u0434\u043b\u044f \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0438 IP-\u0430\u0434\u0440\u0435\u0441\u0430 \u043d\u0430 \u0443\u0440\u043e\u0432\u043d\u0435 \u0431\u0440\u0430\u043d\u0434\u043c\u0430\u0443\u044d\u0440\u0430\u00a0<code>iptables<\/code>, \u0447\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u043f\u043e\u0440\u0442\u0443 22 (SSH) \u0434\u043b\u044f IP-\u0430\u0434\u0440\u0435\u0441\u0430<\/p>\n<p>\u0414\u043b\u044f \u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0430\u0446\u0438\u0438 \u0432\u0430\u0436\u043d\u043e\u0441\u0442\u0438 \u0437\u0430\u0449\u0438\u0442\u044b \u0445\u043e\u0441\u0442\u0430 \u043e \u0431\u0440\u0443\u0442\u0444\u043e\u0440\u0441\u0430 \u044f \u043f\u0440\u043e\u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0438\u0440\u0443\u044e \u043b\u043e\u0433 \u0441\u043e \u0441\u0432\u043e\u0435\u0433\u043e \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u0432 \u043e\u0431\u043b\u0430\u043a\u0435, \u0431\u0435\u0437 \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u043e\u0433\u043e fail2ban:<\/p>\n<p><code>sudo journalctl -r | grep 'invalid user' | head -n 20<\/code><\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/8ee\/fa0\/589\/8eefa058912351a10d4f555d55bc8b7a.jpg\" alt=\"\u041a\u0430\u0436\u0434\u044b\u0435 \u043f\u0430\u0440\u0443 \u043c\u0438\u043d\u0443\u0442 \u0445\u043e\u0441\u0442 \u0432 \u0441\u0435\u0442\u0438 \u0430\u0442\u0430\u043a\u0443\u044e\u0442 \u0431\u043e\u0442\u044b\" title=\"\u041a\u0430\u0436\u0434\u044b\u0435 \u043f\u0430\u0440\u0443 \u043c\u0438\u043d\u0443\u0442 \u0445\u043e\u0441\u0442 \u0432 \u0441\u0435\u0442\u0438 \u0430\u0442\u0430\u043a\u0443\u044e\u0442 \u0431\u043e\u0442\u044b\" width=\"1119\" height=\"442\" data-src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/8ee\/fa0\/589\/8eefa058912351a10d4f555d55bc8b7a.jpg\" data-blurred=\"true\"\/><\/p>\n<div><figcaption>\u041a\u0430\u0436\u0434\u044b\u0435 \u043f\u0430\u0440\u0443 \u043c\u0438\u043d\u0443\u0442 \u0445\u043e\u0441\u0442 \u0432 \u0441\u0435\u0442\u0438 \u0430\u0442\u0430\u043a\u0443\u044e\u0442 \u0431\u043e\u0442\u044b<\/figcaption><\/div>\n<\/figure>\n<h3>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0430 Ansible \u043d\u0430 Orange PI<\/h3>\n<p>\u0414\u043b\u044f \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 Orenge Pi \u0437\u0430\u0439\u0434\u0435\u043c \u043d\u0430 \u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0439 \u0441\u0430\u0439\u0442 \u0438 \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u043c \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 \u0430\u043a\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0439 \u0434\u0438\u0441\u0442\u0440\u0438\u0431\u0443\u0442\u0438\u0432 \u0441 \u0434\u0440\u0430\u0439\u0432\u0435\u0440\u0430\u043c\u0438 \u043f\u043e\u00a0<a href=\"http:\/\/www.orangepi.org\/html\/hardWare\/computerAndMicrocontrollers\/service-and-support\/Orange-pi-3-LTS.html\" rel=\"noopener noreferrer nofollow\">\u0430\u0434\u0440\u0435\u0441\u0443<\/a><\/p>\n<p>\u0417\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u043e\u0431\u0440\u0430\u0437 \u043d\u0430 SD \u043a\u0430\u0440\u0442\u0443 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e Rufus (\u0438\u043b\u0438 \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u043e\u0439 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b). \u041f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u0432\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c \u043a\u0430\u0440\u0442\u0443 \u0432 Orange Pi, \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u043c \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e \u0438 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u043c \u0435\u0433\u043e \u043a \u043d\u0430\u0448\u0435\u0439 \u0441\u0435\u0442\u0438 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043a\u0430\u0431\u0435\u043b\u044f. \u041f\u0440\u0438 \u043d\u0430\u043b\u0438\u0447\u0438\u0438 DHCP \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u043d\u0430\u0439\u0434\u0435\u043c IP-\u0430\u0434\u0440\u0435\u0441, \u0432\u044b\u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0443, \u0438 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u043c\u0441\u044f \u0447\u0435\u0440\u0435\u0437 \u043b\u044e\u0431\u0438\u043c\u044b\u0439 SSH \u043a\u043b\u0438\u0435\u043d\u0442 (Putty, PowerShell), \u0432\u0432\u0435\u0434\u044f \u043b\u043e\u0433\u0438\u043d \u0438 \u043f\u0430\u0440\u043e\u043b\u044c \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e (\u043b\u043e\u0433\u0438\u043d: orangepi, \u043f\u0430\u0440\u043e\u043b\u044c: orangepi). \u0415\u0441\u043b\u0438 \u0432\u043e\u0437\u043d\u0438\u043a\u043d\u0443\u0442 \u043a\u0430\u043a\u0438\u0435-\u043b\u0438\u0431\u043e \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b, \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u043c\u043e\u043d\u0438\u0442\u043e\u0440 \u0438 \u043a\u043b\u0430\u0432\u0438\u0430\u0442\u0443\u0440\u0443 \u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u043a \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0443 \u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0441\u0435\u0442\u044c \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e.<\/p>\n<h4>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u0441\u0435\u0442\u0438<\/h4>\n<p>\u041f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u043d\u0430 Orange Pi \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d NetworkManager, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043d \u043d\u0430 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 IP-\u0430\u0434\u0440\u0435\u0441\u0430 \u043f\u043e DHCP. \u041c\u044b \u043d\u0435 \u0431\u0443\u0434\u0435\u043c \u043d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0442\u044c \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0439 IP \u043d\u0430 \u043f\u0440\u043e\u0432\u043e\u0434\u043d\u043e\u043c \u0441\u0435\u0442\u0435\u0432\u043e\u043c \u0430\u0434\u0430\u043f\u0442\u0435\u0440\u0435, \u0430 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u043c\u0441\u044f \u043a Wi-Fi \u0442\u043e\u0447\u043a\u0435 \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043d\u0430\u0448\u0435\u0433\u043e \u0442\u0435\u043b\u0435\u0444\u043e\u043d\u0430. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043f\u0440\u043e\u0441\u043a\u0430\u043d\u0438\u0440\u0443\u0435\u043c \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0435 Wi-Fi \u0441\u0435\u0442\u0438:<\/p>\n<p><code>nmcli device wifi list<\/code><\/p>\n<p>\u0418\u0437 \u0441\u043f\u0438\u0441\u043a\u0430 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0445 \u0442\u043e\u0447\u0435\u043a \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u0432\u044b\u0431\u0435\u0440\u0435\u043c \u043d\u0443\u0436\u043d\u0443\u044e \u0438 \u0432\u0432\u0435\u0434\u0435\u043c \u043f\u0430\u0440\u043e\u043b\u044c \u0434\u043b\u044f \u0434\u043e\u0441\u0442\u0443\u043f\u0430.<\/p>\n<p><code>nmcli device wifi connect  --ask<\/code><\/p>\n<p>\u0422\u0430\u043a\u0436\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u043c \u0430\u0432\u0442\u043e\u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u043a \u0442\u043e\u0447\u043a\u0435 \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043c\u043e\u0431\u0438\u043b\u044c\u043d\u043e\u0433\u043e \u0442\u0435\u043b\u0435\u0444\u043e\u043d\u0430, \u0447\u0442\u043e\u0431\u044b \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u043b\u043e\u0441\u044c \u043a \u0441\u0435\u0442\u0438 \u043f\u0440\u0438 \u043f\u0435\u0440\u0435\u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0435.<\/p>\n<p><code>nmcli connection modify  connection.autoconnect yes<\/code><\/p>\n<p><em>\u041a\u043e\u043d\u0444\u0438\u0433 \u0431\u0435\u0441\u043f\u0440\u043e\u0432\u043e\u0434\u043d\u043e\u0433\u043e \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d \u043f\u043e \u0430\u0434\u0440\u0435\u0441\u0443\u00a0<\/em><strong><em>\/etc\/NetworkManager\/system-connections\/<\/em><\/strong><\/p>\n<h3>1.2 \u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u0441\u0438\u0441\u0442\u0435\u043c\u044b<\/h3>\n<p>\u0412 \u043f\u0435\u0440\u0432\u0443\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u0441\u043c\u0435\u043d\u0438\u043c \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0438 \u0441 \u041a\u0438\u0442\u0430\u0439\u0441\u043a\u0438\u0445 \u043d\u0430 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0435<\/p>\n<p><code>sudo nano \/etc\/apt\/sources.list<\/code><\/p>\n<pre><code>deb http:\/\/deb.debian.org\/debian\/ bookworm main non-free-firmware deb-src http:\/\/deb.debian.org\/debian\/ bookworm main non-free-firmware  deb http:\/\/security.debian.org\/debian-security bookworm-security main non-free-firmware deb-src http:\/\/security.debian.org\/debian-security bookworm-security main non-free-firmware  deb http:\/\/deb.debian.org\/debian\/ bookworm-updates main non-free-firmware deb-src http:\/\/deb.debian.org\/debian\/ bookworm-updates main non-free-firmware<\/code><\/pre>\n<p>\u041e\u0431\u043d\u043e\u0432\u0438\u043c \u043a\u044d\u0448 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0435\u0432 \u0438 \u0441\u0430\u043c\u0443 \u0441\u0438\u0441\u0442\u0435\u043c\u0443<\/p>\n<pre><code>sudo apt update sudo apt upgrade<\/code><\/pre>\n<p>\u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043d\u043e\u0432\u043e\u0433\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0432\u0437\u0430\u043c\u0435\u043d \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0433\u043e (\u0432 \u043c\u043e\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435\u043c \u043b\u043e\u0433\u0438\u043d \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0431\u0443\u0434\u0435\u0442 &#171;<strong>ch<\/strong>&#171;)<\/p>\n<pre><code>sudo useradd -m -s \/bin\/bash ch groups # \u043f\u0440\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0432 \u043a\u0430\u043a\u0438\u0445 \u0433\u0440\u0443\u043f\u043f\u0430\u0445 \u0434\u0435\u0444\u043e\u043b\u0442\u043d\u044b\u0439 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c sudo usermod -aG tty,disk,dialout,sudo,audio,video,plugdev,games,users,systemd-journal,input,netdev,ssh ch sudo passwd ch<\/code><\/pre>\n<p>\u0418 \u0443\u0434\u0430\u043b\u0438\u043c \u0441\u0442\u0430\u0440\u043e\u0433\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f<\/p>\n<pre><code>sudo userdel -r orangepi sudo rm -rf \/var\/mail\/orangepi<\/code><\/pre>\n<p>\u041d\u0430\u0441\u0442\u0440\u043e\u0438\u043c \u0432\u0440\u0435\u043c\u044f<\/p>\n<pre><code>sudo timedatectl set-timezone Europe\/Moscow timedatectl<\/code><\/pre>\n<p>\u0418\u043c\u044f \u0445\u043e\u0441\u0442\u0430<\/p>\n<p><code>sudo hostnamectl set-hostname opi<\/code><\/p>\n<p>\u041d\u0435 \u0437\u0430\u0431\u044b\u0432\u0430\u0435\u043c \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043f\u0440\u0430\u0432\u043a\u0438 \u0432 \u0444\u0430\u0439\u043b\u0430\u0445\u00a0<strong>\/etc\/hosts\u00a0<\/strong>\u0438\u00a0<strong>\/etc\/hostname\u00a0<\/strong>\u043f\u043e\u0441\u043b\u0435 \u0447\u0435\u0433\u043e \u043f\u0435\u0440\u0435\u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u043c \u0441\u0438\u0441\u0442\u0435\u043c\u0443<\/p>\n<p><code>sudo reboot<\/code><\/p>\n<h4>1.3 \u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u043a Github<\/h4>\n<p>\u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c rsa \u043a\u043b\u044e\u0447\u0438 \u0434\u043b\u044f \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u0437\u0430\u043a\u0440\u044b\u0442\u043e\u043c\u0443 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u044e \u043d\u0430 GitHub<\/p>\n<p><code>ssh-keygen -t rsa<\/code><\/p>\n<p>\u041e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u043c \u043f\u0443\u0431\u043b\u0438\u0447\u043d\u044b\u0439 \u043a\u043b\u044e\u0447, \u043a\u043e\u043f\u0438\u0440\u0443\u0435\u043c \u0435\u0433\u043e \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u0432 \u043b\u0438\u0447\u043d\u044b\u0439 \u043a\u0430\u0431\u0438\u043d\u0435\u0442 \u043d\u0430 Github \u0432 \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u00a0<strong>Settings -&gt; SSH and GPG keys -&gt; SSH keys<\/strong><\/p>\n<p><code>sudo cat ~\/.ssh\/id_rsa.pub<\/code><\/p>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0447\u0435\u0433\u043e \u0442\u0435\u0441\u0442\u0438\u0440\u0443\u0435\u043c \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435<\/p>\n<p><code>ssh -T git@github.com<\/code><\/p>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438, \u043a\u043e\u043f\u0438\u0440\u0443\u0435\u043c \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439 \u0441 \u043d\u0430\u0448\u0438\u043c\u0438 \u0440\u0430\u0431\u043e\u0447\u0438\u043c\u0438 \u0440\u043e\u043b\u044f\u043c\u0438 Ansible<\/p>\n<p><code>git@github.com:\/.gite<\/code><\/p>\n<h4>\u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u0442\u0435\u043b\u0435\u0444\u043e\u043d\u0430 \u043a Orange PI \u0438 \u0437\u0430\u043f\u0443\u0441\u043a \u043f\u043b\u0435\u0439\u0431\u0443\u043a\u0430<\/h4>\n<p>\u0414\u043b\u044f \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u043f\u043e ssh \u0441 \u043c\u043e\u0431\u0438\u043b\u044c\u043d\u043e\u0433\u043e \u0442\u0435\u043b\u0435\u0444\u043e\u043d\u0430 \u043d\u0430 \u041e\u0421 Android \u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e 2 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f,\u00a0<strong>ConnectBot<\/strong>\u00a0&#8212; \u043a\u0430\u043a ssh \u043a\u043b\u0438\u0435\u043d\u0442, \u0438\u00a0<strong>Network Utilites<\/strong>\u00a0&#8212; \u0434\u043b\u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0430\u0434\u0440\u0435\u0441\u0430 \u043a\u043b\u0438\u0435\u043d\u0442\u0430.<\/p>\n<p>\u0414\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e:<\/p>\n<ol>\n<li>\n<p>\u041e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u0441\u0435\u0442\u044c \u0442\u043e\u0447\u043a\u0438 \u0434\u043e\u0441\u0442\u0443\u043f\u0430<\/p>\n<div class=\"floating-image\">\n<figure class=\"float full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/3d1\/e92\/da7\/3d1e92da75fc1bfac308674e60bc2eb8.jpg\" alt=\"\u041d\u0430\u0448\u0438 \u043a\u043b\u0438\u0435\u043d\u0442\u044b \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u044e\u0442\u0441\u044f \u043a \u0441\u0435\u0442\u0438 192.168.222.38\" title=\"\u041d\u0430\u0448\u0438 \u043a\u043b\u0438\u0435\u043d\u0442\u044b \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u044e\u0442\u0441\u044f \u043a \u0441\u0435\u0442\u0438 192.168.222.38\" width=\"576\" height=\"571\" data-src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/3d1\/e92\/da7\/3d1e92da75fc1bfac308674e60bc2eb8.jpg\" data-blurred=\"true\"\/><\/p>\n<div><figcaption>\u041d\u0430\u0448\u0438 \u043a\u043b\u0438\u0435\u043d\u0442\u044b \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u044e\u0442\u0441\u044f \u043a \u0441\u0435\u0442\u0438 192.168.222.38<\/figcaption><\/div>\n<\/figure>\n<p>\u0421\u043a\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0435\u0435 \u0438 \u043d\u0430\u0439\u0442\u0438 \u0430\u0434\u0440\u0435\u0441 \u043a\u043b\u0438\u0435\u043d\u0442\u0430<\/p>\n<\/div>\n<div class=\"floating-image\">\n<figure class=\"float full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/8c4\/b6b\/819\/8c4b6b819ff0298ce10489ad15844f06.jpg\" alt=\"\u0410\u0434\u0440\u0435\u0441 \u043a\u043b\u0438\u0435\u043d\u0442\u0430 192.168.222.127\" title=\"\u0410\u0434\u0440\u0435\u0441 \u043a\u043b\u0438\u0435\u043d\u0442\u0430 192.168.222.127\" width=\"576\" height=\"454\" data-src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/8c4\/b6b\/819\/8c4b6b819ff0298ce10489ad15844f06.jpg\" data-blurred=\"true\"\/><\/p>\n<div><figcaption>\u0410\u0434\u0440\u0435\u0441 \u043a\u043b\u0438\u0435\u043d\u0442\u0430 192.168.222.127<\/figcaption><\/div>\n<\/figure>\n<p>\u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u0441\u044f \u043a \u043a\u043b\u0438\u0435\u043d\u0442\u0443 \u043f\u043e ssh<\/p>\n<\/div>\n<div class=\"floating-image\">\n<figure class=\"float full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/42c\/634\/39d\/42c63439d51289ed2e488b81e59cd508.jpg\" alt=\"\u041e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u043c ssh \u0441\u0435\u0441\u0441\u0438\u044e\" title=\"\u041e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u043c ssh \u0441\u0435\u0441\u0441\u0438\u044e\" width=\"576\" height=\"856\" data-src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/42c\/634\/39d\/42c63439d51289ed2e488b81e59cd508.jpg\" data-blurred=\"true\"\/><\/p>\n<div><figcaption>\u041e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u043c ssh \u0441\u0435\u0441\u0441\u0438\u044e<\/figcaption><\/div>\n<\/figure>\n<p>\u0420\u0430\u0437\u0440\u0435\u0448\u0430\u0435\u043c Fingerprint<\/p>\n<\/div>\n<ol start=\"4\">\n<li>\n<div class=\"floating-image\">\n<figure class=\"float full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/35c\/7f8\/521\/35c7f8521343a836c2ac2534f8adc23d.jpg\" width=\"576\" height=\"782\" data-src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/35c\/7f8\/521\/35c7f8521343a836c2ac2534f8adc23d.jpg\" data-blurred=\"true\"\/><\/figure>\n<p>\u0420\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u0443\u0435\u043c \u0444\u0430\u0439\u043b \u0438\u043d\u0432\u0435\u043d\u0442\u0430\u0440\u044f \u0438 group_vars<\/p>\n<\/div>\n<\/li>\n<\/ol>\n<div class=\"floating-image\">\n<figure class=\"float full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/b1a\/734\/d58\/b1a734d58e256af5a2007d35312e0683.jpg\" alt=\"\u0421 \u0442\u0435\u043b\u0435\u0444\u043e\u043d\u0430 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043c\u043e\u0436\u043d\u043e, \u0432\u0441\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u043a\u043d\u043e\u043f\u043a\u0438 \u0432 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438 \u0435\u0441\u0442\u044c\" title=\"\u0421 \u0442\u0435\u043b\u0435\u0444\u043e\u043d\u0430 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043c\u043e\u0436\u043d\u043e, \u0432\u0441\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u043a\u043d\u043e\u043f\u043a\u0438 \u0432 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438 \u0435\u0441\u0442\u044c\" width=\"576\" height=\"1280\" data-src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/b1a\/734\/d58\/b1a734d58e256af5a2007d35312e0683.jpg\" data-blurred=\"true\"\/><\/p>\n<div><figcaption>\u0421 \u0442\u0435\u043b\u0435\u0444\u043e\u043d\u0430 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043c\u043e\u0436\u043d\u043e, \u0432\u0441\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u043a\u043d\u043e\u043f\u043a\u0438 \u0432 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438 \u0435\u0441\u0442\u044c<\/figcaption><\/div>\n<\/figure>\n<p>\u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u043f\u043b\u0435\u0439\u0431\u0443\u043a \u0438 \u043d\u0430\u0441\u043b\u0430\u0436\u0434\u0430\u0435\u043c\u0441\u044f \u043e\u0442\u0447\u0435\u0442\u043e\u043c!<\/p>\n<\/div>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/bc2\/5d9\/21e\/bc25d921e30710a6bf2f142379f8ccc8.jpg\" alt=\"\u041a\u0430\u043a \u044d\u0442\u043e \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442\" title=\"\u041a\u0430\u043a \u044d\u0442\u043e \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442\" width=\"792\" height=\"1140\" data-src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/bc2\/5d9\/21e\/bc25d921e30710a6bf2f142379f8ccc8.jpg\" data-blurred=\"true\"\/><\/p>\n<div><figcaption>\u041a\u0430\u043a \u044d\u0442\u043e \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442<\/figcaption><\/div>\n<\/figure>\n<\/li>\n<\/ol>\n<hr\/>\n<p>\u0415\u0441\u043b\u0438 \u0443 \u0432\u0430\u0441 \u0435\u0441\u0442\u044c \u0432\u043e\u043f\u0440\u043e\u0441\u044b \u043f\u043e \u0441\u0442\u0430\u0442\u044c\u0435 \u0438\u043b\u0438 \u0432\u044b \u0445\u043e\u0442\u0438\u0442\u0435 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u0443\u0437\u043d\u0430\u0442\u044c \u043e\u0431 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0430\u0445, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u044b \u043d\u0435 \u0443\u0441\u043f\u0435\u043b\u0438 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c, \u043d\u0430\u043f\u0438\u0448\u0438\u0442\u0435 \u043e\u0431 \u044d\u0442\u043e\u043c \u0432 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u044f\u0445. \u042f \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u044e \u0432\u0430\u0448\u0438 \u0432\u043e\u043f\u0440\u043e\u0441\u044b \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445 \u0441\u0442\u0430\u0442\u044c\u044f\u0445! \u0421\u043f\u0430\u0441\u0438\u0431\u043e \u0437\u0430 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435!<\/p>\n<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/851834\/\"> https:\/\/habr.com\/ru\/articles\/851834\/<\/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<h2>\u0412\u0432\u0435\u0434\u0435\u043d\u0438\u0435<\/h2>\n<p>\u0417\u0434\u0440\u0430\u0432\u0441\u0442\u0432\u0443\u0439\u0442\u0435! \u0412 \u0441\u0432\u043e\u0435\u0439 \u043f\u0440\u043e\u0444\u0435\u0441\u0441\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0439 \u0434\u0435\u044f\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u044f \u0447\u0430\u0441\u0442\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u044e \u0441 \u0441\u0438\u0441\u0442\u0435\u043c\u0430\u043c\u0438, \u043d\u0430\u0445\u043e\u0434\u044f\u0449\u0438\u043c\u0438\u0441\u044f \u0432 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u0441\u0435\u0442\u044f\u0445, \u0438\u0437\u043e\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u043a\u0430\u043a \u0434\u0440\u0443\u0433 \u043e\u0442 \u0434\u0440\u0443\u0433\u0430, \u0442\u0430\u043a \u0438 \u043e\u0442 \u0418\u043d\u0442\u0435\u0440\u043d\u0435\u0442\u0430.<\/p>\n<p>\u0427\u0430\u0441\u0442\u043e \u044d\u0442\u0438 \u0441\u0435\u0442\u0438 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442 Linux-\u0445\u043e\u0441\u0442\u044b \u0441 \u0440\u0430\u0437\u043d\u043e\u043e\u0431\u0440\u0430\u0437\u043d\u044b\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u043e\u043c, \u043d\u043e, \u043a\u0430\u043a \u043f\u0440\u0430\u0432\u0438\u043b\u043e, \u0438\u043c\u0435\u044e\u0442 \u0440\u044f\u0434 \u043e\u0431\u0449\u0438\u0445 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0439. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u0442\u043e\u0447\u0435\u043a \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u043a \u043e\u0431\u0449\u0438\u043c \u0441\u0435\u0442\u0435\u0432\u044b\u043c \u043f\u0430\u043f\u043a\u0430\u043c, \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u044c, \u0437\u0435\u0440\u043a\u0430\u043b\u0430 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0435\u0432 \u0438 \u0434\u0440\u0443\u0433\u0438\u0435 \u0430\u0441\u043f\u0435\u043a\u0442\u044b \u2014 \u0432\u0441\u0435 \u044d\u0442\u043e \u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0437\u0430\u0442\u0440\u0430\u0442, \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u0441 \u0443\u0447\u0435\u0442\u043e\u043c \u0431\u043e\u043b\u044c\u0448\u043e\u0433\u043e \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u0442\u0430\u043a\u0438\u0445 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432.<\/p>\n<p>\u0414\u043b\u044f \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043c\u043d\u043e\u0433\u0438\u043c\u0438 Linux-\u0445\u043e\u0441\u0442\u0430\u043c\u0438 (\u0434\u0430 \u0438 Windows, \u043a\u0441\u0442\u0430\u0442\u0438, \u0442\u043e\u0436\u0435) \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u043e\u0442\u043b\u0438\u0447\u043d\u044b\u0439 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u044f \u043e\u0447\u0435\u043d\u044c \u043b\u044e\u0431\u043b\u044e \u2014 Ansible. \u041e\u0434\u043d\u0430\u043a\u043e \u0434\u043b\u044f \u0435\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0441\u0435\u0440\u0432\u0435\u0440, \u0441 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0431\u0443\u0434\u0443\u0442 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c\u0441\u044f \u043f\u043b\u0435\u0439\u0431\u0443\u043a\u0438. \u042d\u0442\u043e \u043f\u043e\u0434\u0440\u0430\u0437\u0443\u043c\u0435\u0432\u0430\u0435\u0442 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u044c \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0440\u0430\u0431\u043e\u0447\u0435\u0439 \u043c\u0430\u0448\u0438\u043d\u044b \u043d\u0430 Linux \u0438\u043b\u0438 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0439 \u043c\u0430\u0448\u0438\u043d\u044b.<\/p>\n<p>\u041d\u0435 \u0432\u0441\u0435\u0433\u0434\u0430 \u0443\u0434\u043e\u0431\u043d\u043e \u0438 \u0446\u0435\u043b\u0435\u0441\u043e\u043e\u0431\u0440\u0430\u0437\u043d\u043e \u043d\u043e\u0441\u0438\u0442\u044c \u0441 \u0441\u043e\u0431\u043e\u0439 \u043d\u043e\u0443\u0442\u0431\u0443\u043a, \u0438 \u044f \u043f\u0440\u0435\u0434\u043f\u043e\u0447\u0438\u0442\u0430\u044e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c Windows \u043d\u0430 \u0441\u0432\u043e\u0435\u043c \u0440\u0430\u0431\u043e\u0447\u0435\u043c \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0435, \u0445\u043e\u0442\u044f \u0445\u043e\u0440\u043e\u0448\u043e \u043e\u0440\u0438\u0435\u043d\u0442\u0438\u0440\u0443\u044e\u0441\u044c \u0432 \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b\u0435 Linux. \u042f \u0441\u0447\u0438\u0442\u0430\u044e, \u0447\u0442\u043e \u043e\u0442 \u043a\u0430\u0436\u0434\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u0441\u0442\u043e\u0438\u0442 \u0437\u0430\u0438\u043c\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u043b\u0443\u0447\u0448\u0435\u0435: Windows \u0434\u043b\u044f \u0434\u0435\u0441\u043a\u0442\u043e\u043f\u0430, \u0430 Linux \u2014 \u0434\u043b\u044f \u0441\u0435\u0440\u0432\u0435\u0440\u043e\u0432 \u0438 open-source \u0440\u0435\u0448\u0435\u043d\u0438\u0439 (\u044d\u0442\u043e \u043c\u043e\u0435 \u043b\u0438\u0447\u043d\u043e\u0435 \u043c\u043d\u0435\u043d\u0438\u0435, \u0438 \u044f \u0443\u0432\u0435\u0440\u0435\u043d, \u0447\u0442\u043e \u043c\u043d\u043e\u0433\u0438\u0435 \u0441 \u043d\u0438\u043c \u043d\u0435 \u0441\u043e\u0433\u043b\u0430\u0441\u044f\u0442\u0441\u044f, \u043d\u043e \u043e \u0432\u043a\u0443\u0441\u0430\u0445 \u043d\u0435 \u0441\u043f\u043e\u0440\u044f\u0442).<\/p>\n<p>\u041a\u0430\u043a \u0443\u043f\u0440\u043e\u0441\u0442\u0438\u0442\u044c \u0441\u0435\u0431\u0435 \u0436\u0438\u0437\u043d\u044c? \u041e\u0434\u0438\u043d \u0438\u0437 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u0432 \u2014 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c OrangePi, \u0430 \u0435\u0441\u043b\u0438 \u043d\u0435\u0442 \u0440\u0430\u0431\u043e\u0447\u0435\u0433\u043e \u043d\u043e\u0443\u0442\u0431\u0443\u043a\u0430, \u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u0432\u0441\u0435\u043c \u044d\u0442\u0438\u043c \u0441 \u043c\u043e\u0431\u0438\u043b\u044c\u043d\u043e\u0433\u043e \u0442\u0435\u043b\u0435\u0444\u043e\u043d\u0430. \u041a \u0441\u0447\u0430\u0441\u0442\u044c\u044e, \u0437\u0430\u043f\u0443\u0441\u043a \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0445 \u043f\u043b\u0435\u0439\u0431\u0443\u043a\u043e\u0432 \u043d\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0434\u0430\u0436\u0435 \u043d\u0430 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u043c \u044d\u043a\u0440\u0430\u043d\u0435 \u043c\u043e\u0431\u0438\u043b\u044c\u043d\u043e\u0433\u043e \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430.<\/p>\n<h2>\u0421\u043e\u0434\u0435\u0440\u0436\u0430\u043d\u0438\u0435:<\/h2>\n<ol>\n<li>\n<p>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 \u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0440\u043e\u043b\u0435\u0439 Ansible \u0434\u043b\u044f \u0434\u043b\u044f Debian-\u0445\u043e\u0441\u0442\u043e\u0432<\/p>\n<\/li>\n<li>\n<p>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0430 Ansible \u043d\u0430 Orange PI \u0438 \u0441\u043f\u0440\u044f\u0436\u0435\u043d\u0438\u0435 \u0435\u0433\u043e \u0441 \u043c\u043e\u0431\u0438\u043b\u044c\u043d\u044b\u043c \u0442\u0435\u043b\u0435\u0444\u043e\u043d\u043e\u043c<\/p>\n<\/li>\n<\/ol>\n<h4>\u0417\u0430\u0447\u0435\u043c \u044d\u0442\u043e \u043d\u0443\u0436\u043d\u043e?<\/h4>\n<p>\u041f\u043e\u0434\u044b\u0442\u043e\u0436\u0438\u043c \u0432\u044b\u0448\u0435\u0441\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u0435 \u0438 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043c\u0441\u044f, \u0447\u0435\u043c \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043f\u043e\u043b\u0435\u0437\u0435\u043d \u0442\u0430\u043a\u043e\u0439 \u043f\u0440\u043e\u0435\u043a\u0442:<\/p>\n<ul>\n<li>\n<p>\u041f\u0440\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0430\u0443\u0434\u0438\u0442\u0430 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0439 \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u0438<\/p>\n<\/li>\n<li>\n<p>\u0420\u0430\u0431\u043e\u0442\u0430 \u0441 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u043c\u0438, \u0438\u0437\u043e\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u043c\u0438 \u0434\u0440\u0443\u0433 \u043e\u0442 \u0434\u0440\u0443\u0433\u0430 \u0441\u0435\u0442\u044f\u043c\u0438<\/p>\n<\/li>\n<li>\n<p>\u0420\u0430\u0431\u043e\u0442\u0430 \u0432 \u0441\u0435\u0442\u0438 \u0431\u0435\u0437 \u0438\u043d\u0442\u0435\u0440\u043d\u0435\u0442\u0430 (\u043f\u0440\u0438 \u043d\u0430\u043b\u0438\u0447\u0438\u0438 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0437\u0435\u0440\u043a\u0430\u043b\u0430 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u044f)<\/p>\n<\/li>\n<li>\n<p>\u041c\u043e\u0431\u0438\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0438 \u043f\u0440\u043e\u0441\u0442\u043e\u0442\u0430 \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u044f<\/p>\n<\/li>\n<\/ul>\n<h4>\u0427\u0442\u043e \u043c\u044b \u0438\u043c\u0435\u0435\u043c:<\/h4>\n<ol>\n<li>\n<p>\u0422\u0435\u0441\u0442\u043e\u0432\u044b\u0439 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0439 \u0445\u043e\u0441\u0442<\/p>\n<\/li>\n<li>\n<p>Orange Pi 3 LTS<\/p>\n<\/li>\n<li>\n<p>\u041c\u043e\u0431\u0438\u043b\u044c\u043d\u044b\u0439 \u0442\u0435\u043b\u0435\u0444\u043e\u043d \u0441 \u041e\u0421 Android<\/p>\n<\/li>\n<\/ol>\n<h4>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 Ansible<\/h4>\n<p>\u0412 \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u043c\u044b \u043a\u043e\u0441\u043d\u0435\u043c\u0441\u044f \u0442\u0435\u043c\u044b \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0439 \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u0438 \u0438 \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u0438\u043c \u0440\u043e\u043b\u0438, \u0446\u0435\u043d\u0442\u0440\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u043e \u0437\u0430\u043a\u0440\u044b\u0432\u0430\u044e\u0449\u0438\u0435 \u043d\u0430 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u044b\u0445 \u0445\u043e\u0441\u0442\u0430\u0445 \u0432\u0441\u0435 \u043f\u043e\u0440\u0442\u044b, \u043a\u0440\u043e\u043c\u0435 \u0442\u0435\u0445, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u044b. \u0422\u0430\u043a\u0436\u0435 \u043c\u044b \u0437\u0430\u0449\u0438\u0442\u0438\u043c \u043d\u0430\u0448\u0438 \u043c\u0430\u0448\u0438\u043d\u044b \u043e\u0442 \u0431\u0440\u0443\u0442\u0444\u043e\u0440\u0441\u0430 (\u043f\u0435\u0440\u0435\u0431\u043e\u0440\u0430 \u043f\u0430\u0440\u043e\u043b\u0435\u0439) \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e fail2ban. \u041e\u0431\u044b\u0447\u043d\u043e \u044f \u043d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u044e sudo \u0438 \u0434\u0435\u043b\u0430\u044e \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u044e \u043f\u043e RSA-\u043a\u043b\u044e\u0447\u0430\u043c, \u043d\u043e \u0432 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u043c\u044b \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0442\u044c \u044d\u0442\u043e \u043d\u0435 \u0431\u0443\u0434\u0435\u043c, \u0447\u0442\u043e\u0431\u044b \u043d\u0435 \u0434\u0435\u043b\u0430\u0442\u044c \u0441\u0442\u0430\u0442\u044c\u044e \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u043e\u0431\u044a\u0435\u043c\u043d\u043e\u0439. \u0415\u0441\u043b\u0438 \u044d\u0442\u043e\u0442 \u0432\u043e\u043f\u0440\u043e\u0441 \u0432\u0430\u043c \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0435\u043d, \u043d\u0430\u043f\u0438\u0448\u0438\u0442\u0435 \u0432 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u044f\u0445, \u0438 \u043c\u044b \u0435\u0433\u043e \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0432 \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u043c.<\/p>\n<p>\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043c Ansible<\/p>\n<p><code>sudo apt install ansible<\/code><\/p>\n<p>\u0420\u043e\u043b\u0438 \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u0438\u043c \u0437\u0430\u0440\u0430\u043d\u0435\u0435 \u0432 \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u0439 \u0441\u0440\u0435\u0434\u0435, \u0430 \u043f\u043e\u0442\u043e\u043c \u0447\u0435\u0440\u0435\u0437 git \u043f\u0435\u0440\u0435\u043d\u0435\u0441\u0435\u043c \u043d\u0430 \u043d\u0430\u0448 \u043c\u043e\u0431\u0438\u043b\u044c\u043d\u044b\u0439 \u0441\u0435\u0440\u0432\u0435\u0440 \u0434\u043b\u044f \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u0439 \u0440\u0430\u0431\u043e\u0442\u044b. \u041d\u0430\u0447\u043d\u0435\u043c \u0441 \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043a\u0440\u0430\u0439\u043d\u0435 \u0432\u0430\u0436\u043d\u043e \u0434\u043b\u044f Ansible. \u0414\u043b\u044f \u0435\u0433\u043e \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e\u0439 \u0440\u0430\u0431\u043e\u0442\u044b \u0434\u043e\u043b\u0436\u043d\u0430 \u0431\u044b\u0442\u044c \u0441\u043e\u0437\u0434\u0430\u043d\u0430 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u0430\u044f \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u043e\u0432. \u041a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0439 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e, \u043d\u043e \u043c\u043e\u0439 \u0440\u0430\u0431\u043e\u0447\u0438\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u0431\u0435\u0437 \u043b\u0438\u0448\u043d\u0438\u0445 \u0434\u0435\u0442\u0430\u043b\u0435\u0439 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<p>.<br \/>\u251c\u2500\u2500 ansible.cfg<br \/>\u251c\u2500\u2500 inventory<br \/>\u2502 \u251c\u2500\u2500 group_vars<br \/>\u2502 \u251c\u2500\u2500 hosts<br \/>\u2502 \u251c\u2500\u2500 host_vars<br \/>\u2502 \u2502 \u2514\u2500\u2500 ansible-test<br \/>\u2502 \u2514\u2500\u2500 secrets.yml<br \/>\u251c\u2500\u2500 playbooks<br \/>\u2502 \u2514\u2500\u2500 test<br \/>\u2502 \u2514\u2500\u2500 test.yml<br \/>\u251c\u2500\u2500 requirements.txt<br \/>\u251c\u2500\u2500 requirements.yml<br \/>\u251c\u2500\u2500 roles<br \/>\u2502 \u2514\u2500\u2500 secure<br \/>\u2502 \u251c\u2500\u2500 fail2ban<br \/>\u2502 \u2514\u2500\u2500 ufw<br \/>\u2514\u2500\u2500 Vagrantfile<\/p>\n<p><strong>requirements.txt \u0438 requirements.yml<\/strong><\/p>\n<p>\u043f\u0440\u0435\u0434\u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u044b \u0434\u043b\u044f \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0435\u0439: requirements.yml \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0435\u0439 \u0441 ansible-galaxy, \u0430 requirements.txt \u2014 \u0434\u043b\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a \u0432 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0435 \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u0435 Python. \u0422\u0430\u043a\u0436\u0435 \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u044e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c Ansible-lint \u2014 \u043e\u0442\u043b\u0438\u0447\u043d\u0443\u044e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 \u0434\u043b\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u0440\u043e\u043b\u0435\u0439. \u041d\u0430\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u043e \u0441\u043e\u0432\u0435\u0442\u0443\u044e \u0438\u0437\u0443\u0447\u0438\u0442\u044c \u044d\u0442\u043e\u0442 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442, \u0435\u0441\u043b\u0438 \u0432\u044b \u0445\u043e\u0442\u0438\u0442\u0435 \u043f\u0438\u0441\u0430\u0442\u044c \u0447\u0438\u0441\u0442\u044b\u0435 \u0440\u043e\u043b\u0438 \u0438 \u0438\u0437\u0431\u0435\u0433\u0430\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0445 \u043e\u0448\u0438\u0431\u043e\u043a \u0432 \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u043c \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u0438.<\/p>\n<h4>ansible.cfg<\/h4>\n<p>\u0412 \u044d\u0442\u043e\u043c \u0444\u0430\u0439\u043b\u0435 \u043c\u044b \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c \u043f\u0443\u0442\u0438 \u043a \u043d\u0430\u0448\u0438\u043c \u0440\u043e\u043b\u044f\u043c, \u043a\u043b\u044e\u0447\u0430\u043c, \u043c\u0435\u0442\u043e\u0434\u0430\u043c \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0441\u043f\u043e\u0441\u043e\u0431\u0443 \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u043a\u044d\u0448\u0430, \u0447\u0442\u043e \u0441\u043e\u043a\u0440\u0430\u0449\u0430\u0435\u0442 \u0432\u0440\u0435\u043c\u044f \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043d\u043e\u0432\u044b\u0445 \u0440\u043e\u043b\u0435\u0439.<\/p>\n<pre><code class=\"yaml\">[defaults] skip_ansible_lint = True host_key_checking = False inventory = inventory\/hosts roles_path = roles\/secure private_key_file = ~\/.ssh\/id_rsa become_method = sudo become_user = root # \u043a\u0435\u0448\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0444\u0430\u043a\u0442\u043e\u0432 gathering = smart # 1 \u0447\u0430\u0441\u00a0 fact_caching_timeout = 3600\u00a0 # \u043a\u0435\u0448 \u0432 jsonfact_caching = jsonfile fact_caching_connection = \/tmp\/ansible_fact_cache<\/code><\/pre>\n<h4>inventory<\/h4>\n<p>\u0414\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044f \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043c\u044b \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u043c \u0441 \u0447\u0435\u043c \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c.<\/p>\n<p><strong>group_vars\/all.yml<\/strong>\u00a0\u0443\u0434\u043e\u0431\u0435\u043d \u0434\u043b\u044f \u0443\u043a\u0430\u0437\u0430\u043d\u0438\u044f \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445, \u043e\u0431\u0449\u0438\u0445 \u0434\u043b\u044f \u0432\u0441\u0435\u0445 \u0440\u043e\u043b\u0435\u0439. \u042d\u0442\u043e \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u0430\u0434\u0440\u0435\u0441\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u043e\u0432, \u0438\u043c\u0435\u043d\u0430 \u0441\u043b\u0443\u0436\u0431, \u043f\u0440\u043e\u043a\u0441\u0438 \u0438, \u0432 \u043e\u0431\u0449\u0435\u043c, \u0432\u0441\u0435, \u0447\u0442\u043e \u043f\u0435\u0440\u0438\u043e\u0434\u0438\u0447\u0435\u0441\u043a\u0438 \u043d\u0443\u0436\u043d\u043e \u0432 \u043d\u0430\u0448\u0438\u0445 \u0440\u043e\u043b\u044f\u0445 \u0438 \u0447\u0442\u043e \u043d\u0435 \u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u0431\u044b \u0434\u0443\u0431\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c.<\/p>\n<p>\u0424\u0430\u0439\u043b\u044b, \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u044e\u0449\u0438\u0435 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044e \u0445\u043e\u0441\u0442\u043e\u0432, \u0445\u0440\u0430\u043d\u044f\u0442\u0441\u044f \u0432 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0438\u00a0<strong>host_vars<\/strong>, \u0432 \u0444\u0430\u0439\u043b\u0435\u00a0<strong>secrets.yml<\/strong>\u00a0\u0443\u0434\u043e\u0431\u043d\u043e \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u043f\u0430\u0440\u043e\u043b\u0438 \u0438 \u043f\u0440\u043e\u0447\u0438\u0435 \u043a\u043e\u043d\u0444\u0438\u0434\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435. \u042d\u0442\u0438 \u0444\u0430\u043a\u0442\u044b \u044f \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u044e \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0432 \u0448\u0438\u0444\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u043c \u0432\u0438\u0434\u0435 \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c\u00a0<strong>Ansible Vault<\/strong>. \u0422\u0430\u043a\u0436\u0435 \u0432\u0430\u0436\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u044d\u0442\u043e\u0442 \u0444\u0430\u0439\u043b\u044b \u0432\u00a0<strong>.gitignore<\/strong>, \u0447\u0442\u043e\u0431\u044b \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0435\u0433\u043e \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e \u043d\u0430 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0435 \u0438 \u043d\u0435 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u0432 \u0443\u0434\u0430\u043b\u0435\u043d\u043d\u044b\u0439 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439.<\/p>\n<h4>.gitignore<\/h4>\n<pre><code class=\"yaml\"># \u0418\u0433\u043d\u043e\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432\u0441\u0435 \u0444\u0430\u0439\u043b\u044b \u0432 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0438 inventory\/host_vars\/ inventory\/host_vars\/*<\/code><\/pre>\n<p>\u041f\u0440\u0438 \u0448\u0438\u0444\u0440\u043e\u0432\u0430\u043d\u0438\u0438 \u043c\u044b \u0432\u0432\u043e\u0434\u0438\u043c \u043f\u0430\u0440\u043e\u043b\u044c, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432 \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u043c \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0435 \u043f\u043b\u0435\u0439\u0431\u0443\u043a\u043e\u0432:<\/p>\n<p><code>ansible-vault encrypt inventory\/secrets.yml # \u0448\u0438\u0444\u0440\u043e\u0432\u0430\u0442\u044c<\/code><\/p>\n<p><code>ansible-vault edit inventory\/secrets.yml\u00a0 \u00a0 # \u0440\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c<\/code><\/p>\n<p><code>ansible-vault decrypt inventory\/secrets.yml # \u0440\u0430\u0441\u0448\u0438\u0444\u0440\u043e\u0432\u0430\u0442\u044c<\/code><\/p>\n<h4>hosts<\/h4>\n<p>\u0412 \u044d\u0442\u043e\u043c \u0444\u0430\u0439\u043b\u0435 \u043c\u044b \u0443\u043a\u0430\u0436\u0435\u043c \u0445\u043e\u0441\u0442\u044b, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0433\u0440\u0443\u043f\u043f\u044b, \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u0445\u043e\u0434\u044f\u0442 \u044d\u0442\u0438 \u0445\u043e\u0441\u0442\u044b.<\/p>\n<pre><code>[test] ansible-test  [localhost] 127.0.0.1 ansible_connection=local<\/code><\/pre>\n<p>\u0422\u0430\u043a\u0436\u0435 \u0432 \u044d\u0442\u043e\u043c \u0444\u0430\u0439\u043b\u0435 \u043c\u043e\u0436\u043d\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u0430\u0434\u0440\u0435\u0441\u0430 \u0438 \u043f\u0430\u0440\u043e\u043b\u0438 \u043d\u0430\u0448\u0438\u0445 \u0445\u043e\u0441\u0442\u043e\u0432, \u043d\u043e \u0441 \u0442\u043e\u0447\u043a\u0438 \u0437\u0440\u0435\u043d\u0438\u044f \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u0438 \u044d\u0442\u043e \u043d\u0435 \u0441\u0430\u043c\u043e\u0435 \u043b\u0443\u0447\u0448\u0435\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0438\u0445 \u043c\u044b \u0443\u043a\u0430\u0436\u0435\u043c \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0445 \u0444\u0430\u0439\u043b\u0430\u0445, \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0445 \u0438\u043c\u0435\u043d\u0430\u043c \u0445\u043e\u0441\u0442\u043e\u0432 \u0432 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0438 host_vars<\/p>\n<p><strong>host_vars\/ansible-test<\/strong><\/p>\n<pre><code>ansible_become: true ansible_host: 192.168.2.16 ansible_user: vagrant ansible_ssh_pass: vagrant ansible_become_pass: vagrant<\/code><\/pre>\n<p>\u041d\u0435 \u0437\u0430\u0431\u044b\u0432\u0430\u0435\u043c \u0437\u0430\u0448\u0438\u0444\u0440\u043e\u0432\u0430\u0442\u044c \u0444\u0430\u0439\u043b \u0447\u0435\u0440\u0435\u0437\u00a0<strong>ansible-vault<\/strong><\/p>\n<p><code>ansible-vault encrypt inventory\/host_vars\/ansible-test<\/code><\/p>\n<p><strong>Vagrantfile<\/strong><\/p>\n<p>\u042d\u0442\u043e\u0442 \u0444\u0430\u0439\u043b \u043c\u044b \u043d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u043c \u0441 \u0443\u0447\u0435\u0442\u043e\u043c \u043d\u0430\u0448\u0435\u0433\u043e \u0433\u0438\u043f\u0435\u0440\u0432\u0438\u0437\u043e\u0440\u0430, \u043a \u0442\u0435\u043c\u0435 \u043d\u0430\u0448\u0435\u0439 \u0441\u0442\u0430\u0442\u044c\u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 vagrant \u043d\u0435 \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0441\u044f, \u043d\u043e \u0435\u0441\u043b\u0438 \u043a\u0440\u0430\u0442\u043a\u043e, \u0442\u043e \u044d\u0442\u043e\u0442 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0439 \u0444\u0430\u0439\u043b \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0442 \u043e\u043f\u0438\u0441\u0430\u0442\u044c \u0432\u0441\u0435 \u0430\u0441\u043f\u0435\u043a\u0442\u044b \u0436\u0435\u043b\u0430\u0435\u043c\u043e\u0439 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0439 \u043c\u0430\u0448\u0438\u043d\u044b \u0438 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0435\u0435 \u043e\u0434\u043d\u043e\u0439 \u043a\u043e\u043c\u0430\u043d\u0434\u043e\u0439.<\/p>\n<p>\u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u043d\u0430\u0448 Vagrantfile \u043d\u0430 \u0433\u0438\u043f\u0435\u0440\u0432\u0438\u0437\u043e\u0440\u0435 \u0438\u043b\u0438 \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u0442\u0435\u0441\u0442\u043e\u0432\u0443\u044e \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u0443\u044e \u043c\u0430\u0448\u0438\u043d\u0443 \u0441\u0430\u043c\u043e\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u043e. \u042f \u043f\u0440\u0435\u0434\u043f\u043e\u0447\u0438\u0442\u0430\u044e \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0430\u0446\u0438\u044e, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0434\u043e\u0432\u0435\u0440\u044e \u0432\u0441\u0435 \u0437\u0430\u0440\u0430\u043d\u0435\u0435 \u043f\u0440\u043e\u043f\u0438\u0441\u0430\u043d\u043d\u043e\u043c\u0443 \u043a\u043e\u0434\u0443.<\/p>\n<figure class=\"full-width\">\n<div><figcaption>\u0421\u043e\u0437\u0434\u0430\u0435\u043c \u0442\u0435\u0441\u0442\u043e\u0432\u0443\u044e \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u0443\u044e \u043c\u0430\u0448\u0438\u043d\u0443<\/figcaption><\/div>\n<\/figure>\n<p>\u0414\u043b\u044f \u0442\u043e\u0433\u043e \u0447\u0442\u043e\u0431\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u0430\u0440\u043e\u043b\u044c\u043d\u0443\u044e \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044e Ansible \u0432\u043c\u0435\u0441\u0442\u043e \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u043f\u043e \u043a\u043b\u044e\u0447\u0430\u043c, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u043e\u0439 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e, \u043d\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0443\u044e \u0443\u0442\u0438\u043b\u0438\u0442\u0443:<\/p>\n<p><code>sudo apt install sshpass<\/code><\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043c\u044b \u0433\u043e\u0442\u043e\u0432\u044b \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c, \u043d\u0430\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043d \u043d\u0430\u0448 \u0438\u043d\u0432\u0435\u043d\u0442\u0430\u0440\u044c. \u041d\u0435 \u0437\u0430\u0431\u044b\u0432\u0430\u0439\u0442\u0435 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u0437\u0430\u043f\u0440\u043e\u0441 \u043f\u0430\u0440\u043e\u043b\u044f \u0434\u043b\u044f Ansible Vault:<\/p>\n<p><code>ansible all -m ping --ask-vault-pass<\/code><\/p>\n<figure class=\"full-width\">\n<div><figcaption>\u0423\u0441\u043f\u0435\u0448\u043d\u044b\u0439 \u043e\u0442\u0447\u0435\u0442 \u043e \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438 \u0441\u0432\u044f\u0437\u0438 \u0441 \u0445\u043e\u0441\u0442\u0430\u043c\u0438<\/figcaption><\/div>\n<\/figure>\n<h3>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u0440\u043e\u043b\u0435\u0439<\/h3>\n<h4>\u0420\u043e\u043b\u044c UFW<\/h4>\n<p>\u0415\u0441\u0442\u044c \u0434\u0432\u0430 \u043f\u043e\u0434\u0445\u043e\u0434\u0430 \u0432 \u0440\u0430\u0431\u043e\u0442\u0435 \u0441 Ansible, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0437\u0430\u0432\u0438\u0441\u044f\u0442 \u043e\u0442 \u043c\u0430\u0441\u0448\u0442\u0430\u0431\u043d\u043e\u0441\u0442\u0438 \u0432\u0430\u0448\u0438\u0445 \u0437\u0430\u0434\u0430\u0447. \u0415\u0441\u043b\u0438 \u0432\u044b \u0445\u043e\u0442\u0438\u0442\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u043f\u0440\u043e\u0441\u0442\u043e\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u043f\u0430\u043a\u0435\u0442\u044b, \u0441\u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0444\u0430\u0439\u043b\u044b \u0438\u043b\u0438 \u043f\u0435\u0440\u0435\u043d\u0435\u0441\u0442\u0438 \u0434\u0430\u043d\u043d\u044b\u0435, \u0432\u0430\u043c \u0431\u0443\u0434\u0435\u0442 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043e\u0434\u0438\u043d\u043e\u0447\u043d\u044b\u0439 Ansible \u0444\u0430\u0439\u043b \u0441 \u0443\u043a\u0430\u0437\u0430\u043d\u0438\u0435\u043c \u0445\u043e\u0441\u0442\u043e\u0432, \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0438 \u043f\u043b\u0435\u0439\u0431\u0443\u043a\u043e\u0432. \u041e\u043d \u043b\u0435\u0433\u043a\u043e \u043f\u0435\u0440\u0435\u043d\u043e\u0441\u0438\u0442\u0441\u044f, \u043f\u0440\u043e\u0441\u0442 \u0432 \u043e\u0444\u043e\u0440\u043c\u043b\u0435\u043d\u0438\u0438 \u0438 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0443\u0434\u043e\u0431\u0435\u043d \u0434\u043b\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0441\u0442\u044b\u0445 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0439. \u041e\u0434\u043d\u0430\u043a\u043e \u0441 \u0440\u043e\u0441\u0442\u043e\u043c \u043c\u0430\u0441\u0448\u0442\u0430\u0431\u043e\u0432 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u0442\u0430\u043a\u0438\u043c\u0438 \u0444\u0430\u0439\u043b\u0430\u043c\u0438 \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u0441\u043b\u043e\u0436\u043d\u0435\u0435, \u0438 \u0442\u0443\u0442 \u043d\u0430 \u043f\u043e\u043c\u043e\u0449\u044c \u043f\u0440\u0438\u0445\u043e\u0434\u044f\u0442 \u0440\u043e\u043b\u0438.<\/p>\n<p>\u0420\u043e\u043b\u0438 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0442 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432\u0430\u0448\u0438 \u043f\u043b\u0435\u0439\u0431\u0443\u043a\u0438 \u0438 \u0443\u043f\u0440\u043e\u0441\u0442\u0438\u0442\u044c \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0435\u0439, \u0440\u0430\u0437\u0431\u0438\u0432\u0430\u044f \u0435\u0433\u043e \u043d\u0430 \u0431\u043e\u043b\u0435\u0435 \u043c\u0435\u043b\u043a\u0438\u0435 \u0438 \u043f\u043e\u043d\u044f\u0442\u043d\u044b\u0435 \u0447\u0430\u0441\u0442\u0438. \u041a\u0430\u0436\u0434\u0430\u044f \u0440\u043e\u043b\u044c \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u043e\u0431\u043e\u0439 \u043d\u0430\u0431\u043e\u0440 \u0437\u0430\u0434\u0430\u0447, \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432, \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0438 \u0434\u0440\u0443\u0433\u0438\u0445 \u0444\u0430\u0439\u043b\u043e\u0432, \u0441\u0433\u0440\u0443\u043f\u043f\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u043f\u043e \u0432\u0430\u0448\u0435\u043c\u0443 \u0432\u044b\u0431\u043e\u0440\u0443. \u042d\u0442\u043e \u0443\u043f\u0440\u043e\u0449\u0430\u0435\u0442 \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u043e\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u043a\u043e\u0434\u0430 \u0438 \u0434\u0435\u043b\u0430\u0435\u0442 \u0435\u0433\u043e \u0431\u043e\u043b\u0435\u0435 \u0447\u0438\u0442\u0430\u0435\u043c\u044b\u043c. \u0413\u043b\u0430\u0432\u043d\u043e\u0435 \u043f\u0440\u0430\u0432\u0438\u043b\u043e \u2013 \u043a\u0430\u0436\u0434\u0430\u044f \u0440\u043e\u043b\u044c \u0434\u043e\u043b\u0436\u043d\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0435 \u0437\u0430\u0432\u0435\u0440\u0448\u0451\u043d\u043d\u043e\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u0438 \u0431\u044b\u0442\u044c \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u0443\u043d\u0438\u0432\u0435\u0440\u0441\u0430\u043b\u044c\u043d\u043e\u0439. \u0412 \u0441\u043b\u043e\u0436\u043d\u044b\u0445 \u0440\u043e\u043b\u044f\u0445 \u044f, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u044e \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u043e\u043f\u0446\u0438\u0439 \u0434\u043b\u044f \u0431\u043e\u043b\u044c\u0448\u0435\u0439 \u0432\u0430\u0440\u0438\u0430\u0442\u0438\u0432\u043d\u043e\u0441\u0442\u0438 \u0438 \u0443\u043d\u0438\u0432\u0435\u0440\u0441\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u0438, \u0447\u0442\u043e\u0431\u044b \u043d\u0435 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u0440\u043e\u043b\u0435\u0439, \u0430 \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u044f\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u043c\u0435\u0436\u043d\u044b\u0445 \u0432 \u043e\u0434\u043d\u0443.<\/p>\n<p>\u0412 \u043d\u0430\u0448\u0435\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u043c\u044b \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0434\u0432\u0435 \u0440\u043e\u043b\u0438: \u043f\u0435\u0440\u0432\u0430\u044f \u2014 ufw, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442 \u0444\u0430\u0439\u0440\u0432\u043e\u043b, \u0438 \u0432\u0442\u043e\u0440\u0430\u044f \u2014 fail2ban, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0442 \u0437\u0430\u0449\u0438\u0442\u0443 \u043e\u0442 \u0431\u0440\u0443\u0442\u0444\u043e\u0440\u0441-\u0430\u0442\u0430\u043a.<\/p>\n<p>\u0414\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0432\u0441\u0435\u0439 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u043e\u0432 \u0440\u043e\u043b\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u043a\u043e\u043c\u0430\u043d\u0434\u0443<\/p>\n<p><code>ansible-galaxy role init roles\/secure\/ufw<\/code><\/p>\n<p>\u043f\u0435\u0440\u0435\u0439\u0434\u0435\u043c \u0432 \u043a\u0430\u0442\u0430\u043b\u043e\u0433 \u0440\u043e\u043b\u0438<\/p>\n<p><code>cd roles\/secure\/ufw<\/code><\/p>\n<p>\u0418\u0437\u0443\u0447\u0438\u043c \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443<\/p>\n<p><code>tree<\/code><\/p>\n<p>.<br \/>\u251c\u2500\u2500 defaults<br \/>\u2502 \u2514\u2500\u2500 main.yml<br \/>\u251c\u2500\u2500 files<br \/>\u251c\u2500\u2500 handlers<br \/>\u2502 \u2514\u2500\u2500 main.yml<br \/>\u251c\u2500\u2500 meta<br \/>\u2502 \u2514\u2500\u2500 main.yml<br \/>\u251c\u2500\u2500 README.md<br \/>\u251c\u2500\u2500 tasks<br \/>\u2502 \u2514\u2500\u2500 main.yml<br \/>\u251c\u2500\u2500 templates<br \/>\u251c\u2500\u2500 tests<br \/>\u2502 \u251c\u2500\u2500 inventory<br \/>\u2502 \u2514\u2500\u2500 test.yml<br \/>\u2514\u2500\u2500 vars<br \/>\u2514\u2500\u2500 main.yml<\/p>\n<p>\u0420\u043e\u043b\u044c \u043f\u0440\u043e\u0441\u0442\u0430\u044f, \u0442\u0443\u0442 \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e 2 \u0444\u0430\u0439\u043b\u0430, \u0444\u0430\u0439\u043b \u0441 \u0437\u0430\u0434\u0430\u0447\u0430\u043c\u0438\u00a0<strong>tasks\/main.yml<\/strong>\u00a0\u0438 \u0444\u0430\u0439\u043b \u0441 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u043c\u0438 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e\u00a0<strong>defaults\/main.yml<\/strong><\/p>\n<h4>tasks\/main.yml<\/h4>\n<pre><code class=\"yaml\">--- # tasks file for roles\/common\/ufw - name: Ensure UFW is installed     ansible.builtin.apt:         name: ufw         state: present     become: true  - name: Set default outgoing policy to allow     community.general.ufw:         default: allow         direction: outgoing     become: true  - name: Allow SSH connections     community.general.ufw:         rule: allow         port: 22         proto: tcp     become: true  - name: Ensure UFW is enabled and set to start on boot     community.general.ufw:         state: enabled     become: true  - name: Add custom rules     community.general.ufw:         rule: \"{{ item.rule }}\"         port: \"{{ item.port }}\"         proto: \"{{ item.proto }}\"     loop: \"{{ ufw__rules }}\"     become: true<\/code><\/pre>\n<p>\u0412 \u043f\u0435\u0440\u0432\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0435 \u043c\u044b \u0443\u0431\u0435\u0436\u0434\u0430\u0435\u043c\u0441\u044f, \u0447\u0442\u043e ufw \u0443 \u043d\u0430\u0441 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d. \u0415\u0441\u043b\u0438 \u043e\u043d \u043d\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d, Ansible \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442 \u0435\u0433\u043e \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0443. \u041f\u0440\u0435\u043a\u0440\u0430\u0441\u043d\u043e\u0435 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e Ansible, \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u043c\u043e\u0435 \u0438\u0434\u0435\u043c\u043f\u043e\u0442\u0435\u043d\u0442\u043d\u043e\u0441\u0442\u044c\u044e, \u043d\u0435 \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u043e\u0434\u043d\u043e \u0438 \u0442\u043e \u0436\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0440\u0430\u0437, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043d\u0435 \u0431\u0435\u0441\u043f\u043e\u043a\u043e\u0438\u0442\u044c\u0441\u044f \u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0445 \u043e\u0448\u0438\u0431\u043a\u0430\u0445 \u043f\u0440\u0438 \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u043e\u043c \u0437\u0430\u043f\u0443\u0441\u043a\u0435 \u043a\u043e\u0434\u0430.<\/p>\n<p>\u041e\u0434<em>\u043d\u0430\u043a\u043e \u0432\u0430\u0436\u043d\u043e \u043f\u043e\u043c\u043d\u0438\u0442\u044c, \u0447\u0442\u043e \u044d\u0442\u043e \u043f\u0440\u0430\u0432\u0438\u043b\u043e \u043a\u0430\u0441\u0430\u0435\u0442\u0441\u044f \u0437\u0430\u0434\u0430\u0447, \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c\u044b\u0445 \u043c\u043e\u0434\u0443\u043b\u044f\u043c\u0438 Ansible, \u0438 \u043d\u0435 \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0441\u044f \u043a \u043a\u043e\u043c\u0430\u043d\u0434\u0430\u043c, \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u043c\u044b\u043c \u0447\u0435\u0440\u0435\u0437 \u043c\u043e\u0434\u0443\u043b\u0438 \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b\u0430!<\/em><\/p>\n<p><em>\u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u0442\u0430\u043a\u043e\u0439 \u043c\u043e\u0434\u0443\u043b\u044c \u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u0438\u043c\u0435\u0442\u044c \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 \u0438\u0434\u0435\u043c\u043f\u043e\u0442\u0435\u043d\u0442\u043d\u043e\u0441\u0442\u0438<\/em><\/p>\n<pre><code class=\"yaml\">- name: \u0423\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u043f\u0430\u043a\u0435\u0442 ufw \u0447\u0435\u0440\u0435\u0437 \u043a\u043e\u043c\u0430\u043d\u0434\u0443        command: apt-get install -y ufw<\/code><\/pre>\n<p><em>\u0410 \u0442\u0430\u043a\u043e\u0439 \u0431\u0443\u0434\u0435\u0442<\/em><\/p>\n<pre><code class=\"yaml\">- name: Ensure UFW is installed     ansible.builtin.apt:         name: ufw         state: present     become: true<\/code><\/pre>\n<p><em>\u0421\u043f\u0438\u0441\u043e\u043a \u0432\u0441\u0435\u0445 \u043c\u043e\u0434\u0443\u043b\u0435\u0439 \u0438 \u043e\u043f\u0446\u0438\u0439 \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043d\u0430 \u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u043c \u0441\u0430\u0439\u0442\u0435<\/em><a href=\"https:\/\/docs.ansible.com\/ansible\/latest\/collections\/ansible\/builtin\/\" rel=\"noopener noreferrer nofollow\"><em>\u00a0<u>Ansible<\/u><\/em><\/a><\/p>\n<pre><code class=\"yaml\">- name: Set default outgoing policy to allow     community.general.ufw:         default: allow         direction:<\/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-435987","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/435987","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=435987"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/435987\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=435987"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=435987"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=435987"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}