{"id":218231,"date":"2014-04-04T11:38:06","date_gmt":"2014-04-04T07:38:06","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=218231"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=218231","title":{"rendered":"<span class=\"post_title\">SaltStack: \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u043b\u044c\u043d\u044b\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e\u043c \u0444\u0430\u0439\u043b\u043e\u0432 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0439<\/span>"},"content":{"rendered":"<div class=\"content html_format\">\n<h4><b>\u0427\u0442\u043e \u0437\u0434\u0435\u0441\u044c \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e\u0433\u043e?<\/b><\/h4>\n<p>  \u0421\u0442\u0430\u0442\u044c\u044f \u043f\u043e\u043c\u043e\u0436\u0435\u0442 \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c\u0441\u044f \u0441 \u0442\u0435\u043c, \u043a\u0430\u043a \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u043b\u044c\u043d\u044b\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e\u043c \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0445 \u0444\u0430\u0439\u043b\u043e\u0432 \u043d\u0435\u043a\u043e\u0435\u0433\u043e \u0441\u0435\u0440\u0432\u0438\u0441\u0430 \u0432 SaltStack. <\/p>\n<h4><b>SaltStack (underfloor): \u0447\u0442\u043e \u044d\u0442\u043e \u0438 \u043a\u0430\u043a \u0441 \u043d\u0438\u043c \u0431\u044b\u0442\u044c?<\/b><\/h4>\n<p>  \u041c\u043d\u043e\u0433\u0438\u0435 \u0443\u0436\u0435 \u0438\u043c\u0435\u043b\u0438 \u043e\u043f\u044b\u0442 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0441\u0438\u0441SaltStack (u\u0442\u0435\u043c\u0430\u043c\u0438 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0433\u043e \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044f\u043c\u0438, \u043a \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0441\u044f Salt, \u0438 \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e \u043e \u0442\u043e\u043c \u043a\u0430\u043a \u0435\u0433\u043e \u0433\u043e\u0442\u043e\u0432\u0438\u0442\u044c \u0438 \u0447\u0442\u043e \u043e\u043d \u043c\u043e\u0436\u0435\u0442 \u044f \u043d\u0435 \u0441\u0442\u0430\u043d\u0443, <a href=\"http:\/\/www.saltstack.com\/integrations\/\">\u0442\u0443\u0442<\/a> \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0447\u0435\u0441\u0442\u044c \u0447\u0442\u043e \u044d\u0442\u043e, \u0430 <a href=\"http:\/\/docs.saltstack.com\/en\/latest\/topics\/tutorials\/walkthrough.html\">\u0442\u0443\u0442<\/a> \u043f\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u043a\u0430\u043a \u0435\u0433\u043e \u0431\u044b\u0441\u0442\u0440\u043e \u0438 \u043b\u0435\u0433\u043a\u043e \u043f\u0440\u0438\u0433\u043e\u0442\u043e\u0432\u0438\u0442\u044c.<\/p>\n<h4><b>SaltStack (lobby): \u0442\u0438\u043f\u0438\u0447\u043d\u043e\u0435 \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u043d\u0430 \u043f\u0440\u043e\u0441\u0442\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435<\/b><\/h4>\n<p>  \u0418\u0442\u0430\u043a, \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0438\u043c, \u0443 \u0412\u0430\u0441 \u0435\u0441\u0442\u044c \u0437\u0430\u0434\u0430\u0447\u0430 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0443, \u0432\u043d\u0435\u0434\u0440\u0435\u043d\u0438\u0435 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0445 \u0444\u0430\u0439\u043b\u043e\u0432 \u0438 \u043c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u043d\u0433 \u0438\u0445 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439, \u043f\u0435\u0440\u0435\u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0443 \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u0442\u0430\u043a\u043e\u0433\u043e \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u043e\u0433\u043e \u0441\u0435\u0440\u0432\u0438\u0441\u0430 \u043a\u0430\u043a nginx. \u0414\u043b\u044f \u0443\u043f\u0440\u043e\u0449\u0435\u043d\u0438\u044f \u0441\u0438\u0441\u0442\u0435\u043c\u044b, \u0441\u0434\u0435\u043b\u0430\u0435\u043c \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0447\u0442\u043e \u043e\u0431\u0441\u043b\u0443\u0436\u0438\u0432\u0430\u0435\u043c\u044b\u0435 \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u044b \u043d\u0430 \u0431\u0430\u0437\u0435 Debian Wheezy. (\u0414\u043b\u044f \u0432\u0441\u0435\u0445 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0445, \u2014 \u0447\u0438\u0442\u0430\u0435\u043c \u043f\u0440\u043e <a href=\"http:\/\/docs.saltstack.com\/en\/latest\/topics\/targeting\/grains.html\">grains<\/a> \u0441\u0438\u0441\u0442\u0435\u043c\u0443, \u2014 \u043e\u043d\u0430 \u043f\u043e\u043c\u043e\u0436\u0435\u0442 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u043d\u0430 \u043a\u0430\u043a\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u0435 \u043c\u044b \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u043c \u0441\u0442\u0435\u0439\u0442 \u0438 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u043f\u043e\u043c\u0435\u043d\u044f\u0442\u044c \u0435\u0433\u043e \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435). <br \/>  \u0418\u0442\u0430\u043a:<br \/>  <a name=\"habracut\"><\/a>  <\/p>\n<pre><code class=\"python\">nginx-repo-key-install:   cmd.run:         - name: 'apt-key adv --keyserver keys.gnupg.net --recv-keys ABF5BD827BD9BF62'     - unless: 'apt-key list | grep -q 7BD9BF62'  nginx-repo:   pkgrepo.managed:     - humanname: nginx-repo     - name: deb http:\/\/nginx.org\/packages\/mainline\/debian\/ wheezy nginx     - require_in:       - pkg: nginx-pkg     - required:       - cmd: nginx-repo-key-install  nginx-pkg:   pkg.installed:     - name: nginx     - refresh: True     - require:       - pkgrepo: nginx-repo  nginx-service:   service.running:     - name: nginx     - full_restart: True     - require:       - pkg: nginx-pkg     - watch:       - file: nginx-config-vhost  nginx-config-vhost:   file.managed:     - name: \/etc\/nginx\/conf.d\/vhost.conf     - source: salt:\/\/__CONFIGS\/vhost.conf     - user: root     - group: root     - mode: 644 <\/code><\/pre>\n<p>  \u0422\u0443\u0442 \u0432\u0441\u0435, \u043a\u0430\u043a \u00ab\u043a\u043d\u0438\u0436\u043a\u0430 \u043f\u0438\u0448\u0435\u0442\u00bb, \u043d\u043e \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 (\u043e\u0447\u0435\u043d\u044c \u0432\u0430\u0436\u043d\u043e \u043a\u0430\u043a \u0431\u044d\u043a\u0433\u0440\u0430\u0443\u043d\u0434 \u0434\u043b\u044f \u043f\u043e\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445 \u0432\u044b\u043a\u043b\u0430\u0434\u043e\u043a):  <\/p>\n<ul>\n<li>nginx-repo-key-install: \u0438\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u0443\u0435\u043c \u0432 \u0441\u0438\u0441\u0442\u0435\u043c\u0443 \u043a\u043b\u044e\u0447 \u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u044f<\/li>\n<li>nginx-repo: \u0432\u043d\u043e\u0441\u0438\u043c \u0432 apt \u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0439 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439<\/li>\n<li>nginx-pkg: \u0441\u0442\u0430\u0432\u0438\u043c \u0441\u0432\u0435\u0436\u0435\u043d\u044c\u043a\u0438\u0439 \u043f\u0430\u043a\u0435\u0442<\/li>\n<li>nginx-service: \u0431\u0435\u0440\u0435\u043c \u043f\u043e\u0434 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u044c \u0441\u0435\u0440\u0432\u0438\u0441 \u0438 \u0437\u0430\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c \u0441\u043b\u0435\u0434\u0438\u0442\u044c \u0437\u0430 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f\u043c\u0438 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430<\/li>\n<li>nginx-config-vhost: \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u2014 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0439 \u0444\u0430\u0439\u043b \u0438 \u043c\u0435\u0441\u0442\u043e \u043e\u0442\u043a\u0443\u0434\u0430 \u0435\u0433\u043e \u0431\u0440\u0430\u0442\u044c<\/li>\n<\/ul>\n<p>  \u0414\u043b\u044f \u043f\u044b\u0442\u043b\u0438\u0432\u044b\u0445 \u0443\u043c\u043e\u0432, \u043d\u0435\u0432\u043e\u043e\u0440\u0443\u0436\u0435\u043d\u043d\u044b\u043c \u0432\u0437\u0433\u043b\u044f\u0434\u043e\u043c, \u0432\u0438\u0434\u043d\u044b \u0443\u043f\u0443\u0449\u0435\u043d\u0438\u044f (\u043a \u043f\u0440\u0438\u043c\u0435\u0440\u0443, \u2014 \u043d\u0435 \u043e\u043f\u0438\u0441\u0430\u043d \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u044c \u043d\u0430\u0434 nginx.conf) \u043d\u043e \u0432\u0441\u0435 \u043e\u043d\u0438 \u0441\u0434\u0435\u043b\u0430\u043d\u044b \u0434\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u0443\u043c\u0435\u043d\u044c\u0448\u0438\u0442\u044c \u043d\u0435 \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u0443\u044e \u0441 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u043d\u043e\u0439 \u043e\u0431\u043b\u0430\u0441\u0442\u044c\u044e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u043e\u043d\u043d\u0443\u044e \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0443.<\/p>\n<h4><b>SaltStack (second floor): \u041c\u043d\u043e\u0433\u043e \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0445 \u0444\u0430\u0439\u043b\u043e\u0432<\/b><\/h4>\n<p>  \u0412 \u043f\u0435\u0440\u0432\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0431\u044b\u043b \u043f\u043e\u043a\u0430\u0437\u0430\u043d \u0441\u0435\u0440\u0432\u0438\u0441 \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0435\u0441\u0442\u044c \u043e\u0434\u0438\u043d \u0444\u0430\u0439\u043b \u0433\u0434\u0435 \u043e\u043f\u0438\u0441\u0430\u043d \u043a\u0430\u043a\u043e\u0439-\u0442\u043e \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0439 \u0441\u0435\u0440\u0432\u0435\u0440 nginx. \u041f\u0440\u0438 \u0435\u0433\u043e \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0438 \u043d\u0430 Salt \u043c\u0430\u0441\u0442\u0435\u0440\u0435 (salt:\/\/__CONFIGS\/vhost.conf) \u0438 \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0443\u0441\u043a\u0435 \u0441\u0442\u0435\u0439\u0442\u0430, \u0444\u0430\u0439\u043b \u0431\u0443\u0434\u0435\u0442 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d \u043d\u0430 \u043c\u0430\u0448\u0438\u043d\u0435 \u0438 \u0441\u0435\u0440\u0432\u0438\u0441 nginx \u0431\u0443\u0434\u0435\u0442 \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0443\u0449\u0435\u043d (full_restart: True) \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438. <br \/>  \u0417\u0430\u0447\u0430\u0441\u0442\u0443\u044e \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0445 \u0445\u043e\u0441\u0442\u043e\u0432 \u043d\u0430 \u043c\u0430\u0448\u0438\u043d\u0435 \u0441 nginx \u0431\u0443\u0434\u0435\u0442 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e. \u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043a\u0430\u043a \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0438\u043c\u0438.<br \/>  \u0414\u043e\u043f\u0443\u0441\u0442\u0438\u043c, \u0447\u0442\u043e \u0435\u0441\u0442\u044c \u0444\u0430\u0439\u043b\u044b vhost{1,2,3,4,5}.conf. \u0412 \u0442\u0430\u043a\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043d\u0438\u0436\u043d\u044f\u044f \u0447\u0430\u0441\u0442\u044c \u0441\u0442\u0435\u0439\u0442\u0430 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0442\u0430\u043a:  <\/p>\n<pre><code class=\"python\">......  nginx-service:   service.running:     - name: nginx     - full_restart: True     - require:       - pkg: nginx-pkg     - watch:       {% for cnf in ['vhost1.conf', 'vhost2.conf', 'vhost3.conf', 'vhost4.conf', 'vhost5.conf'] %}       - file: nginx-config-{{ cnf }}       {% endfor %}  {% for cnf in ['vhost1.conf', 'vhost2.conf', 'vhost3.conf', 'vhost4.conf', 'vhost5.conf'] %} nginx-config-{{ cnf }}:   file.managed:     - name: \/etc\/nginx\/conf.d\/{{ cnf }}     - source: salt:\/\/__CONFIGS\/{{ cnf }}     - user: root     - group: root     - mode: 644 {% endfor %} <\/code><\/pre>\n<p>  \u0422\u0443\u0442 \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442\u0441\u044f \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043c\u0430\u0433\u0438\u0438 Salt, \u0430 \u0438\u043c\u0435\u043d\u043d\u043e: <a href=\"http:\/\/jinja.pocoo.org\/\">Jinja<\/a> \u2014 \u0448\u0430\u0431\u043b\u043e\u043d\u0438\u0437\u0430\u0442\u043e\u0440 \u0434\u043b\u044f Python (\u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0438 \u043d\u0430\u043f\u0438\u0441\u0430\u043d SaltStack). \u0412 \u0441\u0442\u0435\u0439\u0442\u0435 \u0432\u0441\u0435 \u043e\u0447\u0435\u0432\u0438\u0434\u043d\u043e, \u2014 \u0434\u0435\u043b\u0430\u0435\u043c \u043c\u043d\u043e\u0433\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 file \u0441 \u0440\u0430\u0437\u043d\u044b\u043c\u0438 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044f\u043c\u0438 \u0438 \u043f\u043e\u0434\u0432\u044f\u0437\u044b\u0432\u0430\u0435\u043c \u0432\u0441\u0435 \u0438\u0445 \u043a \u0441\u043b\u0443\u0436\u0431\u0435, \u0447\u0442\u043e\u0431\u044b \u043f\u0440\u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f\u0445 \u043f\u0440\u043e\u0432\u043e\u0434\u0438\u043b\u0441\u044f \u0435\u0451 \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0443\u0441\u043a. \u0414\u043b\u044f \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438 \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u0438\u0441\u0442\u0435\u043c\u0443 <a href=\"http:\/\/docs.saltstack.com\/en\/latest\/topics\/pillar\/index.html\">pillar-\u043e\u0432<\/a> \u0447\u0442\u043e\u0431\u044b \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0438\u043c\u0435\u043d\u0430 \u0444\u0430\u0439\u043b\u043e\u0432 \u0441 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044f\u043c\u0438. \u041d\u043e \u044d\u0442\u043e \u2014 \u0434\u043e\u043c\u0430\u0448\u043d\u0435\u0435 \u0437\u0430\u0434\u0430\u043d\u0438\u0435.<\/p>\n<h4><b>SaltStack (one floor upper): \u041c\u043d\u043e\u0433\u043e \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0445 \u0444\u0430\u0439\u043b\u043e\u0432 \u2014 \u043d\u043e \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0438 \u043a\u0430\u043a\u0438\u0445 \u2014 \u043d\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043d\u043e.<\/b><\/h4>\n<p>  \u0418\u0442\u0430\u043a \u0442\u043e, \u0437\u0430\u0447\u0435\u043c \u0438 \u0437\u0430\u0434\u0443\u043c\u044b\u0432\u0430\u043b\u0430\u0441\u044c \u044d\u0442\u0430 \u0441\u0442\u0430\u0442\u044c\u044f, \u2014 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044f \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043e\u0431\u044b\u0434\u0435\u043d\u043d\u0430\u044f \u0434\u043b\u044f \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u0430 \u0440\u0430\u0431\u043e\u0447\u0438\u0445 \u0441\u0438\u0441\u0442\u0435\u043c \u0441 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u043c \u0445\u043e\u0441\u0442\u0438\u043d\u0433\u043e\u043c: \u0431\u043e\u043b\u044c\u0448\u043e\u0435, \u0437\u0430\u0440\u0430\u043d\u0435\u0435 \u043d\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043d\u043e\u0435 \u0438 \u043f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u043e \u043c\u0435\u043d\u044f\u044e\u0449\u0435\u0435\u0441\u044f \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0445 \u0444\u0430\u0439\u043b\u043e\u0432. \u041a\u0430\u043a \u0436\u0435 \u0432 \u0442\u0430\u043a\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043f\u043e\u0441\u0442\u0443\u043f\u0438\u0442\u044c \u0441 \u0440\u0430\u0437\u0432\u043e\u0440\u0430\u0447\u0438\u0432\u0430\u043d\u0438\u0435\u043c \u0438\u043d\u0444\u0440\u0430\u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u0447\u0435\u0440\u0435\u0437 Salt? \u0420\u0435\u0448\u0435\u043d\u0438\u0435 \u0435\u0441\u0442\u044c! \u041a \u0441\u043e\u0436\u0430\u043b\u0435\u043d\u0438\u044e \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043e\u0447\u0435\u0432\u0438\u0434\u043d\u043e\u0435 (\u043f\u0440\u0438\u0448\u043b\u043e\u0441\u044c \u0434\u0430\u0436\u0435 \u043a \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430\u043c \u0437\u0430 \u0440\u0430\u0437\u044a\u044f\u0441\u043d\u0435\u043d\u0438\u044f\u043c\u0438 \u043e\u0431\u0440\u0430\u0449\u0430\u0442\u044c\u0441\u044f), \u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0449\u0435\u0435. <br \/>  \u0418\u0442\u0430\u043a:  <\/p>\n<pre><code class=\"python\">......  nginx-service:   service.running:     - name: nginx     - full_restart: True     - require:       - pkg: nginx-pkg     - watch:       {% for cnf in salt['cp.list_master'](prefix='__CONFIGS\/') %}       - file: nginx-config-{{ cnf }}       {% endfor %}  {% for cnf in salt['cp.list_master'](prefix='__CONFIGS\/') %} {% set items = cnf.split('\/') %} nginx-config-{{ cnf }}:   file.managed:     - name: \/etc\/nginx\/conf.d\/{{ items|last }}     - source: salt:\/\/{{ cnf }}     - user: root     - group: root     - mode: 644 {% endfor %} <\/code><\/pre>\n<p>  \u0421\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0442\u0435\u043f\u0435\u0440\u044c \u043e \u0441\u0430\u043c\u044b\u0445 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u0445 \u043c\u0435\u0441\u0442\u0430\u0445:  <\/p>\n<pre><code class=\"python\">{% for cnf in salt['cp.list_master'](prefix='__CONFIGS\/') %} <\/code><\/pre>\n<p>  \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u043c \u0444-\u0446\u0438\u044e list_master \u0438\u0437 \u043c\u043e\u0434\u0443\u043b\u044f <a href=\"http:\/\/docs.saltstack.com\/en\/latest\/ref\/modules\/all\/salt.modules.cp.html?highlight=cp.list_master#salt.modules.cp.list_master\">cp<\/a> \u0441 \u043f\u0440\u0435\u0444\u0438\u043a\u0441\u043e\u043c &#8216;__CONFIGS\/&#8217; (\u0438\u043c\u044f \u043f\u0430\u043f\u043a\u0438 \u043d\u0430 Salt \u043c\u0430\u0441\u0442\u0435\u0440\u0435 \u0433\u0434\u0435 \u043b\u0435\u0436\u0430\u0442 \u0432\u0441\u0435 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0435 \u0444\u0430\u0439\u043b\u044b \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0441\u0435\u0440\u0432\u0438\u0441\u0430) \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0441 \u0432\u044b\u0434\u0430\u0435\u0442 \u0441\u043f\u0438\u0441\u043e\u043a \u0444\u0430\u0439\u043b\u043e\u0432 \u0432 \u044d\u0442\u043e\u043c \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0435 \u0438 \u0438\u0442\u0435\u0440\u0438\u0440\u0443\u0435\u043c \u043f\u043e \u0441\u043f\u0438\u0441\u043a\u0443 \u0446\u0438\u043a\u043b\u043e\u043c for.  <\/p>\n<pre><code class=\"python\">{% set items = cnf.split('\/') %} <\/code><\/pre>\n<p>  \u041f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 cp.list_master \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u043e\u043d\u0430 \u0432\u044b\u0434\u0430\u0435\u0442 \u043f\u043e\u043b\u043d\u044b\u0439 \u043f\u0443\u0442\u044c \u043a \u0444\u0430\u0439\u043b\u0443 (\u0432\u043c\u0435\u0441\u0442\u0435 \u0441 \u043f\u0440\u0435\u0444\u0438\u043a\u0441\u043e\u043c), \u0430 \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u043b\u0438\u0448\u044c \u0438\u043c\u044f \u0444\u0430\u0439\u043b\u0430 \u0434\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u0435\u0433\u043e \u0432 \u0434\u0438\u0440\u0435\u043a\u0442\u0438\u0432\u0435 &quot;- name:&quot;. \u0412 \u0441\u0432\u044f\u0437\u0438 \u0441 \u044d\u0442\u0438\u043c \u043c\u044b \u0441\u043f\u043b\u0438\u0442\u0442\u0438\u043c \u043f\u043e\u043b\u043d\u044b\u0439 \u043f\u0443\u0442\u044c \u043f\u043e \u0441\u043b\u0435\u0448\u0430\u043c \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u0441\u043f\u0438\u0441\u043a\u0430 \u2014 \u0442.\u0435. \u0438\u043c\u044f \u0444\u0430\u0439\u043b\u0430:  <\/p>\n<pre><code class=\"python\">- name: \/etc\/nginx\/conf.d\/{{ items|last }} <\/code><\/pre>\n<p>  \u0412 \u0438\u0442\u043e\u0433\u0435 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043f\u0435\u0440\u0435\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u043d\u044b\u0439 \u043a\u0430\u0442\u0430\u043b\u043e\u0433, \u0432\u043a\u043b\u044e\u0447\u0435\u043d\u043d\u044b\u0435 \u0432 \u043e\u0431\u043e\u0440\u043e\u0442 \u0444\u0430\u0439\u043b\u044b \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0439 \u0438\u043c\u0435\u044e\u0449\u0438\u0435\u0441\u044f \u0432 \u044d\u0442\u043e\u043c \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0435 \u0438 \u0441\u0440\u0430\u0437\u0443 \u0436\u0435 \u043f\u043e\u0434\u0432\u044f\u0437\u044b\u0432\u0430\u0435\u043c \u043a \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u043c\u0443 \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0443\u0441\u043a\u0443 \u0441\u0435\u0440\u0432\u0438\u0441\u0430 \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u043f\u0440\u0430\u0432\u043e\u043a \u0432 \u0444\u0430\u0439\u043b\u0430\u0445.<\/p>\n<h4>\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h4>\n<p>  \u041e\u0447\u0435\u043d\u044c \u043a\u0440\u0430\u0442\u0435\u043d\u044c\u043a\u043e, \u043d\u043e \u043d\u0430\u0434\u0435\u044e\u0441\u044c \u043f\u043e\u043c\u043e\u0436\u0435\u0442 \u0442\u0435\u043c \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u044f\u043c \u0425\u0430\u0431\u0440\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0430\u0447\u0438\u043d\u0430\u044e\u0442 \u0432\u043d\u0435\u0434\u0440\u044f\u0442\u044c SaltStack \u0438 \u0445\u043e\u0442\u044f\u0442 \u043f\u043e\u0439\u0442\u0438 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0434\u0430\u043b\u044c\u0448\u0435 \u0447\u0435\u043c \u043a\u043d\u0438\u0436\u043d\u044b\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u044b \u0441 \u043f\u0440\u043e\u0441\u0442\u044b\u043c \u043c\u0435\u043d\u0435\u0434\u0436\u043c\u0435\u043d\u0442\u043e\u043c \u043f\u0430\u043a\u0435\u0442\u043e\u0432. \u0423\u0441\u043f\u0435\u0445\u043e\u0432! \t\t\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\/218231\/\"> http:\/\/habrahabr.ru\/post\/218231\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"content html_format\">\n<h4><b>\u0427\u0442\u043e \u0437\u0434\u0435\u0441\u044c \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e\u0433\u043e?<\/b><\/h4>\n<p>  \u0421\u0442\u0430\u0442\u044c\u044f \u043f\u043e\u043c\u043e\u0436\u0435\u0442 \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c\u0441\u044f \u0441 \u0442\u0435\u043c, \u043a\u0430\u043a \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u043b\u044c\u043d\u044b\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e\u043c \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0445 \u0444\u0430\u0439\u043b\u043e\u0432 \u043d\u0435\u043a\u043e\u0435\u0433\u043e \u0441\u0435\u0440\u0432\u0438\u0441\u0430 \u0432 SaltStack. <\/p>\n<h4><b>SaltStack (underfloor): \u0447\u0442\u043e \u044d\u0442\u043e \u0438 \u043a\u0430\u043a \u0441 \u043d\u0438\u043c \u0431\u044b\u0442\u044c?<\/b><\/h4>\n<p>  \u041c\u043d\u043e\u0433\u0438\u0435 \u0443\u0436\u0435 \u0438\u043c\u0435\u043b\u0438 \u043e\u043f\u044b\u0442 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0441\u0438\u0441SaltStack (u\u0442\u0435\u043c\u0430\u043c\u0438 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0433\u043e \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044f\u043c\u0438, \u043a \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0441\u044f Salt, \u0438 \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e \u043e \u0442\u043e\u043c \u043a\u0430\u043a \u0435\u0433\u043e \u0433\u043e\u0442\u043e\u0432\u0438\u0442\u044c \u0438 \u0447\u0442\u043e \u043e\u043d \u043c\u043e\u0436\u0435\u0442 \u044f \u043d\u0435 \u0441\u0442\u0430\u043d\u0443, <a href=\"http:\/\/www.saltstack.com\/integrations\/\">\u0442\u0443\u0442<\/a> \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0447\u0435\u0441\u0442\u044c \u0447\u0442\u043e \u044d\u0442\u043e, \u0430 <a href=\"http:\/\/docs.saltstack.com\/en\/latest\/topics\/tutorials\/walkthrough.html\">\u0442\u0443\u0442<\/a> \u043f\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u043a\u0430\u043a \u0435\u0433\u043e \u0431\u044b\u0441\u0442\u0440\u043e \u0438 \u043b\u0435\u0433\u043a\u043e \u043f\u0440\u0438\u0433\u043e\u0442\u043e\u0432\u0438\u0442\u044c.<\/p>\n<h4><b>SaltStack (lobby): \u0442\u0438\u043f\u0438\u0447\u043d\u043e\u0435 \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u043d\u0430 \u043f\u0440\u043e\u0441\u0442\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435<\/b><\/h4>\n<p>  \u0418\u0442\u0430\u043a, \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0438\u043c, \u0443 \u0412\u0430\u0441 \u0435\u0441\u0442\u044c \u0437\u0430\u0434\u0430\u0447\u0430 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0443, \u0432\u043d\u0435\u0434\u0440\u0435\u043d\u0438\u0435 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0445 \u0444\u0430\u0439\u043b\u043e\u0432 \u0438 \u043c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u043d\u0433 \u0438\u0445 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439, \u043f\u0435\u0440\u0435\u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0443 \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u0442\u0430\u043a\u043e\u0433\u043e \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u043e\u0433\u043e \u0441\u0435\u0440\u0432\u0438\u0441\u0430 \u043a\u0430\u043a nginx. \u0414\u043b\u044f \u0443\u043f\u0440\u043e\u0449\u0435\u043d\u0438\u044f \u0441\u0438\u0441\u0442\u0435\u043c\u044b, \u0441\u0434\u0435\u043b\u0430\u0435\u043c \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0447\u0442\u043e \u043e\u0431\u0441\u043b\u0443\u0436\u0438\u0432\u0430\u0435\u043c\u044b\u0435 \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u044b \u043d\u0430 \u0431\u0430\u0437\u0435 Debian Wheezy. (\u0414\u043b\u044f \u0432\u0441\u0435\u0445 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0445, \u2014 \u0447\u0438\u0442\u0430\u0435\u043c \u043f\u0440\u043e <a href=\"http:\/\/docs.saltstack.com\/en\/latest\/topics\/targeting\/grains.html\">grains<\/a> \u0441\u0438\u0441\u0442\u0435\u043c\u0443, \u2014 \u043e\u043d\u0430 \u043f\u043e\u043c\u043e\u0436\u0435\u0442 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u043d\u0430 \u043a\u0430\u043a\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u0435 \u043c\u044b \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u043c \u0441\u0442\u0435\u0439\u0442 \u0438 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u043f\u043e\u043c\u0435\u043d\u044f\u0442\u044c \u0435\u0433\u043e \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435). <br \/>  \u0418\u0442\u0430\u043a:  <\/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-218231","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/218231","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=218231"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/218231\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=218231"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=218231"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=218231"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}