{"id":195048,"date":"2013-10-03T09:31:02","date_gmt":"2013-10-03T05:31:02","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=195048"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=195048","title":{"rendered":"<span class=\"post_title\">ansible<\/span>"},"content":{"rendered":"<div class=\"content html_format\">   \tAnsible \u2014 yet another \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044f\u043c\u0438. \u041e\u0442\u043b\u0438\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u0430\u044f \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u044c \u2014 \u043f\u0440\u043e\u0441\u0442\u043e\u0442\u0430, \u043f\u0440\u0438 \u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u0433\u0438\u0431\u043a\u043e\u0441\u0442\u0438. \u0418 \u044d\u0442\u043e \u043d\u0435 \u043f\u0440\u043e\u0441\u0442\u043e \u0441\u043b\u043e\u0432\u0430 \u2014 \u0434\u0430\u043b\u044c\u0448\u0435 \u044f \u043f\u043e\u043a\u0430\u0436\u0443 \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0430\u0445 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u043e\u0441\u0442\u0435\u0439\u0448\u0438\u0445 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439 \u0438 \u043f\u043e\u0437\u043d\u0430\u043a\u043e\u043c\u043b\u044e \u0432\u0430\u0441 \u0441 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u043c\u0438 \u201c\u0431\u0435\u0441\u0442 \u043f\u0440\u0430\u043a\u0442\u0438\u0441\u201d. <\/p>\n<p>  \u0418\u0442\u0430\u043a, \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u0433\u0440\u0443\u043f\u043f\u044b \u0445\u043e\u0441\u0442\u043e\u0432:  <\/p>\n<table>\n<tr>\n<td>WebServersG1<\/td>\n<td>webserver1-g1, webserver2-g1<\/td>\n<\/tr>\n<tr>\n<td>WebServersG2<\/td>\n<td>webserver1-g2, webserver2-g2<\/td>\n<\/tr>\n<tr>\n<td>WebServersProxy<\/td>\n<td>webserver-proxy1, webserver-proxy2<\/td>\n<\/tr>\n<tr>\n<td>DataBase<\/td>\n<td>db1, db2<\/td>\n<\/tr>\n<tr>\n<td>DataBaseSlave<\/td>\n<td>dbs1, dbs2<\/td>\n<\/tr>\n<tr>\n<td>SomeServers<\/td>\n<td>someserver1, someserver2<\/td>\n<\/tr>\n<\/table>\n<p>  \u041c\u044b \u0445\u043e\u0442\u0438\u043c \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u0438\u0442\u044c \u0432\u0441\u0435 \u0445\u043e\u0441\u0442\u044b \u043a \u0430\u0434\u0435\u043a\u0432\u0430\u0442\u043d\u043e\u0439 \u0440\u0430\u0431\u043e\u0442\u0435 \u2014 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0439 \u043d\u0430\u0431\u043e\u0440 \u0441\u043e\u0444\u0442\u0430 (htop, zsh, vim, iftop, sudo, mc, tmux, wget), \u0441\u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u0432\u043e\u0438 \u043a\u043b\u044e\u0447\u0438 \u0438 \u043a\u043e\u043d\u0444\u0438\u0433\u0438 \u0438 \u043f\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0438 \u0441\u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u043e\u0444\u0442 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u0447\u043d\u044b\u0439 \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0441\u0435\u0440\u0432\u0435\u0440\u0430. <br \/>  Ansible \u043f\u043e\u0434\u0440\u0430\u0437\u0443\u043c\u0435\u0432\u0430\u0435\u0442 \u043c\u0438\u043d\u0438\u043c\u0443\u043c \u0434\u0432\u0430 \u0444\u0430\u0439\u043b\u0430 \u0434\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u0440\u0430\u0431\u043e\u0442\u044b \u2014 <i>\u0438\u043d\u0432\u0435\u043d\u0442\u0430\u0440\u043d\u044b\u0439 \u0444\u0430\u0439\u043b<\/i>, \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u044b \u043f\u0438\u0448\u0435\u043c \u0441\u043f\u0438\u0441\u043e\u043a \u0445\u043e\u0441\u0442\u043e\u0432 \u0438 \u0434\u0435\u043b\u0438\u043c \u0438\u0445 \u043f\u043e \u0433\u0440\u0443\u043f\u043f\u0430\u043c \u2014 <b>inventory<\/b> \u0438 \u0444\u0430\u0439\u043b <i>\u0437\u0430\u0434\u0430\u0447<\/i> \u2014 <b>playbook<\/b>. <br \/>  \u041e\u043d\u0438 \u043d\u0443\u0436\u043d\u044b \u0434\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u043a\u043e\u0433\u0434\u0430 \u043c\u044b \u0432\u0441\u0435 \u0441\u0434\u0435\u043b\u0430\u0435\u043c \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0432\u0441\u0435 \u043a\u0440\u0430\u0441\u0438\u0432\u043e:<\/p>\n<pre><code class=\"bash\">ansible-playbook -i \u0438\u043d\u0432\u0435\u043d\u0442\u0430\u0440\u043d\u044b\u0439_\u0444\u0430\u0439\u043b playbook.yml <\/code><\/pre>\n<p>  \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0438\u043d\u0432\u0435\u043d\u0442\u0430\u0440\u043d\u044b\u0439 \u0444\u0430\u0439\u043b \u043f\u043e \u0438\u043c\u0435\u043d\u0438 \u201c<i>infrastructure<\/i>\u201d \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u043d\u0430\u0448\u0438\u0445 \u0445\u043e\u0441\u0442\u043e\u0432:<br \/>  <a name=\"habracut\"><\/a>  <\/p>\n<pre><code class=\"bash\">[WebServersG1] webserver1-g1 webserver2-g1 [WebServersG2] webserver1-g2 webserver2-g2 [WebServersProxy] webserver-proxy1 webserver-proxy2 [DataBase] db1 db2 [DataBaseSlave] dbs1 dbs2 [SomeServers] someserver1 someserver2 <\/code><\/pre>\n<p>  \u0421\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0432\u0441\u0435 \u043d\u0435 \u043f\u043b\u043e\u0445\u043e, \u043d\u043e \u043d\u0430\u0448\u0438 \u0445\u043e\u0441\u0442\u044b \u0438\u0437 \u0433\u0440\u0443\u043f\u043f <i>WebServersG1<\/i> \u0438 <i>WebServersG2<\/i> \u043e\u0442\u043b\u0438\u0447\u0430\u044e\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u043e\u0439 \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u043e\u0432, \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e\u043c \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0439 \u0438 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0435\u043c. \u0410 <i>WebServersProxy<\/i> \u043e\u0442\u043b\u0438\u0447\u0430\u0435\u0442\u0441\u044f \u043e\u0442 \u043d\u0438\u0445 \u0442\u043e\u043b\u044c\u043a\u043e \u043a\u043e\u043d\u0444\u0438\u0433\u043e\u043c nginx \u0438 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u0435\u043c \u043a\u0430\u043a\u043e\u0433\u043e-\u0442\u043e \u0441\u043e\u0444\u0442\u0430. \u041a \u0442\u043e\u043c\u0443 \u0436\u0435 \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u044c\u0441\u044f \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043a\u0430\u043a\u0443\u044e-\u0442\u043e \u0437\u0430\u0434\u0430\u0447\u0443 \u0441\u0440\u0430\u0437\u0443 \u043d\u0430 \u0432\u0441\u0435\u0445 \u0442\u0440\u0435\u0445 \u0433\u0440\u0443\u043f\u043f\u0430\u0445. \u0422\u0430\u043a \u0447\u0442\u043e \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u0441\u0440\u043e\u0434\u043d\u0438\u043c \u044d\u0442\u0438 \u0442\u0440\u0438 \u0433\u0440\u0443\u043f\u043f\u044b \u0438 \u0434\u0430\u0434\u0438\u043c \u0438\u043c <b>\u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044f<\/b>: <\/p>\n<pre><code class=\"bash\">[WEB:children] WebServersG1 WebServersG2 WebServersProxy <\/code><\/pre>\n<p>  \u041f\u043e \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0435 \u0438\u043d\u0432\u0435\u043d\u0442\u0430\u0440\u043d\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430: ansible \u0441\u0447\u0438\u0442\u0430\u0435\u0442 \u0433\u0440\u0443\u043f\u043f\u043e\u0439 \u0432\u0441\u0435, \u0447\u044c\u044f \u0441\u0442\u0440\u043e\u043a\u0430 \u0432 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0438 \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442\u0441\u044f \u0441 \u2018[\u2018 \u0438 \u0437\u0430\u043a\u0430\u043d\u0447\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u2018]\u2019. \u0412\u0441\u0435 \u0447\u0442\u043e \u043f\u043e\u0434 \u044d\u0442\u043e\u0439 \u0441\u0442\u0440\u043e\u0447\u043a\u043e\u0439 \u0438 \u0434\u043e \u043d\u0430\u0447\u0430\u043b\u0430 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u0433\u0440\u0443\u043f\u043f\u044b \u2014 \u0445\u043e\u0441\u0442\u044b. \u0423 \u0433\u0440\u0443\u043f\u043f\u044b \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u0434\u0435\u0442\u0438 \u2014 \u0434\u0440\u0443\u0433\u0438\u0435 \u0433\u0440\u0443\u043f\u043f\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u044f\u044e\u0442\u0441\u044f \u043f\u043e\u0441\u043b\u0435 <i>[\u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0433\u0440\u0443\u043f\u043f\u044b:children] <\/i>\u0438 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0442. <br \/>  \u0415\u0449\u0435 \u044f \u043a\u043e\u0440\u043e\u0442\u043a\u043e \u043a\u043e\u0441\u043d\u0443\u0441\u044c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0442\u043e\u0436\u0435 \u043c\u043e\u0436\u043d\u043e \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c \u0441\u0440\u0430\u0437\u0443 \u0432 \u044d\u0442\u043e\u043c \u0441\u043f\u0438\u0441\u043a\u0435. <\/p>\n<pre><code class=\"bash\">webserver1-g1 ansible_ssh_port=5555 ansible_ssh_host=192.168.1.50 <\/code><\/pre>\n<p>  \u0422\u0443\u0442 \u043c\u044b \u043d\u0430\u0437\u043d\u0430\u0447\u0438\u043b\u0438 <i>ssh \u043f\u043e\u0440\u0442<\/i> \u0438 <i>ssh \u0445\u043e\u0441\u0442<\/i>. \u041f\u043e \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435 \u0441\u043a\u0430\u0436\u0443 \u0447\u0442\u043e \u0434\u0440\u0443\u0433\u0438\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u0432 <i>inventory<\/i> \u0444\u0430\u0439\u043b\u0435 \u0435\u0433\u043e \u0437\u0430\u0445\u043b\u0430\u043c\u043b\u044f\u044e\u0442 \u0438 \u0434\u0435\u043b\u0430\u044e\u0442 \u043d\u0435\u0447\u0438\u0442\u0430\u0435\u043c\u044b\u043c. \u0414\u0430 \u0438 \u043d\u0435\u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0435 \u043f\u043e\u0440\u0442\u044b \u043b\u0443\u0447\u0448\u0435 \u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u044f\u0442\u044c \u0432 \u0442\u0430\u043a\u043e\u043c \u0432\u0438\u0434\u0435: <\/p>\n<pre><code class=\"bash\">webserver1-g1:5555 <\/code><\/pre>\n<p>  \u0418 \u0440\u0430\u0437 \u0443\u0436 \u0437\u0430\u0448\u043b\u0430 \u0440\u0435\u0447\u044c \u043e \u043f\u043e\u0440\u0442\u0430\u0445 \u2014 \u043f\u043e\u0440\u0442 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0434\u043b\u044f \u0432\u0441\u0435\u0445 \u0445\u043e\u0441\u0442\u043e\u0432 (\u043a\u0430\u043a \u0438 \u043c\u043d\u043e\u0433\u043e\u0435 \u0434\u0440\u0443\u0433\u043e\u0435) \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0437\u043d\u0430\u0447\u0438\u0442\u044c \u0438 \u0432 <i>ansible.cfg,<\/i> \u043d\u043e \u043d\u0435 \u0441\u0443\u0442\u044c.<br \/>  \u0418\u0442\u0430\u043a, \u043c\u044b \u0442\u043e\u043b\u044c\u043a\u043e \u0447\u0442\u043e \u0441\u043e\u0437\u0434\u0430\u043b\u0438 \u0441\u043f\u0438\u0441\u043e\u043a \u0445\u043e\u0441\u0442\u043e\u0432. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0442\u0435\u043f\u0435\u0440\u044c \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0441\u043f\u0438\u0441\u043e\u043a \u0437\u0430\u0434\u0430\u0447, \u0430 \u044f \u043e\u043a\u0443\u043d\u0443\u0441\u044c \u0432 \u0432\u043e\u0441\u043f\u043e\u043c\u0438\u043d\u0430\u043d\u0438\u044f. <br \/>  \u0412 \u0434\u0430\u043b\u0435\u043a\u0438\u0435 \u0432\u0440\u0435\u043c\u0435\u043d\u0430 (\u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u043c\u0430\u0439-\u0438\u044e\u043b\u044c \u044d\u0442\u043e\u0433\u043e \u0433\u043e\u0434\u0430), \u0434\u043e \u0432\u044b\u0445\u043e\u0434\u0430 \u0432\u0435\u0440\u0441\u0438\u0438 1.2 \u0440\u043e\u043b\u0435\u0439 \u043d\u0435 \u0431\u044b\u043b\u043e \u0432 \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0435, \u043c\u044b \u0434\u043e\u0432\u043e\u043b\u044c\u0441\u0442\u0432\u043e\u0432\u0430\u043b\u0438\u0441\u044c \u043e\u0431\u044b\u0447\u043d\u044b\u043c\u0438 \u0442\u0430\u0441\u043a\u0430\u043c\u0438 \u0438 \u043f\u043b\u0435\u0439\u0431\u0443\u043a \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u043b \u043a\u0430\u043a \u0435\u043b\u043a\u0430 \u043f\u0435\u0441\u0442\u0440\u0435\u0432\u0448\u0430\u044f \u0438\u043d\u043a\u043b\u0443\u0434\u0430\u043c\u0438. \u041f\u043e\u0442\u043e\u043c \u043f\u043e\u044f\u0432\u0438\u043b\u0438\u0441\u044c \u0440\u043e\u043b\u0438, \u0430 \u0441\u043e\u0432\u0441\u0435\u043c \u043d\u0435\u0434\u0430\u0432\u043d\u043e, \u043d\u0435\u0434\u0435\u043b\u044e-\u0434\u0432\u0435 \u043d\u0430\u0437\u0430\u0434, \u0432 \u0432\u0435\u0440\u0441\u0438\u0438 1.3 \u2014 \u043d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u0435 \u0440\u043e\u043b\u0435\u0439. \u0418 \u043c\u044b, \u043a\u0430\u043a \u0438\u0441\u0442\u0438\u043d\u043d\u044b\u0435 \u0434\u0436\u0435\u0434\u0430\u0438, \u0431\u0443\u0434\u0435\u043c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0442\u0435\u043c \u0447\u0442\u043e \u0438\u043c\u0435\u0435\u043c \u0441\u0435\u0439\u0447\u0430\u0441. \u0418 \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u0440\u0430\u0437\u0431\u0435\u0440\u0435\u043c\u0441\u044f, \u043d\u0430\u043a\u043e\u043d\u0435\u0446, \u0447\u0442\u043e \u0442\u0430\u043a\u043e\u0435 \u044d\u0442\u0438 \u043f\u043b\u0435\u0439\u0431\u0443\u043a\u0438 \u0438 \u0440\u043e\u043b\u0438, \u0430 \u0442\u043e \u043d\u0435\u043f\u043e\u043d\u044f\u0442\u043d\u043e. <\/p>\n<p>  <b>\u041f\u043b\u0435\u0439\u0431\u0443\u043a\u0438<\/b> \u2014 \u0438\u0441\u043f\u043e\u043b\u043d\u044f\u0435\u043c\u044b\u0439 \u043d\u0430\u0431\u043e\u0440 \u0447\u0435\u0433\u043e-\u0443\u0433\u043e\u0434\u043d\u043e. \u041e\u043d\u0438, \u0432 \u043e\u0442\u043b\u0438\u0447\u0438\u0438 \u043e\u0442 chef, \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u044e\u0442\u0441\u044f \u043e\u0434\u0438\u043d \u0440\u0430\u0437 \u0438 \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e \u0432\u0430\u0448\u0435\u0439 \u043a\u043e\u043c\u0430\u043d\u0434\u0435. \u0425\u043e\u0442\u044f \u043d\u0435\u0442 \u043d\u0438\u0447\u0435\u0433\u043e, \u0447\u0442\u043e \u0431\u044b \u043f\u043e\u043c\u0435\u0448\u0438\u043b\u043e \u043f\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0437\u0430\u0434\u0430\u0447\u0443 \u0432 \u043a\u0440\u043e\u043d. \u0420\u0430\u043d\u044c\u0448\u0435 \u043f\u043e\u0434 \u043f\u043b\u0435\u0439\u0431\u0443\u043a\u043e\u043c \u043f\u043e\u0434\u0440\u0430\u0437\u0443\u043c\u0435\u0432\u0430\u043b\u0441\u044f \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u0441\u043f\u0438\u0441\u043e\u043a \u0437\u0430\u0434\u0430\u0447, \u043d\u043e \u0441\u0435\u0439\u0447\u0430\u0441 \u043e\u043d\u0438 \u043f\u0440\u0435\u0432\u0440\u0430\u0442\u0438\u043b\u0438\u0441\u044c \u0432 \u043d\u0430\u0431\u043e\u0440 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u0435\u0439 \u043d\u0430 \u043d\u0443\u0436\u043d\u044b\u0435 \u043d\u0430\u043c \u0440\u043e\u043b\u0438. <br \/>  <b>\u0420\u043e\u043b\u0438<\/b>, \u0432 \u0441\u0432\u043e\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c, \u044d\u0442\u043e \u043d\u0430\u0431\u043e\u0440 \u0437\u0430\u0434\u0430\u0447, \u0448\u0430\u0431\u043b\u043e\u043d\u043e\u0432, \u0442\u0440\u0438\u0433\u0435\u0440\u043e\u0432-\u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432, \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445, \u0444\u0430\u0439\u043b\u043e\u0432 \u0438 \u0441\u0441\u044b\u043b\u043e\u043a \u043d\u0430 \u0434\u0440\u0443\u0433\u0438\u0435 \u0440\u043e\u043b\u0438 \u0440\u0430\u0441\u043f\u0438\u0445\u0430\u043d\u044b\u0445 \u043f\u043e \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0430\u043c \u0432 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0439 \u0434\u043b\u044f ansible \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0435. \u0420\u043e\u043b\u0438 \u043b\u0443\u0447\u0448\u0435 \u0432\u0441\u0435\u0433\u043e \u0433\u0440\u0443\u043f\u043f\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u043e \u043b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u0438\u043c \u0433\u0440\u0443\u043f\u043f\u0430\u043c. \u042f, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0432 \u0440\u0430\u043c\u043a\u0430\u0445 \u043f\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043d\u043e\u0439 \u0432\u044b\u0448\u0435 \u0437\u0430\u0434\u0430\u0447\u0438, \u0432\u044b\u0434\u0435\u043b\u044e \u0442\u0430\u043a\u0438\u0435 \u0440\u043e\u043b\u0438: <br \/>  1) \u043f\u0440\u0435\u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0430 \u2014 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u0440\u0430\u0437\u043d\u044b\u0445 \u0430\u0434\u043c\u0438\u043d\u0441\u043a\u0438\u0445 \u0441\u043e\u0444\u0442\u043e\u0432, \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439 \u0441 \u043a\u043b\u044e\u0447\u0430\u043c\u0438, \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044f \u043b\u043e\u043a\u0430\u043b\u0435\u0439, \u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043a\u043e\u043d\u0444\u0438\u0433\u043e\u0432 \u0438 \u0442.\u043f.<br \/>  2) \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u0441\u043e\u0444\u0442\u0430 \u0434\u043b\u044f \u043d\u0443\u0436\u043d\u043e\u0433\u043e \u0432 \u0438\u0442\u043e\u0433\u0435 \u0441\u0435\u0440\u0432\u0438\u0441\u0430 \u0438 \u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0435\u0433\u043e \u043a\u043e\u043d\u0444\u0438\u0433\u043e\u0432<br \/>  3) \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0439 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0439, \u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0433\u0438\u0442\u0430 \u0438 \u0442.\u043f.<\/p>\n<p>  \u0418\u0442\u0430\u043a, \u043d\u0430\u0447\u043d\u0435\u043c \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043f\u043b\u0435\u0439\u0431\u0443\u043a\u0430 <i>main.yml<\/i> c \u043f\u043e\u043a\u0430 \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0439 \u0440\u043e\u043b\u044c\u044e <i>preconf<\/i><\/p>\n<pre><code class=\"bash\">- hosts: all   roles:      - preconf   tags: preconf <\/code><\/pre>\n<p>  \u0422\u0443\u0442 \u043c\u044b \u0434\u043b\u044f \u0432\u0441\u0435\u0445 \u0445\u043e\u0441\u0442\u043e\u0432 \u2018all\u2019 \u043d\u0430\u0437\u043d\u0430\u0447\u0438\u043b\u0438 \u0440\u043e\u043b\u044c preconf \u0438 \u0434\u043e\u0431\u0430\u0432\u0438\u043b\u0438 \u0442\u0435\u0433 preconf. <b>\u0422\u0435\u0433\u0438<\/b> \u043d\u0443\u0436\u043d\u044b \u0434\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u0442\u043e\u043c \u0438\u043c\u0435\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0438\u0441\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u043a\u0430\u043a\u0443\u044e-\u0442\u043e \u0447\u0430\u0441\u0442\u044c \u043f\u043b\u0435\u0439\u0431\u0443\u043a\u0430. <br \/>  \u0414\u0430\u043b\u044c\u0448\u0435, \u043a\u043e\u0433\u0434\u0430 ansible \u0432\u0438\u0434\u0438\u0442 \u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0440\u043e\u043b\u0438 \u043e\u043d \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442 \u0441\u0443\u0434\u043e\u0440\u043e\u0436\u043d\u043e \u0438\u0441\u043a\u0430\u0442\u044c \u043e\u0434\u043d\u043e\u0438\u043c\u0435\u043d\u043d\u044b\u0439 \u043a\u0430\u0442\u0430\u043b\u043e\u0433 \u0432 .\/roles. \u0412 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u044d\u0442\u043e \u0431\u0443\u0434\u0435\u0442 .\/roles\/preconf<br \/>  \u0422\u0430\u043c \u0443\u0436\u0435 \u0434\u043e\u043b\u0436\u043d\u0430 \u0431\u044b\u0442\u044c \u0433\u043e\u0442\u043e\u0432\u0430 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u0440\u043e\u043b\u0438, \u0430 \u0438\u043c\u0435\u043d\u043d\u043e: tasks\/main.yml<br \/>  \u042d\u0442\u043e \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u0444\u0430\u0439\u043b, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u044f\u044e\u0442\u0441\u044f \u0437\u0430\u0434\u0430\u0447\u0438. <br \/>  \u0422\u0430\u043a\u0436\u0435 \u0442\u0430\u043c \u043c\u043e\u0436\u0435\u0442 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u043a\u0430\u0442\u0430\u043b\u043e\u0433 \u2018templates\u2019, \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u044b \u0441\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u0435\u043c \u0448\u0430\u0431\u043b\u043e\u043d\u044b <i>\u043a\u043e\u043d\u0444\u0438\u0433<\/i>-\u0444\u0430\u0439\u043b\u043e\u0432, \u2018files\u2019, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0431\u0443\u0434\u0443\u0442 \u043b\u0435\u0436\u0430\u0442\u044c \u0440\u0430\u0437\u043d\u044b\u0435 \u043d\u0443\u0436\u043d\u044b\u0435 \u043d\u0430\u043c <i>\u0444\u0430\u0439\u043b\u044b<\/i>, \u2018handlers\u2019 \u2014 \u0442\u0435 \u0441\u0430\u043c\u044b\u0435 \u043f\u0440\u0435\u0441\u043b\u0430\u0432\u0443\u0442\u044b\u0435 \u0442\u0440\u0438\u0433\u0435\u0440\u044b-\u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438, \u0430 \u0442\u0430\u043a \u0436\u0435 meta\/main.yml \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043c\u044b \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u0441\u0441\u044b\u043b\u043a\u0438 \u043d\u0430 \u0440\u043e\u043b\u044c \u0438 variables \u2014 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u0440\u043e\u043b\u0438. <br \/>  \u042f \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u044e \u0440\u0430\u0437\u0431\u0438\u0440\u0430\u0442\u044c\u0441\u044f \u043f\u043e-\u043f\u043e\u0440\u044f\u0434\u043a\u0443, \u043d\u043e \u0435\u0441\u043b\u0438 \u0445\u043e\u0442\u0438\u0442\u0435 \u2014 \u043c\u043e\u0436\u0435\u0442\u0435 \u0447\u0438\u0442\u0430\u0442\u044c \u0442\u0435\u043a\u0441\u0442 \u0441\u0435\u0440\u0445\u0443 \u0432\u043d\u0438\u0437 \u0440\u0435\u0437\u043a\u043e \u0434\u0435\u0440\u0433\u0430\u044f \u0433\u043e\u043b\u043e\u0432\u043e\u0439 \u0441\u043f\u0440\u0430\u0432\u0430-\u043d\u0430\u043b\u0435\u0432\u043e. <br \/>  \u0418\u0442\u0430\u043a, \u0437\u0430\u0434\u0430\u0447\u0438.<br \/>  \u0414\u043b\u044f \u043d\u0430\u0448\u0435\u0439 \u0440\u043e\u043b\u0438 preconf \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0444\u0430\u0439\u043b <i>.\/roles\/preconf\/tasks\/main.yml<\/i><br \/>  \u041e\u0431\u044b\u0447\u043d\u043e \u0437\u0430\u0434\u0430\u0447\u0438 \u0432\u044b\u0433\u043b\u044f\u0434\u044f\u0442 \u0442\u0430\u043a: <\/p>\n<pre><code class=\"bash\">- name: \u0418\u043c\u044f \u0437\u0430\u0434\u0430\u0447\u0438   \u043c\u043e\u0434\u0443\u043b\u044c: \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u043c\u043e\u0434\u0443\u043b\u044f. <\/code><\/pre>\n<p>  <b>\u041c\u043e\u0434\u0443\u043b\u0435\u0439<\/b> \u043e\u0447\u0435\u043d\u044c \u043c\u043d\u043e\u0433\u043e, \u043e\u043d\u0438 \u0435\u0441\u0442\u044c \u043d\u0430 \u043b\u044e\u0431\u043e\u0439 <a href=\"http:\/\/www.ansibleworks.com\/docs\/modules.html\">\u0432\u043a\u0443\u0441 \u0438 \u0446\u0432\u0435\u0442<\/a>. \u041f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u043c\u043e\u0434\u0443\u043b\u0435\u0439 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0440\u0430\u0437\u0432\u0435\u0440\u043d\u0443\u0442\u044c \u043c\u0430\u0448\u0438\u043d\u0443 \u0432 \u043e\u0431\u043b\u0430\u043a\u0435, \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u043a\u043e\u043c\u0430\u043d\u0434\u0443 \u0448\u0435\u043b\u0430, \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u0431\u0430\u0437\u0430\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u0445, \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u0444\u0430\u0439\u043b\u044b \u0438 \u043f\u0430\u043f\u043a\u0438, \u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0448\u0430\u0431\u043b\u043e\u043d\u044b, \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u0432 \u043e\u0447\u0435\u0440\u0435\u0434\u0438, \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u0441\u0435\u0442\u0435\u0432\u043e\u0439 \u0438\u043d\u0444\u0440\u0430\u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u043e\u0439, \u043f\u0438\u0441\u0430\u0442\u044c \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u0432 \u0447\u0430\u0442\u044b, \u0441\u0442\u0430\u0432\u0438\u0442\u044c \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b, \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u0441\u0438\u0441\u0442\u0435\u043c\u043e\u0439 \u0438 \u043c\u043d\u043e\u0433\u043e \u0447\u0435\u0433\u043e \u0435\u0449\u0435. \u041e\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0442\u044c\u0441\u044f \u043d\u0430 \u043a\u0430\u0436\u0434\u043e\u043c \u0438\u0437 \u043d\u0438\u0445 \u2014 \u0442\u0435\u043c\u0430 \u0434\u043b\u044f \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0438, \u0440\u043e\u0432\u043d\u043e, \u043a\u0430\u043a \u0438 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0441\u0432\u043e\u0438\u0445 \u2014 \u044d\u0442\u043e \u043d\u0435 \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u0441\u043b\u043e\u0436\u043d\u043e. <br \/>  \u0410 \u043f\u043e\u043a\u0430 \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u0447\u0442\u043e-\u0442\u043e \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c. <\/p>\n<pre><code class=\"bash\">- name: installing zsh   apt: pkg=zsh <\/code><\/pre>\n<p>  \u0412 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0438 \u043c\u043e\u0434\u0443\u043b\u044c <i>apt<\/i> \u0434\u043b\u044f \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u043d\u0430 \u043d\u0430\u0448\u0438 Debian \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b zsh. <br \/>  \u041a\u043e\u043d\u0435\u0447\u043d\u043e, \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u0441\u043f\u0430\u043c\u0438\u0442\u044c \u0442\u0430\u0441\u043a-\u043b\u0438\u0441\u0442 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0435\u0439 \u043f\u043e\u0434 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0443 \u043a\u0430\u0436\u0434\u043e\u0439 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b, \u043d\u043e \u0442\u0430\u043a\u0438\u0435 \u0444\u0430\u0439\u043b\u044b \u043e\u0447\u0435\u043d\u044c \u043f\u043b\u043e\u0445\u043e \u0447\u0438\u0442\u0430\u044e\u0442\u0441\u044f. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043c\u044b \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0441\u044f \u043e\u0447\u0435\u0440\u0435\u0434\u044c\u044e, \u043a\u043e\u0442\u043e\u0440\u0430\u044e \u043c\u043e\u0436\u043d\u043e \u0432\u044b\u0437\u0432\u0430\u0442\u044c \u0447\u0435\u0440\u0435\u0437 \u2018<i>with_items<\/i>\u2019<\/p>\n<pre><code class=\"bash\">- name: installing zsh   apt: pkg=$item   with_items:     - zsh     - htop     - sudo     - iftop     - tcpdump     - mc     - wget     - vim     - tmux     - facter <\/code><\/pre>\n<p>  \u0412 \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441\u0435 YAML, \u0435\u0441\u043b\u0438 \u044f \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u043f\u0443\u0442\u0430\u044e, \u043f\u043e\u0434\u043e\u0431\u043d\u0430\u044f \u0437\u0430\u043f\u0438\u0441\u044c \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442 \u043c\u0430\u0441\u0441\u0438\u0432. \u0418 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u044d\u0442\u043e\u0433\u043e \u043c\u0430\u0441\u0438\u0432\u0430, \u0441\u043b\u043e\u0432\u043d\u043e \u0431\u044b \u043f\u0440\u043e\u0439\u0434\u044f \u0447\u0435\u0440\u0435\u0437 xargs \u043f\u043e \u043e\u0447\u0435\u0440\u0435\u0434\u0438 \u043f\u0440\u0438\u0441\u0432\u0430\u0438\u0432\u0430\u044e\u0442\u0441\u044f \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 <i>item<\/i>, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043c\u044b \u0432\u044b\u0437\u0432\u0430\u043b\u0438 \u0432\u044b\u0448\u0435 \u0438 \u0443\u0436\u0435 \u0441 \u043d\u043e\u0432\u044b\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u043c \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u044e\u0442\u0441\u044f \u0432 \u0437\u0430\u0434\u0430\u0447\u0435. \u0420\u0430\u0437 \u0437\u0430 \u0440\u0430\u0437\u043e\u043c, \u043f\u043e\u043a\u0430 \u043d\u0435 \u0437\u0430\u043a\u043e\u043d\u0447\u0438\u0442\u0441\u044f \u0441\u043f\u0438\u0441\u043e\u043a. <br \/>  \u0422\u0435\u043f\u0435\u0440\u044c \u043c\u044b \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0432\u0441\u0435\u0445 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439 \u043e\u0442\u0434\u0435\u043b\u0430 \u0441\u043e\u043f\u0440\u043e\u0432\u043e\u0436\u0434\u0435\u043d\u0438\u044f \u0438 \u043a \u0441\u043b\u0443\u0447\u0430\u044e \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0441\u044f \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u043c\u0438. <br \/>  \u0414\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u043a\u0430\u043a-\u0442\u043e \u0442\u0430\u043a: <\/p>\n<pre><code class=\"bash\">- name: Add User Pupkin   user: name=\u2019pupkin\u2019 <\/code><\/pre>\n<p>  \u0422\u0430\u043a \u043d\u0430\u0448 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u0441\u044f \u043d\u0430 \u0443\u0440\u0430. \u041d\u043e \u043c\u044b \u0436\u0435 \u0445\u043e\u0442\u0438\u043c \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u043f\u0443\u043f\u043a\u0438\u043d \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0441\u044f zsh \u0438 \u044f\u0432\u043b\u044f\u043b\u0441\u044f \u0447\u043b\u0435\u043d\u043e\u043c \u0433\u0440\u0443\u043f\u043f\u044b sudo? \u0410 \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u0442\u0430\u043a \u0438 \u0441\u0434\u0435\u043b\u0430\u0435\u043c, \u0432\u0435\u0434\u044c \u043c\u043e\u0434\u0443\u043b\u044c \u2018user\u2019 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u043a\u0443\u0447\u0443 \u0432\u0441\u0435\u0433\u043e. <\/p>\n<pre><code class=\"bash\">- name: Add User Pupkin   user: name=\u2019pupkin\u2019 shell=\u2019\/bin\/zsh\u2019 groups=\u2019sudo\u2019 <\/code><\/pre>\n<p>  \u041c\u044b \u0443\u0436\u0435 \u0432\u044b\u0443\u0447\u0438\u043b\u0438 with_items, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043c\u044b \u0438\u043c \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0441\u044f \u0434\u043b\u044f \u0434\u043e\u0431\u0430\u0432\u0435\u043d\u0438\u044f \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439\u2026 \u041d\u043e\u2026 \u044d\u0442\u043e \u0432\u0435\u0434\u044c \u043d\u0430\u0434\u043e \u0434\u0432\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c \u0432 \u043f\u043e\u0442\u043e\u043a\u0435\u2026<br \/>  \u041d\u0438\u0447\u0435\u0433\u043e \u0441\u043b\u043e\u0436\u043d\u043e\u0433\u043e. Ansible \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u0445\u0435\u0448\u0438 \u2014 \u043c\u0430\u0441\u0441\u0438\u0432\u044b \u0432 \u0432\u0438\u0434\u0435 \u2018\u043a\u043b\u044e\u0447: \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u2019. \u0423\u0434\u043e\u0431\u043d\u0435\u0435 \u0432\u0441\u0435\u0433\u043e \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c \u0445\u0435\u0448\u0438 \u0432 jinja2 \u0444\u043e\u0440\u043c\u0430\u0442\u0435. <\/p>\n<pre><code class=\"bash\">- name: Add BestAdminsTeam   user: name={{ item.user }} shell={{ item.shell }} groups=\u2019sudo\u2019   with_items:     - { user: \u2018pupkin\u2019, shell: \u2018\/bin\/zsh\u2019 }     - { user: \u2018oldfag\u2019, shell: \u2018\/bin\/sh\u2019 } <\/code><\/pre>\n<p>  \u0421\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0447\u0442\u043e \u043c\u044b \u0442\u043e\u043b\u044c\u043a\u043e \u0447\u0442\u043e \u0441\u0434\u0435\u043b\u0430\u043b\u0438? \u041c\u044b \u0441\u043e\u0437\u0434\u0430\u043b\u0438 \u043c\u0430\u0441\u0441\u0438\u0432 \u0442\u0430\u043a\u043e\u0433\u043e \u0432\u0438\u0434\u0430: <br \/>  <code>{ {user: \u2018pupkin\u2019, shell: \u2018\/bin\/zsh\u2019 }, { user: \u2018oldfag\u2019, shell: \u2018\/bin\/sh\u2019 } } <\/code>\u0438\u0437 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0431\u0443\u0434\u0435\u043c \u0431\u0440\u0430\u0442\u044c \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u043f\u043e-\u043e\u0434\u043d\u043e\u043c\u0443 \u0438 \u043f\u0440\u0438\u0441\u0432\u0430\u0438\u0432\u0430\u0442\u044c \u0438\u0445 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 $item ( \u0438\u043b\u0438, \u0432\u044b\u0440\u0430\u0436\u0430\u044f\u0441\u044c jinja2 \u044f\u0437\u044b\u043a\u043e\u043c \u2014 {{ item }} ). \u041f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u043e\u0442\u043a\u0440\u044b\u0432\u0430\u0442\u044c \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u0445\u0435\u0448\u0430 \u2014 {{ item.user }} \u0438 {{ item.shell }} \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e. \u0422\u043e \u0435\u0441\u0442\u044c \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043c \u043a\u043e\u043d\u0441\u0438\u0441\u0442\u0435\u043d\u0442\u043d\u044b\u0439 \u0441\u043f\u0438\u0441\u043e\u043a \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f. <br \/>  \u0422\u0435\u043f\u0435\u0440\u044c \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u043a\u043b\u044e\u0447\u0438 \u043d\u0430\u0448\u0438\u043c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f\u043c. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u043e\u0442\u043b\u0438\u0447\u043d\u044b\u0439 \u043c\u043e\u0434\u0443\u043b\u044c \u2018<i>authorized_key<\/i>\u2019<\/p>\n<pre><code class=\"bash\">- name: Add BestAdminsKey   authorized_key: user={{ item.user }} key=&quot;{{item.key}}&quot;   with_items:     - { user: \u2018pupkin\u2019, key: \u2018ssh-rsa pupkin_pub_key\u2019 }     - { user: \u2018oldfag\u2019, key: \u2018ssh-rsa oldfag_pub_key\u2019 } <\/code><\/pre>\n<p>  \u0412 \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0435 \u043e\u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0431\u0443\u0434\u0435\u0442 \u0438 \u0442\u0430\u043a, \u043d\u043e \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043d\u0435\u0443\u0434\u043e\u0431\u043d\u043e \u043a\u0430\u0436\u0434\u044b\u0439 \u0440\u0430\u0437 \u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u044f\u0442\u044c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439: \u043e\u0447\u0435\u043d\u044c \u043b\u0435\u0433\u043a\u043e \u0437\u0430\u0431\u044b\u0442\u044c \u043a\u0443\u0434\u0430-\u0442\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043d\u043e\u0432\u043e\u0433\u043e \u0447\u043b\u0435\u043d\u0430 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u0438 \u043c\u043d\u0435 \u043d\u0430\u0434\u043e \u043a\u0430\u043a-\u0442\u043e \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u0430\u0442\u044c \u043f\u0440\u043e \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435, \u0430 \u0442\u0443\u0442 \u0442\u0430\u043a\u043e\u0439 \u0441\u043b\u0443\u0447\u0430\u0439 \ud83d\ude42 <br \/>  \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0437\u0430\u0432\u0435\u0434\u0435\u043c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e, \u0432 \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u0441\u043a\u043b\u0430\u0434\u0435\u043c \u0432\u0441\u0435\u0445 \u043d\u0430\u0448\u0438\u0445 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439 \u0441 \u0438\u0445 \u043a\u043b\u044e\u0447\u0430\u043c\u0438, \u0448\u0435\u043b\u0430\u043c\u0438, \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u043f\u0443\u0442\u044f\u043c\u0438 \u043a \u043a\u043e\u043d\u0444\u0438\u0433\u0430\u043c \u0438 \u0432\u0441\u0435\u043c \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u043c. \u0421\u043a\u043b\u0430\u0441\u0442\u044c \u044e\u0437\u0435\u0440\u043e\u0432 \u0432 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e \u043b\u0435\u0433\u043a\u043e, \u043d\u043e \u043a\u0443\u0434\u0430 \u0441\u043a\u043b\u0430\u0441\u0442\u044c \u0441\u0430\u043c\u0443 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e? <br \/>  \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0443 ansible \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u0432 \u0440\u0435\u0448\u0435\u043d\u0438\u044f. <br \/>  \u041c\u043e\u0436\u043d\u043e \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0445\u043e\u0441\u0442\u0430 \u0432 \u043f\u0430\u043f\u043a\u0435 .\/host_vars\/\u0438\u043c\u044f_\u0445\u043e\u0441\u0442\u0430 \u2014 \u044d\u0442\u043e \u043d\u0435 \u043f\u043e\u0434\u043e\u0434\u0438\u0442 \u0434\u043b\u044f \u043d\u0430\u0448\u0435\u0439 \u0446\u0435\u043b\u0438<br \/>  \u041c\u043e\u0436\u043d\u043e \u0434\u0435\u043b\u0430\u0442\u044c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u0434\u043b\u044f \u0433\u0440\u0443\u043f\u043f\u044b \u0445\u043e\u0441\u0442\u043e\u0432 (\u0433\u0440\u0443\u043f\u043f\u044b, \u043d\u0430\u043f\u043e\u043c\u043d\u044e, \u043c\u044b \u0434\u0435\u043b\u0430\u043b\u0438 \u0432 \u0444\u0430\u0439\u043b\u0435 \u0438\u043d\u0432\u0435\u043d\u0442\u0430\u0440\u0438\u0437\u0430\u0446\u0438\u0438) \u0438 \u043b\u043e\u0436\u0438\u0442\u044c \u0438\u0445 \u0432 .\/group_vars\/\u0438\u043c\u044f_\u0433\u0440\u0443\u043f\u043f\u044b \u2014 \u043c\u043e\u0436\u043d\u043e, \u043a\u043e\u043d\u0435\u0447\u043d\u043e, \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e \u0442\u0443\u0442, \u0434\u043b\u044f \u0433\u0440\u0443\u043f\u043f\u044b all. \u041d\u043e \u044d\u0442\u043e \u043d\u0435 \u201c\u0447\u0438\u0441\u0442\u0430\u044f \u0440\u0430\u0431\u043e\u0442\u0430\u201d. <br \/>  \u041c\u043e\u0436\u043d\u043e \u043f\u0440\u0438\u0441\u0432\u0430\u0438\u0432\u0430\u0442\u044c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u043f\u0440\u044f\u043c\u043e \u0432 \u043f\u043b\u0435\u0439\u0431\u0443\u043a\u0430\u0445. \u041d\u043e \u0442\u0430\u043a \u0441\u043c\u043e\u0442\u0440\u0438\u0442\u044c\u0441\u044f \u043d\u0435\u043e\u043f\u0440\u044f\u0442\u043d\u043e. <br \/>  \u0415\u0449\u0435 \u0443 \u043a\u0430\u0436\u0434\u043e\u0439 \u0440\u043e\u043b\u0438 \u0435\u0441\u0442\u044c \u201c\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e\u201d \u0432 \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0435 defaults, \u043d\u043e \u044d\u0442\u043e \u043d\u0435 \u0441\u043e\u0432\u0441\u0435\u043c \u0442\u043e, \u0447\u0442\u043e \u043d\u0430\u043c \u043d\u0430\u0434\u043e<br \/>  \u041d\u0443 \u0438 \u043d\u0430\u043a\u043e\u043d\u0435\u0446 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u0440\u043e\u043b\u0438 \u2014 \u043f\u043e\u0445\u043e\u0436\u0435 \u044d\u0442\u043e \u0441\u0430\u043c\u043e\u0435 \u0442\u043e. <\/p>\n<p>  \u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0444\u0430\u0439\u043b\u0438\u043a .\/roles\/main\/variables\/main.yml \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0437\u0430\u043f\u0438\u0448\u0435\u043c: <\/p>\n<pre><code class=\"bash\">ssh_super_team:     - { user: \u2018pupkin\u2019, key: \u2018ssh-rsa pupkin_pub_key\u2019, shell: \u2018\/bin\/zsh\u2019}     - { user: \u2018oldfag\u2019, key: \u2018ssh-rsa oldfag_pub_key\u2019, shell: \u2018\/bin\/sh\u2019 } <\/code><\/pre>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u0432 \u0437\u0430\u0434\u0430\u0447\u0435 \u043c\u043e\u0436\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e $ssh_super_team \u0432\u043e\u0442 \u0442\u0430\u043a: <\/p>\n<pre><code class=\"bash\">- name: Add BestAdminsTeam   user: name={{ item.user }} shell={{ item.shell }} groups=\u2019sudo\u2019   with_items:     - $ssh_super_team  - name: Add BestAdminsKey   authorized_key: user={{ item.user }} key=&quot;{{item.key}}&quot;   with_items:     - $ssh_super_team <\/code><\/pre>\n<p>  \u041d\u0443 \u0438 \u0447\u0442\u043e\u0431\u044b \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0432\u0441\u0435\u043c \u0443\u0434\u043e\u0431\u043d\u043e \u2014 \u0441\u043a\u043e\u043f\u0438\u0440\u0443\u0435\u043c \u043d\u0430\u0448\u0438\u043c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f\u043c \u0444\u0430\u0439\u043b .vimrc \u2014 \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b\u0439 \u0434\u043b\u044f \u043e\u0431\u043e\u0438\u0445 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439. \u0412 \u043a\u0430\u0442\u0430\u043b\u043e\u0433 .\/roles\/main\/files\/ \u0441\u0443\u043d\u0435\u043c \u0444\u0430\u0439\u043b \u043f\u043e \u0438\u043c\u0435\u043d\u0438 \u2018vimrc\u2019 \u0438 \u0441\u0434\u0435\u043b\u0430\u0435\u043c \u0442\u0430\u043a\u043e\u0439 \u0442\u0430\u0441\u043a: <\/p>\n<pre><code class=\"bash\">- name: copy vimrc file   copy: src=\u201dvimrc\u201d dest=\u201d\/home\/{{item.user}}\/.vimrc\u201d   with_items:     - $ssh_super_team <\/code><\/pre>\n<p>  \u0412\u0443\u0430\u043b\u044f. <\/p>\n<p>  \u041a\u0441\u0442\u0430\u0442\u0438, \u044f \u0438\u043d\u043e\u0433\u0434\u0430 \u043f\u0435\u0440\u0435\u0447\u0438\u0442\u044b\u0432\u0430\u044e \u0442\u043e, \u0447\u0442\u043e \u043f\u0438\u0448\u0443 \u2014 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c \u043e\u0431\u044c\u0435\u043c\u043d\u043e. \u041f\u043e\u0440\u0430 \u0437\u0430\u043a\u0440\u0443\u0433\u043b\u044f\u0442\u044c \u0432\u0441\u0435 \u0447\u0442\u043e \u0435\u0449\u0435 \u043d\u0435 \u043a\u0440\u0443\u0433\u043b\u043e\u0435, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u044f \u0441\u0440\u0430\u0437\u0443 \u043f\u0435\u0440\u0435\u0441\u043a\u043e\u0447\u0443 \u043d\u0430 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044e nginx: <br \/>  \u041f\u043e \u043a\u0430\u043b\u044c\u043a\u0435 \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0440\u043e\u043b\u044c nginx \u0438 \u0432 \u0444\u0430\u0439\u043b .\/roles\/nginx\/tasks\/main.yml \u0437\u0430\u043f\u0438\u0448\u0435\u043c: <\/p>\n<pre><code class=\"bash\">- name: install nginx    apt: pkg=\u2019nginx\u2019 <\/code><\/pre>\n<p>  \u0425\u043c, \u043d\u043e \u0432\u0435\u0434\u044c \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043d\u0430 \u0432\u0441\u0435\u0445 \u0441\u0435\u0440\u0432\u0435\u0440\u0430\u0445 nginx \u0441 \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b\u043c \u043a\u043e\u043d\u0444\u0438\u0433\u043e\u043c? \u041c\u043e\u0436\u0435\u0442, \u043a\u043e\u043d\u0435\u0447\u043d\u043e, \u043d\u043e \u044d\u0442\u043e \u043d\u0435\u0443\u0434\u043e\u0431\u043d\u043e. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u0440\u0438\u0434\u0443\u043c\u0430\u0435\u043c \u0448\u0430\u0431\u043b\u043e\u043d \u2014 \u0432 ansible \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043d\u0430\u0434\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0437\u043d\u0430\u043a\u043e\u043c\u044b\u0439 \u043c\u043d\u043e\u0433\u0438\u043c jinja2 \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441. <br \/>  \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u0444\u0430\u0439\u043b \u0432 .\/roles\/nginx\/templates\/ \u0438 \u043d\u0430\u0437\u043e\u0432\u0435\u043c \u0435\u0433\u043e nginx_site_conf.j2<br \/>  \u0410 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u0441\u0434\u0435\u043b\u0430\u0435\u043c \u0442\u0430\u043a\u0438\u043c: <\/p>\n<pre><code class=\"bash\">server {   listen       80;   server_name  {{ item.sitename }};   root \u201c\/var\/www\u201d } <\/code><\/pre>\n<p>  \u0414\u0430\u043b\u044c\u0448\u0435 \u043d\u0430\u043c \u043d\u0430\u0434\u043e \u0440\u0430\u0437\u043b\u043e\u0436\u0438\u0442\u044c \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0435 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0445\u043e\u0441\u0442\u0430 \u043f\u0435\u0440\u043c\u0435\u043d\u043d\u044b\u0435: \u043d\u0430\u043a\u0438\u0434\u0430\u0435\u043c \u0444\u0430\u0439\u043b\u043e\u0432 \u0432 .\/host_vars\/\u0438\u043c\u044f_\u0445\u043e\u0441\u0442\u0430<\/p>\n<pre><code class=\"bash\">nginx:   - { sitename: \u201cwww.example.com\u201d } <\/code><\/pre>\n<p>  \u0418 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e \u043f\u043e-\u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0434\u043b\u044f \u044d\u0442\u043e\u0439 \u0440\u043e\u043b\u0438: \u0432 \u0444\u0430\u0439\u043b\u0435 .\/roles\/nginx\/defaults\/main.yml <\/p>\n<pre><code class=\"bash\">nginx:   - { sitename: \u201cdefault\u201d } <\/code><\/pre>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0437\u0430\u0434\u0430\u0447\u0443: <\/p>\n<pre><code class=\"bash\">- name: nginx config for sites   template: src=\u201dnginx_site_conf.j2\u201d dest=\u201d\/etc\/nginx\/sites-enabled\/{{ item.sitename }}   with_items:     - $nginx   notify:     - restart nxinx <\/code><\/pre>\n<p>  \u0418 ansible, \u043f\u0440\u0438 \u043f\u0440\u043e\u0445\u043e\u0434\u0435 \u044d\u0442\u043e\u0433\u043e \u0442\u0430\u0441\u043a\u0430 \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u0442 \u0441\u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0448\u0430\u0431\u043b\u043e\u043d \u201dnginx_site_conf.j2\u201d \u0441 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 $nginx, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u043d\u0430 \u043b\u0438\u0431\u043e \u0438\u0437 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0445\u043e\u0441\u0442\u0430, \u043b\u0438\u0431\u043e \u0438\u0437 \u0434\u0435\u0444\u043e\u043b\u0442\u043d\u044b\u0445 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0440\u043e\u043b\u0438. \u0418 \u0435\u0441\u043b\u0438 \u043a\u043e\u043f\u0438\u0440\u0443\u0435\u043c\u044b\u0439 \u0448\u0430\u0431\u043b\u043e\u043d \u0431\u0443\u0434\u0435\u0442 \u043e\u0442\u043b\u0438\u0447\u0430\u0442\u044c\u0441\u044f \u043e\u0442 \u043a\u043e\u043d\u0444\u0438\u0433\u0430 \u043d\u0430 \u043c\u0430\u0448\u0438\u043d\u0435 \u2014 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u0441\u044f handler, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0442\u0430\u043a: .\/roles\/nginx\/handlers\/main.yml <\/p>\n<pre><code class=\"bash\">- name: restart nginx   action: service name=nginx state=reloaded <\/code><\/pre>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u0441\u043e\u0431\u0435\u0440\u0435\u043c \u0438\u0437 \u044d\u0442\u0438\u0445 \u0434\u0432\u0443\u0445 \u043d\u0430\u043c\u0435\u0440\u0435\u043d\u043d\u043e \u0443\u043f\u0440\u043e\u0449\u0435\u043d\u043d\u044b\u0445 \u0440\u043e\u043b\u0435\u0439 \u043e\u0434\u043d\u0443 \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u0443\u044e \u0434\u043b\u044f \u0433\u0440\u0443\u043f\u043f\u044b \u0445\u043e\u0441\u0442\u043e\u0432 <i>WebServersG1<\/i>. \u0421\u0435\u0439\u0447\u0430\u0441 \u043c\u044b \u043d\u0435 \u0431\u0443\u0434\u0435\u043c \u043d\u0438\u0447\u0435\u0433\u043e \u0443\u0441\u043b\u043e\u0436\u043d\u044f\u0442\u044c, \u0430 \u043f\u0440\u043e\u0441\u0442\u043e \u0441\u0434\u0435\u043b\u0430\u0435\u043c \u0432 \u043d\u0435\u0439 \u0441\u0441\u044b\u043b\u043a\u0443 \u043d\u0430 \u0434\u0432\u0435 \u0443\u0436\u0435 \u0433\u043e\u0442\u043e\u0432\u044b\u0435 \u0440\u043e\u043b\u0438. \u0417\u0430\u043f\u0438\u0448\u0435\u043c \u0432 \u0444\u0430\u0439\u043b roles\/myapp\/meta\/main.yml \u0442\u0430\u043a\u0438\u0435 \u0441\u0442\u0440\u043e\u0447\u043a\u0438: <\/p>\n<pre><code class=\"bash\">--- dependencies:   - { role: preconf }   - { role: nginx } <\/code><\/pre>\n<p>   \u0418, \u043d\u0430\u043a\u043e\u043d\u0435\u0446, \u043f\u043b\u0435\u0439\u0431\u0443\u043a <i>playbook.yml:<\/i> <\/p>\n<pre><code class=\"bash\">- hosts: WebServersG1   roles:     - WebServersG1 <\/code><\/pre>\n<p>  \u041a\u0441\u0442\u0430\u0442\u0438, \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u044f \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0435\u0439 \u0442\u043e\u0436\u0435 \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u0434\u043b\u044f \u0443\u0442\u043e\u0447\u043d\u0435\u043d\u0438\u044f \u043a\u0430\u043a\u043e\u0439-\u0442\u043e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e \u0434\u043b\u044f \u044d\u0442\u043e\u0439 \u0440\u043e\u043b\u0438. \u041d\u043e \u043e\u0431 \u044d\u0442\u043e\u043c, \u043a\u0430\u043a \u0438 \u043e \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u044f\u0445, \u0441\u043b\u043e\u0436\u043d\u044b\u0445 \u0448\u0430\u0431\u043b\u043e\u043d\u0430\u0445, \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0437\u0430\u0434\u0430\u0447\u0438, \u0440\u0430\u0441\u043f\u0430\u0440\u0430\u043b\u0435\u043b\u0438\u0432\u0430\u043d\u0438\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0438 \u043c\u043d\u043e\u0433\u043e\u043c-\u043c\u043d\u043e\u0433\u043e\u043c \u0434\u0440\u0443\u0433\u043e\u043c \u043c\u044b \u043f\u043e\u0433\u043e\u0432\u043e\u0440\u0438\u043c \u0443\u0436\u0435 \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0440\u0430\u0437. <br \/>  \u0410 \u043f\u043e\u043a\u0430 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u043e\u0442\u043b\u0438\u0447\u043d\u0443\u044e, \u043d\u0435 \u0442\u043e \u0447\u0442\u043e \u0443 \u0434\u0440\u0443\u0433\u0438\u0445, \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044e: <a href=\"http:\/\/www.ansibleworks.com\/docs\/\">www.ansibleworks.com\/docs\/<\/a><\/p>\n<p>  P.S. \u041c\u043e\u0439 \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0438\u0439 \u0440\u0435\u0434\u0430\u043a\u0442\u043e\u0440 \u0443\u0448\u0435\u043b \u0432 \u043e\u0442\u043f\u0443\u0441\u043a. \u041f\u0440\u043e\u0448\u0443 \u043f\u0440\u043e\u0441\u0442\u0438\u0442\u044c \u0437\u0430 \u043e\u0448\u0438\u0431\u043a\u0438 \u0438 \u043d\u0435\u0440\u043e\u0432\u043d\u044b\u0439 \u043f\u043e\u0447\u0435\u0440\u043a. \u042f \u0432\u0441\u0435\u0433\u0434\u0430 \u0447\u0438\u0442\u0430\u044e \u041b\u0421 \u0438 \u0432\u0441\u0435\u0433\u0434\u0430 \u0433\u043e\u0432\u043e\u0440\u044e \u00ab\u0441\u043f\u0430\u0441\u0438\u0431\u043e\u00bb \u0437\u0430 \u0438\u0441\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \ud83d\ude42    \t<\/p>\n<div class=\"clear\"><\/div>\n<\/p><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"http:\/\/habrahabr.ru\/post\/195048\/\"> http:\/\/habrahabr.ru\/post\/195048\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"content html_format\">   \tAnsible \u2014 yet another \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044f\u043c\u0438. \u041e\u0442\u043b\u0438\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u0430\u044f \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u044c \u2014 \u043f\u0440\u043e\u0441\u0442\u043e\u0442\u0430, \u043f\u0440\u0438 \u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u0433\u0438\u0431\u043a\u043e\u0441\u0442\u0438. \u0418 \u044d\u0442\u043e \u043d\u0435 \u043f\u0440\u043e\u0441\u0442\u043e \u0441\u043b\u043e\u0432\u0430 \u2014 \u0434\u0430\u043b\u044c\u0448\u0435 \u044f \u043f\u043e\u043a\u0430\u0436\u0443 \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0430\u0445 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u043e\u0441\u0442\u0435\u0439\u0448\u0438\u0445 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439 \u0438 \u043f\u043e\u0437\u043d\u0430\u043a\u043e\u043c\u043b\u044e \u0432\u0430\u0441 \u0441 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u043c\u0438 \u201c\u0431\u0435\u0441\u0442 \u043f\u0440\u0430\u043a\u0442\u0438\u0441\u201d. <\/p>\n<p>  \u0418\u0442\u0430\u043a, \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u0433\u0440\u0443\u043f\u043f\u044b \u0445\u043e\u0441\u0442\u043e\u0432:  <\/p>\n<table>\n<tr>\n<td>WebServersG1<\/td>\n<td>webserver1-g1, webserver2-g1<\/td>\n<\/tr>\n<tr>\n<td>WebServersG2<\/td>\n<td>webserver1-g2, webserver2-g2<\/td>\n<\/tr>\n<tr>\n<td>WebServersProxy<\/td>\n<td>webserver-proxy1, webserver-proxy2<\/td>\n<\/tr>\n<tr>\n<td>DataBase<\/td>\n<td>db1, db2<\/td>\n<\/tr>\n<tr>\n<td>DataBaseSlave<\/td>\n<td>dbs1, dbs2<\/td>\n<\/tr>\n<tr>\n<td>SomeServers<\/td>\n<td>someserver1, someserver2<\/td>\n<\/tr>\n<\/table>\n<p>  \u041c\u044b \u0445\u043e\u0442\u0438\u043c \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u0438\u0442\u044c \u0432\u0441\u0435 \u0445\u043e\u0441\u0442\u044b \u043a \u0430\u0434\u0435\u043a\u0432\u0430\u0442\u043d\u043e\u0439 \u0440\u0430\u0431\u043e\u0442\u0435 \u2014 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0439 \u043d\u0430\u0431\u043e\u0440 \u0441\u043e\u0444\u0442\u0430 (htop, zsh, vim, iftop, sudo, mc, tmux, wget), \u0441\u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u0432\u043e\u0438 \u043a\u043b\u044e\u0447\u0438 \u0438 \u043a\u043e\u043d\u0444\u0438\u0433\u0438 \u0438 \u043f\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0438 \u0441\u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u043e\u0444\u0442 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u0447\u043d\u044b\u0439 \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0441\u0435\u0440\u0432\u0435\u0440\u0430. <br \/>  Ansible \u043f\u043e\u0434\u0440\u0430\u0437\u0443\u043c\u0435\u0432\u0430\u0435\u0442 \u043c\u0438\u043d\u0438\u043c\u0443\u043c \u0434\u0432\u0430 \u0444\u0430\u0439\u043b\u0430 \u0434\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u0440\u0430\u0431\u043e\u0442\u044b \u2014 <i>\u0438\u043d\u0432\u0435\u043d\u0442\u0430\u0440\u043d\u044b\u0439 \u0444\u0430\u0439\u043b<\/i>, \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u044b \u043f\u0438\u0448\u0435\u043c \u0441\u043f\u0438\u0441\u043e\u043a \u0445\u043e\u0441\u0442\u043e\u0432 \u0438 \u0434\u0435\u043b\u0438\u043c \u0438\u0445 \u043f\u043e \u0433\u0440\u0443\u043f\u043f\u0430\u043c \u2014 <b>inventory<\/b> \u0438 \u0444\u0430\u0439\u043b <i>\u0437\u0430\u0434\u0430\u0447<\/i> \u2014 <b>playbook<\/b>. <br \/>  \u041e\u043d\u0438 \u043d\u0443\u0436\u043d\u044b \u0434\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u043a\u043e\u0433\u0434\u0430 \u043c\u044b \u0432\u0441\u0435 \u0441\u0434\u0435\u043b\u0430\u0435\u043c \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0432\u0441\u0435 \u043a\u0440\u0430\u0441\u0438\u0432\u043e:<\/p>\n<pre><code class=\"bash\">ansible-playbook -i \u0438\u043d\u0432\u0435\u043d\u0442\u0430\u0440\u043d\u044b\u0439_\u0444\u0430\u0439\u043b playbook.yml <\/code><\/pre>\n<p>  \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0438\u043d\u0432\u0435\u043d\u0442\u0430\u0440\u043d\u044b\u0439 \u0444\u0430\u0439\u043b \u043f\u043e \u0438\u043c\u0435\u043d\u0438 \u201c<i>infrastructure<\/i>\u201d \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u043d\u0430\u0448\u0438\u0445 \u0445\u043e\u0441\u0442\u043e\u0432:  <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-195048","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/195048","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=195048"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/195048\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=195048"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=195048"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=195048"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}