{"id":254582,"date":"2015-04-06T13:33:02","date_gmt":"2015-04-06T09:33:02","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=254582"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=254582","title":{"rendered":"Ansible\u00a0\u2014 \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c"},"content":{"rendered":"<p>     \t<a href=\"http:\/\/www.ansible.com\/home\">Ansible<\/a>\u00a0\u2014 \u0441\u0440\u0430\u0432\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043c\u043e\u043b\u043e\u0434\u0430\u044f \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\u0435\u0439, \u0435\u0433\u043e \u0438\u0441\u0442\u043e\u0440\u0438\u044f \u043d\u0430\u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u0442 \u0447\u0443\u0442\u044c \u0431\u043e\u043b\u0435\u0435 \u0442\u0440\u0435\u0445 \u043b\u0435\u0442. \u041d\u043e, \u043d\u0435\u0441\u043c\u043e\u0442\u0440\u044f \u043d\u0430 \u044d\u0442\u043e, \u043e\u043d \u0441\u0442\u0440\u0435\u043c\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0438 \u0431\u044b\u0441\u0442\u0440\u043e \u0432\u043e\u0440\u0432\u0430\u043b\u0441\u044f \u0432 \u043c\u0438\u0440 \u0441\u0438\u0441\u0442\u0435\u043c \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0435\u0439, \u043f\u043e\u0442\u0435\u0441\u043d\u0438\u0432 Chef, Puppet \u0438 SaltStack.<\/p>\n<p>  \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430 \u043d\u0435\u0433\u043e \u0432\u043d\u0438\u043c\u0430\u0442\u0435\u043b\u044c\u043d\u043e, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043d\u044f\u0442\u044c, \u043f\u043e\u0447\u0435\u043c\u0443 \u043e\u043d \u0442\u0430\u043a \u043b\u044e\u0431\u0438\u043c \u0442\u0435\u0445\u043d\u0430\u0440\u044f\u043c\u0438.<\/p>\n<p>  \u0418\u0442\u0430\u043a, \u0447\u0435\u043c \u0436\u0435 \u0445\u043e\u0440\u043e\u0448 ansbile:  <\/p>\n<ul>\n<li>\u043d\u0438\u0437\u043a\u0438\u0439 \u043f\u043e\u0440\u043e\u0433 \u0432\u0445\u043e\u0434\u0430;<\/li>\n<li>\u0434\u0435\u043a\u043b\u0430\u0440\u0430\u0442\u0438\u0432\u043d\u044b\u0439 \u044f\u0437\u044b\u043a \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438;<\/li>\n<li>\u043d\u0430 \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c\u044b\u0435 \u0443\u0437\u043b\u044b \u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0442\u044c \u043d\u0438\u043a\u0430\u043a\u043e\u0433\u043e \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u041f\u041e;<\/li>\n<li>\u043f\u0440\u043e\u0441\u0442\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u043c\u043e\u0434\u0443\u043b\u044c.<\/li>\n<\/ul>\n<p>  <a name=\"habracut\"><\/a>  <\/p>\n<h2>\u041d\u0438\u0437\u043a\u0438\u0439 \u043f\u043e\u0440\u043e\u0433 \u0432\u0445\u043e\u0434\u0430<\/h2>\n<p>  \u041d\u0430\u0447\u0430\u0442\u044c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f ansible \u043c\u043e\u0436\u043d\u043e \u0437\u0430 \u043f\u0430\u0440\u0443 \u043c\u0438\u043d\u0443\u0442. \u0414\u043e\u043f\u0443\u0441\u0442\u0438\u043c, \u0432\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0435 OSX.  <\/p>\n<pre><code>$ brew install ansible  $ ansible --version ansible 1.8.4   configured module search path = None <\/code><\/pre>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0444\u0430\u0439\u043b <code>hosts<\/code>:  <\/p>\n<pre><code>[test] localhost ansible_connection=local <\/code><\/pre>\n<p>  \u041f\u043e\u0435\u0445\u0430\u043b\u0438:  <\/p>\n<pre><code>$ ansible -i hosts -m ping all  localhost | success &gt;&gt; {     &quot;changed&quot;: false,     &quot;ping&quot;: &quot;pong&quot; } <\/code><\/pre>\n<p>  \u0427\u0442\u043e \u043c\u044b \u0441\u0434\u0435\u043b\u0430\u043b\u0438? \u0414\u043b\u044f \u0432\u0441\u0435\u0445 \u0445\u043e\u0441\u0442\u043e\u0432 (\u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 <code>all<\/code>) \u0438\u0437 \u0444\u0430\u0439\u043b\u0430 hosts \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u043c\u043e\u0434\u0443\u043b\u044c ping. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0435\u0449\u0435 \u0447\u0442\u043e-\u043d\u0438\u0431\u0443\u0434\u044c.<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">ansible -i hosts -a &#39;ls -lah&#39; all<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code>$ ansible -i hosts -a &quot;ls -lah&quot; all localhost | success | rc=0 &gt;&gt; total 12K drwxr-xr-x  5 brun staff  170 Apr  1 11:50 . drwxr-xr-x 91 brun staff 3.1K Apr  1 11:37 .. -rw-r--r--  1 brun staff  230 Apr  1 12:07 export.sh -rw-r--r--  1 brun staff   42 Apr  3 14:48 hosts -rw-r--r--  1 brun staff  376 Apr  1 12:49 playbook.yml <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u0415\u0441\u043b\u0438 \u043c\u043e\u0434\u0443\u043b\u044c (\u043a\u043b\u044e\u0447 <code>-m<\/code>) \u043d\u0435 \u0437\u0430\u0434\u0430\u043d, \u0442\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u043c\u043e\u0434\u0443\u043b\u044c <a href=\"http:\/\/docs.ansible.com\/command_module.html\">command<\/a>. \u0424\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438, ansible \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u043a\u0430\u043a \u0441\u0438\u0441\u0442\u0435\u043c\u0443 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0435\u0439, \u043d\u043e \u0438 \u043a\u0430\u043a \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a \u0434\u043b\u044f \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043a\u043e\u043c\u0430\u043d\u0434.<\/p>\n<h2>\u0414\u0435\u043a\u043b\u0430\u0440\u0430\u0442\u0438\u0432\u043d\u044b\u0439 \u044f\u0437\u044b\u043a \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438<\/h2>\n<p>  \u041f\u043e\u043c\u0438\u043c\u043e \u0443\u0442\u0438\u043b\u0438\u0442\u044b ansible, \u0435\u0441\u0442\u044c \u0435\u0449\u0435 \u0443\u0442\u0438\u043b\u0438\u0442\u0430 ansible-playbook, \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0432\u044b \u0431\u0443\u0434\u0435\u0442\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u0447\u0430\u0441\u0442\u043e.<\/p>\n<p>  \u0414\u043b\u044f \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0438\u0445 \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u0432 \u044f \u0437\u0430\u0432\u0435\u043b \u043c\u0430\u0448\u0438\u043d\u043a\u0443 t2.micro \u043d\u0430 aws \u0441 Ubuntu 14.04 \u0438 \u043f\u0440\u043e\u043f\u0438\u0441\u0430\u043b \u0435\u0435 \u0432 hosts.  <\/p>\n<pre><code># hosts [web] 111.111.111.111 <\/code><\/pre>\n<p>  \u0422\u0430\u043a\u0436\u0435, \u0447\u0442\u043e\u0431\u044b \u043d\u0435 \u0432\u0432\u043e\u0434\u0438\u0442\u044c \u043a\u0430\u0436\u0434\u044b\u0439 \u0440\u0430\u0437 \u0432 \u043a\u043e\u043c\u0430\u043d\u0434\u043d\u0443\u044e \u0441\u0442\u0440\u043e\u043a\u0443 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b, \u044f \u0432 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0438 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u0441\u043e\u0437\u0434\u0430\u043b \u0444\u0430\u0439\u043b <code>ansible.cfg<\/code>.  <\/p>\n<pre><code># ansible.cfg [defaults] hostfile       = hosts <\/code><\/pre>\n<p>  \u041f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043d\u0430\u0448 \u043f\u0435\u0440\u0432\u044b\u0439 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0439 (playbook \u0432 \u0442\u0435\u0440\u043c\u0438\u043d\u043e\u043b\u043e\u0433\u0438\u0438 ansible) <code>web.yml<\/code>.<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">web.yml<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code># web.yml --- - hosts: all   user: ubuntu    tasks:     - name: Update apt cache       apt: update_cache=yes       sudo: yes      - name: Install required packages       apt: name={{ item }}       sudo: yes       with_items:         - nginx         - postgresql  <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u043d\u0430\u0448 \u043f\u0435\u0440\u0432\u044b\u0439 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0439, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u0435\u0442 \u043a\u044d\u0448 apt, \u0430 \u043f\u043e\u0442\u043e\u043c \u0441\u0442\u0430\u0432\u0438\u0442 \u0434\u0432\u0430 \u043f\u0430\u043a\u0435\u0442\u0430: nginx \u0438 postgresql.  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">ansible-playbook web.yml<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code>$ ansible-playbook web.yml  PLAY [all] ********************************************************************  GATHERING FACTS *************************************************************** ok: [111.111.111.111]  TASK: [Update apt cache] ****************************************************** ok: [111.111.111.111]  TASK: [Install required packages] ********************************************* changed: [111.111.111.111] =&gt; (item=nginx,postgresql)  PLAY RECAP ******************************************************************** 111.111.111.111               : ok=3    changed=1    unreachable=0    failed=0 <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u0424\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438, \u043c\u044b \u0434\u0432\u0430 \u0440\u0430\u0437\u0430 \u0432\u044b\u0437\u0432\u0430\u043b\u0438 <a href=\"http:\/\/docs.ansible.com\/apt_module.html\">\u043c\u043e\u0434\u0443\u043b\u044c apt<\/a>, \u0442\u043e\u043b\u044c\u043a\u043e \u0441 \u0440\u0430\u0437\u043d\u044b\u043c\u0438 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u043c\u0438. \u0421\u0430\u043c \u0436\u0435 \u0444\u0430\u0439\u043b \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0438 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u0435\u0431\u044f \u0444\u0430\u0439\u043b \u043d\u0430 <a href=\"https:\/\/ru.wikipedia.org\/wiki\/YAML\">\u044f\u0437\u044b\u043a\u0435 Yaml<\/a> \u0441 \u0432\u043a\u0440\u0430\u043f\u043b\u0435\u043d\u0438\u044f\u043c\u0438 \u0448\u0430\u0431\u043b\u043e\u043d\u0438\u0437\u0430\u0442\u043e\u0440\u0430 <a href=\"http:\/\/jinja.pocoo.org\/\">Jinja2<\/a>.<\/p>\n<h2>\u041d\u0430 \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c\u044b\u0435 \u0443\u0437\u043b\u044b \u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0442\u044c \u043d\u0438\u043a\u0430\u043a\u043e\u0433\u043e \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u041f\u041e<\/h2>\n<p>  \u0414\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e, \u0434\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u043c\u0430\u0448\u0438\u043d\u043e\u0439, \u043d\u0430 \u043d\u0435\u0439 \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d Python (\u0430 \u043e\u043d \u0441\u0442\u043e\u0438\u0442 \u043f\u043e-\u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u043d\u0430 \u0432\u0441\u0435\u0445 \u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 linux \u0441\u0438\u0441\u0442\u0435\u043c\u0430\u0445) \u0438 \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f \u043f\u043e ssh. \u0421\u0440\u0430\u0432\u043d\u0438\u0442\u0435 \u044d\u0442\u043e \u0441 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u043c\u0438 \u0441\u0438\u0441\u0442\u0435\u043c\u0430\u043c\u0438, \u0433\u0434\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u043a\u043b\u0438\u0435\u043d\u0442\u0430, \u043a\u043e\u0442\u043e\u0440\u043e\u043c\u0443 \u043d\u0443\u0436\u043d\u044b \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0435 \u0432\u0435\u0440\u0441\u0438\u0438 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u044f\u0437\u044b\u043a\u043e\u0432 \u0438 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a. \u0418\u043c\u0435\u043d\u043d\u043e \u044d\u0442\u043e\u0442 \u0444\u0430\u043a\u0442, \u043a\u0441\u0442\u0430\u0442\u0438, \u0434\u0435\u043b\u0430\u0435\u0442 \u0441\u0442\u0430\u0440\u0442 \u0441 ansible \u0433\u043e\u0440\u0430\u0437\u0434\u043e \u0431\u043e\u043b\u0435\u0435 \u043f\u0440\u043e\u0441\u0442\u044b\u043c, \u0447\u0435\u043c \u0434\u043b\u044f \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0445 \u0441\u0438\u0441\u0442\u0435\u043c.<\/p>\n<h2>\u041f\u0440\u043e\u0441\u0442\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u043c\u043e\u0434\u0443\u043b\u044c<\/h2>\n<p>  \u041c\u043e\u0434\u0443\u043b\u044c \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043d\u0430 \u043b\u044e\u0431\u043e\u043c \u044f\u0437\u044b\u043a\u0435, \u043e\u043d \u0434\u043e\u043b\u0436\u0435\u043d \u0443\u043c\u0435\u0442\u044c \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0442\u044c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u043d\u0430 \u0432\u0445\u043e\u0434 \u0438 \u0432\u044b\u0434\u0430\u0432\u0430\u0442\u044c json \u0432 \u043e\u0442\u0432\u0435\u0442. \u041d\u043e \u0437\u0430\u0447\u0435\u043c \u043f\u0438\u0441\u0430\u0442\u044c \u043d\u043e\u0432\u044b\u0439 \u043c\u043e\u0434\u0443\u043b\u044c, \u0435\u0441\u043b\u0438 \u0443\u0436\u0435 <a href=\"http:\/\/docs.ansible.com\/list_of_all_modules.html\">\u0435\u0441\u0442\u044c 242 \u043c\u043e\u0434\u0443\u043b\u044f<\/a> \u043d\u0430 \u0432\u0441\u0435 \u0441\u043b\u0443\u0447\u0430\u0438 \u0436\u0438\u0437\u043d\u0438 (\u0432 \u0432\u0435\u0440\u0441\u0438\u0438 1.8.4). \u041d\u0430 \u0441\u043b\u0443\u0447\u0430\u0439, \u0435\u0441\u043b\u0438 \u0432\u0430\u043c \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0447\u0435\u0433\u043e-\u0442\u043e \u043d\u0435 \u0445\u0432\u0430\u0442\u0430\u0435\u0442, \u0435\u0441\u0442\u044c <a href=\"http:\/\/docs.ansible.com\/developing_modules.html\">\u0445\u043e\u0440\u043e\u0448\u0435\u0435 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0441\u0432\u043e\u0439 \u043c\u043e\u0434\u0443\u043b\u044c<\/a>.<\/p>\n<h2>\u0427\u0442\u043e-\u043d\u0438\u0431\u0443\u0434\u044c \u0441\u0435\u0440\u044c\u0435\u0437\u043d\u043e\u0435<\/h2>\n<p>  \u0414\u0435\u043b\u0430\u0442\u044c \u043e\u0433\u0440\u043e\u043c\u043d\u0443\u044e \u043f\u0440\u043e\u0441\u0442\u044b\u043d\u044e \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u044f \u043d\u0435 \u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u0431\u044b, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u0440\u0430\u0437\u043e\u0431\u044c\u0435\u043c \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0439 \u043d\u0430 \u0447\u0430\u0441\u0442\u0438, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c \u0440\u043e\u043b\u0435\u0439.<\/p>\n<p>  \u0414\u043b\u044f \u0442\u0435\u0445, \u043a\u043e\u043c\u0443 \u043b\u0435\u043d\u044c \u0447\u0442\u043e-\u0442\u043e \u043f\u0438\u0441\u0430\u0442\u044c \u0441\u0430\u043c\u043e\u043c\u0443, \u0443\u0436\u0435 \u0435\u0441\u0442\u044c \u0442\u044b\u0441\u044f\u0447\u0438 \u0433\u043e\u0442\u043e\u0432\u044b\u0445 \u0440\u043e\u043b\u0435\u0439 \u043d\u0430 \u0441\u0430\u0439\u0442\u0435 <a href=\"https:\/\/galaxy.ansible.com\/list#\/roles\">ansible galaxy<\/a>, \u0438 \u043e\u043d\u0438 \u0432\u043f\u043e\u043b\u043d\u0435 \u0434\u043e\u0441\u0442\u043e\u0439\u043d\u043e\u0433\u043e \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0430, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0438\u043c\u0438 \u0432 \u0431\u043e\u044e.<\/p>\n<p>  \u041c\u044b \u0436\u0435 \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0447\u0438\u0441\u0442\u0443\u044e \u0440\u043e\u043b\u044c.  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">ansible-galaxy init nginx -p roles<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code>$ ansible-galaxy init nginx -p roles - nginx was created successfully  $ tree \u251c\u2500\u2500 roles \u2502\u00a0\u00a0 \u2514\u2500\u2500 nginx \u2502\u00a0\u00a0     \u251c\u2500\u2500 README.md \u2502\u00a0\u00a0     \u251c\u2500\u2500 defaults \u2502\u00a0\u00a0     \u2502\u00a0\u00a0 \u2514\u2500\u2500 main.yml \u2502\u00a0\u00a0     \u251c\u2500\u2500 files \u2502\u00a0\u00a0     \u251c\u2500\u2500 handlers \u2502\u00a0\u00a0     \u2502\u00a0\u00a0 \u2514\u2500\u2500 main.yml \u2502\u00a0\u00a0     \u251c\u2500\u2500 meta \u2502\u00a0\u00a0     \u2502\u00a0\u00a0 \u2514\u2500\u2500 main.yml \u2502\u00a0\u00a0     \u251c\u2500\u2500 tasks \u2502\u00a0\u00a0     \u2502\u00a0\u00a0 \u2514\u2500\u2500 main.yml \u2502\u00a0\u00a0     \u251c\u2500\u2500 templates \u2502\u00a0\u00a0     \u2514\u2500\u2500 vars \u2502\u00a0\u00a0         \u2514\u2500\u2500 main.yml <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u0414\u043e\u0440\u0430\u0431\u043e\u0442\u0430\u0435\u043c \u0444\u0430\u0439\u043b <code>web.yml<\/code>.  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">web.yml<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code>--- - hosts: all   user: ubuntu   sudo: yes    roles:     - nginx <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430 \u043a\u043b\u044e\u0447 <code>sudo: yes<\/code>. \u041e\u043d \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043d\u0435 \u043f\u0438\u0441\u0430\u0442\u044c \u0432 \u043a\u0430\u0436\u0434\u043e\u043c \u0437\u0430\u0434\u0430\u043d\u0438\u0438 \u044d\u0442\u0443 \u0441\u0442\u0440\u043e\u043a\u0443. \u0411\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u043e \u0430\u0434\u043c\u0438\u043d\u0438\u0441\u0442\u0440\u0430\u0442\u0438\u0432\u043d\u044b\u0445 \u0437\u0430\u0434\u0430\u0447 \u0432\u0441\u0435 \u0440\u0430\u0432\u043d\u043e \u0434\u043e\u043b\u0436\u043d\u044b \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c\u0441\u044f \u0441 \u043f\u0440\u0430\u0432\u0430\u043c\u0438 <code>root<\/code>, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0438\u043c\u0435\u0435\u0442 \u0441\u043c\u044b\u0441\u043b \u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0435\u0433\u043e \u0437\u0434\u0435\u0441\u044c.<\/p>\n<p>  \u0410 \u0432 \u0444\u0430\u0439\u043b\u0435 <code>roles\/nginx\/tasks\/main.yml<\/code> \u043d\u0430\u043f\u0438\u0448\u0435\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435:<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">roles\/nginx\/tasks\/main.yml<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code>--- - name: Update apt cache   apt: update_cache=yes  - name: Install required packages   apt: name=nginx <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0440\u043e\u043b\u0438, \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043a\u043e\u0434 (\u0445\u043e\u0442\u044f \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043b\u0438 Yaml \u043a\u043e\u0434\u043e\u043c\u00a0\u2014 \u0444\u0438\u043b\u043e\u0441\u043e\u0444\u0441\u043a\u0438\u0439 \u0432\u043e\u043f\u0440\u043e\u0441). \u041a\u043e\u043d\u0435\u0447\u043d\u043e, \u043f\u0440\u0438\u043c\u0435\u0440 \u043d\u0430\u043c\u0435\u0440\u0435\u043d\u043d\u043e \u0443\u043f\u0440\u043e\u0449\u0435\u043d, \u043d\u043e \u0438\u0437 \u043d\u0435\u0433\u043e \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u044f\u0441\u043d\u043e, \u043a\u0430\u043a \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u043e\u0432\u044b\u0432\u0430\u0442\u044c \u043d\u0430 ansible \u043f\u0440\u043e\u0435\u043a\u0442\u044b \u0441 \u0431\u043e\u043b\u044c\u0448\u0438\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e\u043c \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442.<\/p>\n<h2>\u0424\u0430\u043a\u0442\u044b<\/h2>\n<p>  \u0412 ansible \u0435\u0441\u0442\u044c \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0439 \u043c\u043e\u0434\u0443\u043b\u044c <code>setup<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u043f\u0435\u0440\u0432\u044b\u043c \u0434\u043b\u044f \u0432\u0441\u0435\u0445 \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c\u044b\u0445 \u043d\u043e\u0434. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c, \u0447\u0442\u043e \u043e\u043d \u0434\u0435\u043b\u0430\u0435\u0442.<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">ansible -m setup all -u ubuntu<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code>$ ansible -m setup all -u ubuntu     &quot;ansible_facts&quot;: {         &quot;ansible_all_ipv4_addresses&quot;: [             &quot;172.31.7.80&quot;         ],         &quot;ansible_architecture&quot;: &quot;x86_64&quot;,         &quot;ansible_bios_date&quot;: &quot;12\/03\/2014&quot;,         &quot;ansible_bios_version&quot;: &quot;4.2.amazon&quot;,         &quot;ansible_cmdline&quot;: {             &quot;BOOT_IMAGE&quot;: &quot;\/boot\/vmlinuz-3.13.0-44-generic&quot;,             &quot;console&quot;: &quot;ttyS0&quot;,             &quot;ro&quot;: true,             &quot;root&quot;: &quot;UUID=fd803688-5c41-4188-8a06-382a65a520bf&quot;         },         &quot;ansible_default_ipv4&quot;: {             &quot;address&quot;: &quot;172.31.7.80&quot;,             &quot;alias&quot;: &quot;eth0&quot;,             &quot;gateway&quot;: &quot;172.31.0.1&quot;,             &quot;interface&quot;: &quot;eth0&quot;,             &quot;macaddress&quot;: &quot;06:a8:07:41:47:a5&quot;,             &quot;mtu&quot;: 9001,             &quot;netmask&quot;: &quot;255.255.240.0&quot;,             &quot;network&quot;: &quot;172.31.0.0&quot;,             &quot;type&quot;: &quot;ether&quot;         }    ... \u0438 \u0442\u0430\u043a \u0434\u0430\u043b\u0435\u0435 <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u041c\u043e\u0434\u0443\u043b\u044c setup \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u0442 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0434\u043b\u044f \u043d\u043e\u0434\u044b, \u044d\u0442\u043e \u0430\u043d\u0430\u043b\u043e\u0433 ohai \u0432 chef (\u043a\u0441\u0442\u0430\u0442\u0438, ansible \u0442\u043e\u0436\u0435 \u043c\u043e\u0436\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c ohai \u0434\u043b\u044f \u0441\u0431\u043e\u0440\u0430 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438). \u0412\u0441\u0435 \u044d\u0442\u0438 \u0434\u0430\u043d\u043d\u044b\u0435 \u043f\u043e\u0442\u043e\u043c \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u044f\u0445 \u0438 \u0448\u0430\u0431\u043b\u043e\u043d\u0430\u0445. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, ip \u0430\u0434\u0440\u0435\u0441 \u043f\u043e-\u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c, \u043e\u0431\u0440\u0430\u0442\u0438\u0432\u0448\u0438\u0441\u044c \u043a \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 <code>ansible_default_ipv4<\/code>.<\/p>\n<pre><code># web.yml  tasks:   - debug: msg={{ansible_default_ipv4}} <\/code><\/pre>\n<div class=\"spoiler\"><b class=\"spoiler_title\">ansible-playbook web.yml<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code>$ ansible-playbook web.yml  PLAY [all] ********************************************************************  GATHERING FACTS *************************************************************** ok: [111.111.111.111]  TASK: [debug msg=&quot;{{ansible_default_ipv4}}&quot;] ********************************** ok: [111.111.111.111] =&gt; {     &quot;msg&quot;: &quot;{u'macaddress': u'06:a8:07:41:47:a5', u'network': u'172.31.0.0', u'mtu': 9001, u'alias': u'eth0', u'netmask': u'255.255.240.0', u'address': u'172.31.7.80', u'interface': u'eth0', u'type': u'ether', u'gateway': u'172.31.0.1'}&quot; } <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<h2>\u0428\u0430\u0431\u043b\u043e\u043d\u044b<\/h2>\n<p>  \u0412 ansible \u0435\u0441\u0442\u044c \u0448\u0430\u0431\u043b\u043e\u043d\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442 \u0448\u0430\u0431\u043b\u043e\u043d\u0438\u0437\u0430\u0442\u043e\u0440 Jinja2. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0441\u0434\u0435\u043b\u0430\u0435\u043c 2 \u0448\u0430\u0431\u043b\u043e\u043d\u0430.<\/p>\n<pre><code># roles\/nginx\/templates\/ansible.conf.j2  server {         listen 80 default_server;          root \/usr\/share\/nginx\/html;         index index.html index.htm; } <\/code><\/pre>\n<pre><code># roles\/nginx\/templates\/index.html.j2 &lt;html&gt; &lt;body&gt; &lt;pre&gt; {{ ansible_default_ipv4 }}  {{ ansible_env }} &lt;\/pre&gt; &lt;\/body&gt; &lt;\/html&gt; <\/code><\/pre>\n<p>  \u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u0432 \u0434\u0432\u043e\u0439\u043d\u044b\u0445 \u0444\u0438\u0433\u0443\u0440\u043d\u044b\u0445 \u0441\u043a\u043e\u0431\u043a\u0430\u0445 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, <code>{{ ansible_env }}<\/code>)\u00a0\u2014 \u044d\u0442\u043e \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 ansible, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u044b \u0441\u043e\u0431\u0440\u0430\u043b\u0438 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0443\u0436\u0435 \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u043e\u0433\u043e \u043d\u0430\u043c \u043c\u043e\u0434\u0443\u043b\u044f <code>setup<\/code>.<\/p>\n<h2>\u0425\u0435\u043d\u0434\u043b\u0435\u0440\u044b<\/h2>\n<p>  \u0414\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u043e\u0442\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u043a\u0430\u043a\u0438\u0435-\u0442\u043e \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e, \u0432 ansible \u0435\u0441\u0442\u044c \u0445\u0435\u043d\u0434\u043b\u0435\u0440\u044b (\u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438), \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0436\u043d\u043e \u0432\u044b\u0437\u0432\u0430\u0442\u044c \u0438\u0437 \u0437\u0430\u0434\u0430\u0447. \u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0441\u0432\u043e\u0439 \u0445\u0435\u043d\u0434\u043b\u0435\u0440, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0435\u0440\u0435\u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u0442 nginx.<\/p>\n<pre><code># roles\/nginx\/handlers\/main.yml --- # handlers file for nginx  - name: reload nginx   service: name=nginx state=reloaded <\/code><\/pre>\n<p>  \u0414\u043e\u0440\u0430\u0431\u043e\u0442\u0430\u0435\u043c \u0442\u0435\u043f\u0435\u0440\u044c \u0444\u0430\u0439\u043b \u0437\u0430\u0434\u0430\u0447 \u0440\u043e\u043b\u0438 nginx.<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">roles\/nginx\/tasks\/main.yml<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code># roles\/nginx\/tasks\/main.yml --- - name: Update apt cache   apt: update_cache=yes  - name: Install required packages   apt: name=nginx  - name: Start nginx service   service: name=nginx state=started  - name: Delete default nginx site   file: path=\/etc\/nginx\/sites-enabled\/default state=absent   notify: reload nginx  - name: Create default nginx site   template: src=ansible.conf.j2 dest=\/etc\/nginx\/sites-enabled\/ansible owner=www-data group=www-data   notify: reload nginx  - name: Create index.html file   template: src=index.html.j2 dest=\/usr\/share\/nginx\/html\/index.html owner=www-data group=www-data <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u041a\u0430\u043a \u043f\u043e\u043d\u044f\u0442\u043d\u043e \u0438\u0437 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u044f, \u0434\u0430\u043d\u043d\u0430\u044f \u0437\u0430\u0434\u0430\u0447\u0430 \u0441\u0442\u0430\u0432\u0438\u0442 nginx, \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442 \u0435\u0433\u043e, \u0443\u0434\u0430\u043b\u044f\u0435\u0442 \u0444\u0430\u0439\u043b \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 nginx \u043f\u043e-\u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e, \u0441\u043e\u0437\u0434\u0430\u0435\u0442 \u0444\u0430\u0439\u043b \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 \u0438\u0437 \u0448\u0430\u0431\u043b\u043e\u043d\u0430 <code>ansible.conf.j2<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u044b \u043d\u0430\u043f\u0438\u0441\u0430\u043b\u0438 \u0432\u044b\u0448\u0435, \u0438 \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u0442 \u0444\u0430\u0439\u043b <code>index.html<\/code> \u0438\u0437 \u0448\u0430\u0431\u043b\u043e\u043d\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u044b \u043e\u043f\u0438\u0441\u0430\u043b\u0438 \u0432\u044b\u0448\u0435. \u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u0447\u0442\u043e \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0437\u0430\u0434\u0430\u0447\u0438 \u043f\u043e\u0441\u044b\u043b\u0430\u044e\u0442 \u043d\u043e\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044e <code>notify: reload nginx<\/code>. \u041f\u0440\u0438\u0447\u0435\u043c, \u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0434\u043e\u043b\u0436\u043d\u043e \u0431\u044b\u0442\u044c \u043f\u043e\u0441\u043b\u0430\u043d\u043e 2 \u043d\u043e\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u043d\u0430 \u043f\u0435\u0440\u0435\u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0443 nginx, \u043d\u043e, \u043f\u043e \u0444\u0430\u043a\u0442\u0443, \u043e\u043d\u0438 \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u044f\u0442\u0441\u044f \u0432 \u043e\u0434\u043d\u0443, \u043a\u0430\u043a \u0431\u0443\u0434\u0435\u0442 \u0432\u0438\u0434\u043d\u043e \u043d\u0438\u0436\u0435. \u041d\u043e\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b, \u0447\u0442\u043e\u0431\u044b \u043f\u0435\u0440\u0435\u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0442\u044c nginx (\u0438\u043b\u0438 \u043b\u044e\u0431\u043e\u0439 \u0434\u0440\u0443\u0433\u043e\u0439 \u0441\u0435\u0440\u0432\u0438\u0441) \u0442\u043e\u043b\u044c\u043a\u043e \u0432 \u0441\u043b\u0443\u0447\u0430\u0435, \u0435\u0441\u043b\u0438 \u0448\u0430\u0431\u043b\u043e\u043d (\u0438\u043b\u0438 \u0447\u0442\u043e-\u0442\u043e \u0434\u0440\u0443\u0433\u043e\u0435) \u0438\u0437\u043c\u0435\u043d\u0438\u043b\u0441\u044f, \u0447\u0442\u043e\u0431\u044b \u043d\u0435 \u0434\u0435\u043b\u0430\u0442\u044c \u044d\u0442\u043e \u043a\u0430\u0436\u0434\u044b\u0439 \u0440\u0430\u0437 \u043f\u0440\u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0435 ansible.<\/p>\n<p>  \u0418\u0442\u0430\u043a, \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u043c \u043f\u043e\u043b\u0443\u0447\u0438\u0432\u0448\u0438\u0439\u0441\u044f \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0439.<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">ansible-playbook web.yml<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code>$ ansible-playbook web.yml  PLAY [all] ********************************************************************  GATHERING FACTS *************************************************************** ok: [111.111.111.111]  TASK: [nginx | Update apt cache] ********************************************** ok: [111.111.111.111]  TASK: [nginx | Install required packages] ************************************* ok: [111.111.111.111]  TASK: [nginx | Start nginx service] ******************************************* ok: [111.111.111.111]  TASK: [nginx | Delete default nginx site] ************************************* changed: [111.111.111.111]  TASK: [nginx | Create default nginx site] ************************************* changed: [111.111.111.111]  TASK: [nginx | Create index.html file] **************************************** changed: [111.111.111.111]  TASK: [debug msg=&quot;{{ansible_default_ipv4}}&quot;] ********************************** ok: [111.111.111.111] =&gt; {     &quot;msg&quot;: &quot;{u'macaddress': u'06:a8:07:41:47:a5', u'network': u'172.31.0.0', u'mtu': 9001, u'alias': u'eth0', u'netmask': u'255.255.240.0', u'address': u'172.31.7.80', u'interface': u'eth0', u'type': u'ether', u'gateway': u'172.31.0.1'}&quot; }  NOTIFIED: [nginx | reload nginx] ********************************************** changed: [111.111.111.111]  PLAY RECAP ******************************************************************** 111.111.111.111               : ok=9    changed=4    unreachable=0    failed=0 <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u041a\u0430\u043a \u0432\u0438\u0434\u0438\u0442\u0435, \u0432 \u043a\u043e\u043d\u0446\u0435 nginx \u043f\u0435\u0440\u0435\u0437\u0430\u0433\u0440\u0443\u0437\u0438\u043b \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044e. \u0417\u0430\u0433\u043b\u044f\u043d\u0435\u043c \u0432 \u0431\u0440\u0430\u0443\u0437\u0435\u0440.<\/p>\n<p>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/ce3\/877\/ced\/ce3877ced8565d891eb23410a2350e4e.png\"\/><\/p>\n<p>  \u0412\u0443\u0430\u043b\u044f! \u041c\u044b \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043b\u0438 \u0438 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u043b\u0438 nginx \u0441 \u043d\u0443\u0436\u043d\u044b\u043c \u043d\u0430\u043c \u0444\u0430\u0439\u043b\u043e\u043c \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438, \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043b\u0438 \u0434\u043b\u044f \u043d\u0435\u0433\u043e \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443 \u0441 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u0438\u0437 ansible, \u0438 \u043f\u0435\u0440\u0435\u0437\u0430\u0433\u0440\u0443\u0437\u0438\u043b\u0438 nginx.<\/p>\n<h2>\u041d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043a\u0438<\/h2>\n<p>  \u0418 \u0447\u0442\u043e\u0431\u044b \u0432\u044b \u043d\u0435 \u043f\u043e\u0434\u0443\u043c\u0430\u043b\u0438, \u0447\u0442\u043e ansible \u0438\u0434\u0435\u0430\u043b\u044c\u043d\u044b\u0439 \u043f\u0440\u043e\u0434\u0443\u043a\u0442, \u043a\u043e\u0442\u043e\u0440\u043e\u043c\u0443 \u043d\u0435\u043a\u0443\u0434\u0430 \u0440\u0430\u0437\u0432\u0438\u0432\u0430\u0442\u044c\u0441\u044f, \u044f \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0443 \u043e \u0435\u0433\u043e \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043a\u0430\u0445.<\/p>\n<ul>\n<li>\u041e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u0435 \u043c\u0435\u043d\u0435\u0434\u0436\u0435\u0440\u0430 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0435\u0439. \u0421\u0435\u0439\u0447\u0430\u0441 \u0432\u0441\u0435 \u0440\u043e\u043b\u0438 \u043c\u043e\u0436\u043d\u043e \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0432 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u0430\u0440\u0438\u0438, \u043d\u043e \u043a\u0430\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u044f\u043c\u0438 \u0438 \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u0442\u044c \u0440\u043e\u043b\u0438\u00a0\u2014 \u0432\u043d\u044f\u0442\u043d\u043e\u0433\u043e \u043e\u0442\u0432\u0435\u0442\u0430 \u043d\u0435\u0442. \u0412\u0441\u0435 \u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u044d\u0442\u0438\u043c \u043f\u043e\u0434\u0445\u043e\u0434\u043e\u043c (\u0442\u0430\u043a \u0436\u0435 \u0431\u044b\u043b\u043e \u0441 Chef, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, 3 \u0433\u043e\u0434\u0430 \u043d\u0430\u0437\u0430\u0434), \u043d\u043e \u043f\u0440\u0438 \u0440\u0430\u0437\u0440\u0430\u0441\u0442\u0430\u043d\u0438\u0438 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u043e\u0447\u0435\u0432\u0438\u0434\u043d\u044b \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043a\u0438 \u0442\u0430\u043a\u043e\u0433\u043e \u043f\u043e\u0434\u0445\u043e\u0434\u0430. <em>UPDATE<\/em> \u041c\u0435\u043d\u0435\u0434\u0436\u0435\u0440 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0435\u0439 \u0432 <a href=\"http:\/\/docs.ansible.com\/galaxy.html#advanced-control-over-role-requirements-files\">\u043a\u0430\u043a\u043e\u043c-\u0442\u043e \u0432\u0438\u0434\u0435 \u0435\u0441\u0442\u044c<\/a>, \u043d\u0435\u043f\u043e\u043d\u044f\u0442\u043d\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u0447\u0435\u043c\u0443 \u043e\u0431 \u044d\u0442\u043e\u043c \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043e \u00ab\u0441\u043d\u0438\u0437\u0443 \u043c\u0435\u043b\u043a\u0438\u043c \u0448\u0440\u0438\u0444\u0442\u043e\u043c\u00bb.<\/li>\n<li>\u041d\u0435\u043f\u043e\u043b\u043d\u0430\u044f \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f. \u041e\u0442\u0432\u0435\u0442\u044b \u043d\u0430 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043e\u0447\u0435\u0432\u0438\u0434\u043d\u044b\u0435 \u0432\u043e\u043f\u0440\u043e\u0441\u044b \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0433\u0443\u0433\u043b\u0438\u0442\u044c, \u0438 \u0437\u0430\u0447\u0430\u0441\u0442\u0443\u044e \u043e\u043d\u0438 \u043d\u0430\u0445\u043e\u0434\u044f\u0442\u0441\u044f \u0432 \u0447\u0430\u0441\u0442\u043d\u044b\u0445 \u0431\u043b\u043e\u0433\u0430\u0445 \u0438 \u0442\u0438\u043a\u0435\u0442\u0430\u0445 \u043d\u0430 github.<\/li>\n<li>\u0420\u0435\u0436\u0438\u043c ansible-pull \u0434\u043b\u044f \u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u0438\u043d\u0441\u0442\u0430\u043b\u043b\u044f\u0446\u0438\u0439 \u043f\u043e\u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u0441\u0435\u0440\u044c\u0435\u0437\u043d\u043e\u0439 \u00ab\u0434\u043e\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u043d\u0430\u043f\u0438\u043b\u044c\u043d\u0438\u043a\u043e\u043c\u00bb.<\/li>\n<li>\u041d\u0435\u0443\u0434\u043e\u0431\u043d\u044b\u0439 \u0434\u0435\u0431\u0430\u0433. \u0414\u0430\u0436\u0435 \u043f\u0440\u0438 \u0432\u044b\u0437\u043e\u0432\u0435 \u0441 \u043a\u043b\u044e\u0447\u043e\u043c <code>-vvvv<\/code> \u043d\u0435 \u0432\u0441\u0435\u0433\u0434\u0430 \u043f\u043e\u043d\u044f\u0442\u043d\u043e, \u043a\u0430\u043a\u0430\u044f \u0436\u0435 \u0438\u043c\u0435\u043d\u043d\u043e \u043a\u043e\u043c\u0430\u043d\u0434\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u043b\u0430\u0441\u044c \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0435 \u0438 \u0447\u0442\u043e \u043f\u043e\u043c\u0435\u0448\u0430\u043b\u043e \u0435\u0439 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c\u0441\u044f.<\/li>\n<li>\u0411\u044b\u0441\u0442\u0440\u0430\u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0430. \u041a\u043e\u043d\u0435\u0447\u043d\u043e, \u0443 \u044d\u0442\u043e\u0433\u043e \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043a\u0430 \u0435\u0441\u0442\u044c \u043e\u0431\u0440\u0430\u0442\u043d\u0430\u044f \u0441\u0442\u043e\u0440\u043e\u043d\u0430\u00a0\u2014 ansible \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0431\u044b\u0441\u0442\u0440\u043e \u0440\u0430\u0437\u0432\u0438\u0432\u0430\u0435\u0442\u0441\u044f. \u041d\u043e \u044f \u043d\u0430\u0442\u043a\u043d\u0443\u043b\u0441\u044f \u043d\u0430 \u0431\u0430\u0433, \u043a\u043e\u0433\u0434\u0430 \u0432\u0435\u0440\u0441\u0438\u044f 1.8.1 \u0440\u0430\u0431\u043e\u0442\u0430\u043b\u0430, \u0430 1.8.4\u00a0\u2014 \u0441\u043b\u043e\u043c\u0430\u043b\u0430\u0441\u044c.<\/li>\n<\/ul>\n<div class=\"clear\"><\/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\/254959\/\"> http:\/\/habrahabr.ru\/post\/254959\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>     \t<a href=\"http:\/\/www.ansible.com\/home\">Ansible<\/a>\u00a0\u2014 \u0441\u0440\u0430\u0432\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043c\u043e\u043b\u043e\u0434\u0430\u044f \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\u0435\u0439, \u0435\u0433\u043e \u0438\u0441\u0442\u043e\u0440\u0438\u044f \u043d\u0430\u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u0442 \u0447\u0443\u0442\u044c \u0431\u043e\u043b\u0435\u0435 \u0442\u0440\u0435\u0445 \u043b\u0435\u0442. \u041d\u043e, \u043d\u0435\u0441\u043c\u043e\u0442\u0440\u044f \u043d\u0430 \u044d\u0442\u043e, \u043e\u043d \u0441\u0442\u0440\u0435\u043c\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0438 \u0431\u044b\u0441\u0442\u0440\u043e \u0432\u043e\u0440\u0432\u0430\u043b\u0441\u044f \u0432 \u043c\u0438\u0440 \u0441\u0438\u0441\u0442\u0435\u043c \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0435\u0439, \u043f\u043e\u0442\u0435\u0441\u043d\u0438\u0432 Chef, Puppet \u0438 SaltStack.<\/p>\n<p>  \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430 \u043d\u0435\u0433\u043e \u0432\u043d\u0438\u043c\u0430\u0442\u0435\u043b\u044c\u043d\u043e, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043d\u044f\u0442\u044c, \u043f\u043e\u0447\u0435\u043c\u0443 \u043e\u043d \u0442\u0430\u043a \u043b\u044e\u0431\u0438\u043c \u0442\u0435\u0445\u043d\u0430\u0440\u044f\u043c\u0438.<\/p>\n<p>  \u0418\u0442\u0430\u043a, \u0447\u0435\u043c \u0436\u0435 \u0445\u043e\u0440\u043e\u0448 ansbile:  <\/p>\n<ul>\n<li>\u043d\u0438\u0437\u043a\u0438\u0439 \u043f\u043e\u0440\u043e\u0433 \u0432\u0445\u043e\u0434\u0430;<\/li>\n<li>\u0434\u0435\u043a\u043b\u0430\u0440\u0430\u0442\u0438\u0432\u043d\u044b\u0439 \u044f\u0437\u044b\u043a \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438;<\/li>\n<li>\u043d\u0430 \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c\u044b\u0435 \u0443\u0437\u043b\u044b \u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0442\u044c \u043d\u0438\u043a\u0430\u043a\u043e\u0433\u043e \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u041f\u041e;<\/li>\n<li>\u043f\u0440\u043e\u0441\u0442\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u043c\u043e\u0434\u0443\u043b\u044c.<\/li>\n<\/ul>\n<p>  <\/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-254582","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/254582","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=254582"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/254582\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=254582"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=254582"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=254582"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}