{"id":323248,"date":"2021-05-17T15:00:31","date_gmt":"2021-05-17T15:00:31","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=323248"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=323248","title":{"rendered":"\u0421\u043e\u0437\u0434\u0430\u0435\u043c \u0431\u0430\u0437\u0443 \u0434\u0430\u043d\u043d\u044b\u0445 MySQL \u0441 Ansible"},"content":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\">\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/vs\/nx\/gv\/vsnxgvus0eo5nt97xm64vx61e-0.jpeg\" alt=\"image\"><br \/>  <em>\u0424\u043e\u0442\u043e Courtesy Of Pexels.com<\/em><\/p>\n<p>  <\/p>\n<p>Ansible \u0438\u0434\u0435\u0430\u043b\u044c\u043d\u043e \u043f\u043e\u0434\u0445\u043e\u0434\u0438\u0442 \u0434\u043b\u044f \u0434\u0435\u043f\u043b\u043e\u0439\u043c\u0435\u043d\u0442\u0430 MySQL \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0435 \u0431\u0435\u0437 \u043b\u0438\u0448\u043d\u0438\u0445 \u0443\u0441\u0438\u043b\u0438\u0439 \u0441 \u043d\u0430\u0448\u0435\u0439 \u0441\u0442\u043e\u0440\u043e\u043d\u044b. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0432\u043c\u0435\u0441\u0442\u0435 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c, \u043a\u0430\u043a \u044d\u0442\u043e \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442. \u0414\u0430\u0436\u0435 \u0435\u0441\u043b\u0438 \u0443 \u0432\u0430\u0441 \u043f\u043e\u043a\u0430 \u043d\u0435\u0442 \u043e\u043f\u044b\u0442\u0430 \u0441 Ansible, \u0432\u044b \u043b\u0435\u0433\u043a\u043e \u0432\u043e \u0432\u0441\u0435\u043c \u0440\u0430\u0437\u0431\u0435\u0440\u0435\u0442\u0435\u0441\u044c. <a name=\"habracut\"><\/a>\u041c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u043e\u0431\u0440\u0430\u0437 Docker \u0441 Ansible, \u043a\u0430\u043a \u043e\u043f\u0438\u0441\u0430\u043d\u043e \u0432 <a href=\"https:\/\/medium.com\/splunkuserdeveloperadministrator\/create-your-own-docker-image-running-ansible-731b1e6e9e7c\">\u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435<\/a>.<\/p>\n<p>  <\/p>\n<p>\u0427\u0442\u043e\u0431\u044b \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0431\u0430\u0437\u0443 \u0434\u0430\u043d\u043d\u044b\u0445 MySQL, \u043c\u044b \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u043c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0439:<\/p>\n<p>  <\/p>\n<ol>\n<li>\u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0444\u0430\u0439\u043b hosts (\u043d\u0435 \u0442\u0430\u043a \u0443\u0436 \u0438 \u043d\u0443\u0436\u0435\u043d \u0432 \u0442\u0430\u043a\u043e\u043c \u043f\u0440\u043e\u0441\u0442\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435, \u043d\u043e \u0432\u0441\u0435\u0433\u0434\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0432 \u0440\u0435\u0430\u043b\u044c\u043d\u044b\u0445 \u043f\u0440\u043e\u0435\u043a\u0442\u0430\u0445).<\/li>\n<li>\u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043f\u043b\u0435\u0439\u0431\u0443\u043a. \u041e\u0431\u044b\u0447\u043d\u043e \u044d\u0442\u043e \u0441\u0430\u043c\u0430\u044f \u0433\u043b\u0430\u0432\u043d\u0430\u044f \u0447\u0430\u0441\u0442\u044c, \u0442\u0430\u043a \u0447\u0442\u043e \u043c\u044b \u0438\u0437\u0443\u0447\u0438\u043c \u0435\u0433\u043e \u043f\u043e\u0441\u0442\u0440\u043e\u0447\u043d\u043e.<\/li>\n<li>\u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0444\u0430\u0439\u043b SQL. \u042d\u0442\u043e \u043d\u0435\u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e, \u043d\u043e \u0441 \u0435\u0433\u043e \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043c\u043e\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0434\u043b\u044f \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u0442\u043e\u043c \u043f\u0440\u043e\u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0435\u0435.<\/li>\n<li>\u041f\u0440\u043e\u0442\u0435\u0441\u0442\u0438\u0440\u0443\u0435\u043c \u0432\u043d\u0435\u0441\u0435\u043d\u043d\u044b\u0435 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f.<\/li>\n<\/ol>\n<p>  <\/p>\n<p>\u041f\u0435\u0440\u0435\u0439\u0434\u0435\u043c \u043a \u0434\u0435\u043b\u0443.<\/p>\n<p>  <\/p>\n<h4 id=\"1-sozdaem-fayl-hosts\">1. \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u0444\u0430\u0439\u043b hosts<\/h4>\n<p>  <\/p>\n<p>\u042d\u0442\u043e \u043d\u0435 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u0444\u0430\u0439\u043b, \u043d\u043e \u043c\u044b \u043f\u0440\u0435\u0434\u043f\u043e\u0447\u0438\u0442\u0430\u0435\u043c \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c \u043f\u043b\u0435\u0439\u0431\u0443\u043a \u0441 \u0435\u0433\u043e \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0434\u043b\u044f \u0442\u0435\u0441\u0442\u043e\u0432 \u043d\u0430 localhost. \u041f\u043e\u0442\u043e\u043c \u043c\u043e\u0436\u043d\u043e \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c IP-\u0430\u0434\u0440\u0435\u0441, \u0447\u0442\u043e\u0431\u044b \u043f\u0435\u0440\u0435\u043d\u0435\u0441\u0442\u0438\u0441\u044c \u0432 \u0434\u0440\u0443\u0433\u0443\u044e \u0441\u0440\u0435\u0434\u0443. \u0417\u0434\u0435\u0441\u044c \u0432 \u0444\u0430\u0439\u043b\u0435 hosts \u0432\u0441\u0435\u0433\u043e \u043e\u0434\u043d\u0430 \u0437\u0430\u043f\u0438\u0441\u044c (\u043c\u043e\u0436\u0435\u0442\u0435 \u0441\u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0435\u0435): <strong>touch hosts<\/strong><\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">[mysql] 127.0.0.1<\/code><\/pre>\n<p>  <\/p>\n<h4 id=\"2-sozdaem-pleybuk-mysql\">2. \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u043f\u043b\u0435\u0439\u0431\u0443\u043a MySQL<\/h4>\n<p>  <\/p>\n<p>\u0417\u0434\u0435\u0441\u044c \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0441\u0430\u043c\u043e\u0435 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e\u0435: \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u044e\u0442\u0441\u044f \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f, \u043d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u044e\u0442\u0441\u044f \u0442\u0430\u043a, \u043a\u0430\u043a \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e, \u0441\u043e\u0437\u0434\u0430\u0435\u0442\u0441\u044f \u0442\u0435\u0441\u0442\u043e\u0432\u0430\u044f \u0431\u0430\u0437\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 \u0432 \u043d\u0435\u0435 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0434\u0430\u043d\u043d\u044b\u0435. \u0412\u0441\u0435 \u044d\u0442\u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u043d\u0443\u0436\u043d\u043e \u0433\u0434\u0435-\u0442\u043e \u0445\u0440\u0430\u043d\u0438\u0442\u044c, \u0442\u0430\u043a \u0447\u0442\u043e \u043d\u0430\u0447\u043d\u0435\u043c \u0441 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0444\u0430\u0439\u043b\u0430 <strong>db-server-playbook.yml<\/strong>:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">touch db-server-playbook.yml<\/code><\/pre>\n<p>  <\/p>\n<p>\u041e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u043c \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u0439 \u0444\u0430\u0439\u043b \u0432 \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u043e\u043c \u0440\u0435\u0434\u0430\u043a\u0442\u043e\u0440\u0435 \u0438 \u0434\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c \u0445\u043e\u0441\u0442\u044b, \u043a\u0443\u0434\u0430 \u0431\u0443\u0434\u0435\u043c \u0434\u0435\u043f\u043b\u043e\u0438\u0442\u044c \u0440\u0435\u0441\u0443\u0440\u0441\u044b (\u0432 \u0441\u0442\u0440\u043e\u043a\u0435 2 \u043d\u0430\u043c \u043a\u0430\u043a \u0440\u0430\u0437 \u043f\u0440\u0438\u0433\u043e\u0434\u0438\u0442\u0441\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u0439 \u0444\u0430\u0439\u043b hosts). \u0417\u0430\u0442\u0435\u043c \u0437\u0430\u0434\u0430\u0435\u043c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e \u0434\u043b\u044f <strong>mysql_root_password<\/strong> \u0432 \u0441\u0442\u0440\u043e\u043a\u0430\u0445 4 \u0438 5. \u0417\u0434\u0435\u0441\u044c \u043c\u044b \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c \u043f\u0430\u0440\u043e\u043b\u044c \u043e\u0442\u043a\u0440\u044b\u0442\u044b\u043c \u0442\u0435\u043a\u0441\u0442\u043e\u043c \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f \u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0430\u0446\u0438\u0438. \u0412 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u043c \u043c\u0438\u0440\u0435 \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0438 \u0431\u044b, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, <strong>ansible-vault<\/strong> \u0438\u043b\u0438 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e \u043a\u043e\u043c\u0430\u043d\u0434\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0438:<\/p>\n<p>  <\/p>\n<p><strong>\u041f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u0435:<\/strong> <em>\u041d\u0435 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0439\u0442\u0435 \u043d\u043e\u043c\u0435\u0440\u0430 \u0432 \u043d\u0430\u0447\u0430\u043b\u0435 \u043a\u0430\u0436\u0434\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0438 \u2014 \u043c\u044b \u043f\u0440\u043e\u043d\u0443\u043c\u0435\u0440\u043e\u0432\u0430\u043b\u0438 \u0438\u0445 \u043f\u0440\u043e\u0441\u0442\u043e \u0434\u043b\u044f \u044f\u0441\u043d\u043e\u0441\u0442\u0438.<\/em><\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">1 ---    2 - hosts: mysql    3    4   vars:    5     mysql_root_password: password    6<\/code><\/pre>\n<p>  <\/p>\n<p>\u041d\u0430\u0441\u0442\u0440\u043e\u0438\u0432 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435, \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u043c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0442\u044c \u0437\u0430\u0434\u0430\u0447\u0438. \u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u043c\u044b \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c mysql \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <strong>apt<\/strong> \u0434\u043b\u044f \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u0432 \u043e\u0431\u0440\u0430\u0437\u0435 Ubuntu Docker. \u0415\u0449\u0435 \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0431\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043c\u043e\u0434\u0443\u043b\u044c <strong>package<\/strong> \u0438\u043b\u0438 <strong>yum<\/strong>, \u0435\u0441\u043b\u0438 \u0431\u044b \u0443 \u043d\u0430\u0441 \u0431\u044b\u043b \u043e\u0431\u0440\u0430\u0437 Centos:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">7   tasks:   8    - name: install mysql     9      apt:  10    name: mysql  11    update_cache: yes  12      cache_valid_time: 3600 13      state: present<\/code><\/pre>\n<p>  <\/p>\n<p>\u041d\u0430\u0441\u0442\u0440\u043e\u0438\u043c \u0437\u0430\u0434\u0430\u0447\u0438, \u0447\u0442\u043e\u0431\u044b \u0443\u0431\u0435\u0434\u0438\u0442\u044c\u0441\u044f, \u0447\u0442\u043e \u0441\u0435\u0440\u0432\u0438\u0441 mysql \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0438 \u0431\u0443\u0434\u0435\u0442 \u0437\u0430\u043f\u0443\u0449\u0435\u043d \u043f\u0440\u0438 \u0441\u0442\u0430\u0440\u0442\u0435:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">14     - name: start up the mysql service   15       shell: &quot;service mysql start&quot;   16     - name: ensure mysql is enabled to run on startup   17       service:  18         name:mysql  19         state:started  20         enabled:true<\/code><\/pre>\n<p>  <\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u043f\u0430\u0440\u043e\u043b\u044c \u0434\u043b\u044f \u0432\u0441\u0435\u0445 \u043a\u043e\u0440\u043d\u0435\u0432\u044b\u0445 \u0430\u043a\u043a\u0430\u0443\u043d\u0442\u043e\u0432 \u0432 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0435 mysql. \u0425\u043e\u0442\u044f mysql \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0430 \u043e\u0434\u043d\u043e\u043c \u0445\u043e\u0441\u0442\u0435 (\u043e\u0431\u0440\u0430\u0437 Docker), \u043d\u0430 \u043d\u0435\u0433\u043e \u0441\u0441\u044b\u043b\u0430\u044e\u0442\u0441\u044f \u0434\u0440\u0443\u0433\u0438\u0435 \u0438\u043c\u0435\u043d\u0430, \u0432\u043a\u043b\u044e\u0447\u0430\u044f localhost \u0438 127.0.0.1. \u0414\u043b\u044f \u0432\u0441\u0435\u0445 \u043d\u0443\u0436\u043d\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u043c\u043e\u0434\u0443\u043b\u044c <strong>mysql_user<\/strong> \u0438 \u043d\u0430\u0431\u043e\u0440 \u043f\u0440\u0438\u0432\u0438\u043b\u0435\u0433\u0438\u0439, \u043a\u0430\u043a \u0432 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u043d\u0438\u0436\u0435, \u0433\u0434\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u0438\u0440\u0435\u043a\u0442\u0438\u0432\u0430 <strong>with_item<\/strong>:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">21     - name: update mysql root password for all root accounts   22       mysql_user:   23         name: root   24         host: &quot;{{ item }}&quot;   25         password: &quot;{{ mysql_root_password }}&quot;   26         login_user: root   27         login_password: &quot;{{ mysql_root_password }}&quot;   28         check_implicit_admin: yes   29         priv: &quot;*.*:ALL,GRANT&quot;   30       with_items:   31       - &quot;{{ ansible_hostname }}&quot;   32       - 127.0.0.1   33       - ::1   34       - localhost<\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u043e\u0441\u043b\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 MySQL \u043c\u043e\u0436\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043c\u043e\u0434\u0443\u043b\u044c <strong>mysql_db<\/strong>, \u0447\u0442\u043e\u0431\u044b \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0442\u0435\u0441\u0442\u043e\u0432\u0443\u044e \u0431\u0430\u0437\u0443 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u0441\u0442\u0440\u043e\u043a\u0430\u0445 37-40, \u0430 \u0437\u0430\u0442\u0435\u043c \u0432 \u0441\u0442\u0440\u043e\u043a\u0430\u0445 46-51 \u0438\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u0443\u0435\u043c \u0432 \u043d\u0435\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u0437 \u0444\u0430\u0439\u043b\u0430 SQL, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u044b \u0441\u043a\u043e\u0440\u043e \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">35     - name: create a new database   36      mysql_db:  37     name: testdb  38     state: present  39     login_user: root  40     login_password: &quot;{{ mysql_root_password }}&quot;   41     - name: add sample data to database   42       copy:  43         src:dump.sql  44         dest:\/tmp\/dump.sql   45     - name: insert sample data into database   46       mysql_db:  47         name: testdb  48         state: import  49         target: \/tmp\/dump.sql  50         login_user: root  51         login_password: &quot;{{ mysql_root_password }}&quot;<\/code><\/pre>\n<p>  <\/p>\n<p>\u0421\u043e\u0445\u0440\u0430\u043d\u0438\u043c \u043f\u043b\u0435\u0439\u0431\u0443\u043a \u0438 \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0444\u0430\u0439\u043b SQL \u0441 \u0442\u0435\u0441\u0442\u043e\u0432\u044b\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u043c\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0436\u043d\u043e \u0438\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432 \u0411\u0414.<\/p>\n<p>  <\/p>\n<h4 id=\"3-sozdaem-fayl-sql\">3. \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u0444\u0430\u0439\u043b SQL<\/h4>\n<p>  <\/p>\n<p>\u0412 \u043d\u0435\u043c \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u0441\u044f \u0434\u0430\u043d\u043d\u044b\u0435 \u0434\u043b\u044f \u0411\u0414. \u0422\u0430\u0431\u043b\u0438\u0446\u0430 \u043e\u0447\u0435\u043d\u044c \u043f\u0440\u043e\u0441\u0442\u0430\u044f, \u043d\u043e \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043e \u0442\u043e\u043c, \u043a\u0430\u043a \u044d\u0442\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442. \u0422\u0435 \u0436\u0435 \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u044b \u0432\u044b \u0441\u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0442\u044c, \u0447\u0442\u043e\u0431\u044b \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u0442\u0430\u0431\u043b\u0438\u0446\u044b, \u0441\u0445\u0435\u043c\u044b \u0438 \u0434\u0430\u043d\u043d\u044b\u0435.<\/p>\n<p>  <\/p>\n<p>\u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0444\u0430\u0439\u043b <strong>dump.sql<\/strong>:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">touch dump.sql<\/code><\/pre>\n<p>  <\/p>\n<p>\u041e\u0442\u043a\u0440\u043e\u0435\u043c \u0444\u0430\u0439\u043b \u0432 \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u043e\u043c \u0440\u0435\u0434\u0430\u043a\u0442\u043e\u0440\u0435 \u0438 \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u043a\u043e\u0434, \u043a\u0430\u043a \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u043e \u043d\u0438\u0436\u0435, \u0447\u0442\u043e\u0431\u044b \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043d\u043e\u0432\u0443\u044e \u0442\u0430\u0431\u043b\u0438\u0446\u0443 <strong>test<\/strong> \u0438 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0442\u0440\u0438 \u0441\u0442\u0440\u043e\u043a\u0438 INSERT:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">CREATE TABLE IF NOT EXISTS test (              message varchar(255) NOT NULL            ) ENGINE=MyISAM DEFAULT CHARSET=utf8;            INSERT INTO test(message) VALUES('Ansible To Do List');   INSERT INTO test(message) VALUES('Get ready');            INSERT INTO test(message) VALUES('Ansible is fun')<\/code><\/pre>\n<p>  <\/p>\n<h4 id=\"4-zapusk-pleybuka-ansible\">4. \u0417\u0430\u043f\u0443\u0441\u043a \u043f\u043b\u0435\u0439\u0431\u0443\u043a\u0430 Ansible<\/h4>\n<p>  <\/p>\n<p>\u0415\u0441\u043b\u0438 \u043c\u044b \u0432\u0441\u0435 \u0441\u0434\u0435\u043b\u0430\u043b\u0438 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e, \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u043f\u043b\u0435\u0439\u0431\u0443\u043a \u0438\u0437 \u043a\u043e\u043c\u0430\u043d\u0434\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0438 \u043a\u043e\u043c\u0430\u043d\u0434\u043e\u0439 ansible-playbook. \u0412\u044b\u043f\u043e\u043b\u043d\u0438\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0443\u044e \u043a\u043e\u043c\u0430\u043d\u0434\u0443, \u0447\u0442\u043e\u0431\u044b \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u043f\u043b\u0435\u0439\u0431\u0443\u043a \u0438\u0437 \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0430, \u0433\u0434\u0435 \u043c\u044b \u0435\u0433\u043e \u0441\u043e\u0437\u0434\u0430\u043b\u0438:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">ansible-playbook -i hosts db-server-playbook.yml<\/code><\/pre>\n<p>  <\/p>\n<p>\u042d\u0442\u043e \u043c\u0430\u043b\u0435\u043d\u044c\u043a\u0438\u0439 \u043f\u043b\u0435\u0439\u0431\u0443\u043a \u0432\u0441\u0435\u0433\u043e \u0441 \u043e\u0434\u043d\u0438\u043c \u043f\u0430\u043a\u0435\u0442\u043e\u043c, \u0430 \u0432 \u0431\u0430\u0437\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u043c\u0430\u043b\u043e \u0434\u0430\u043d\u043d\u044b\u0445, \u0442\u0430\u043a \u0447\u0442\u043e \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u0440\u0430\u0431\u043e\u0442\u044b \u043f\u043b\u0435\u0439\u0431\u0443\u043a\u0430 \u043e\u0447\u0435\u043d\u044c \u0441\u043a\u043e\u0440\u043e \u0431\u0443\u0434\u0443\u0442 \u0433\u043e\u0442\u043e\u0432\u044b \u0434\u043b\u044f \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f.<\/p>\n<p>  <\/p>\n<h4 id=\"5-testiruem-vnesennye-izmeneniya\">5. \u0422\u0435\u0441\u0442\u0438\u0440\u0443\u0435\u043c \u0432\u043d\u0435\u0441\u0435\u043d\u043d\u044b\u0435 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f<\/h4>\n<p>  <\/p>\n<p>\u0415\u0441\u043b\u0438 \u0432\u0441\u0435 \u0432 \u043f\u043e\u0440\u044f\u0434\u043a\u0435, \u0442\u0435\u0441\u0442 \u0441 \u0445\u043e\u0441\u0442\u0430 \u043f\u0440\u043e\u0439\u0434\u0435\u0442 \u0443\u0441\u043f\u0435\u0448\u043d\u043e. \u041c\u044b \u0432\u043e\u0439\u0434\u0435\u043c \u0432 MySQL, \u043f\u0435\u0440\u0435\u0439\u0434\u0435\u043c \u0432 \u0431\u0430\u0437\u0443 \u0434\u0430\u043d\u043d\u044b\u0445 <strong>testdb<\/strong>, \u043e\u0442\u043e\u0431\u0440\u0430\u0437\u0438\u043c \u0432\u0441\u0435 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0432 \u0431\u0430\u0437\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438, \u043d\u0430\u043a\u043e\u043d\u0435\u0446, \u0432\u044b\u0432\u0435\u0434\u0435\u043c \u0432\u0441\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0435 <strong>test<\/strong>, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043c\u044b \u0441\u043e\u0437\u0434\u0430\u043b\u0438 \u0441 Ansible:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">mysql -u root -h localhost -p Enter password:  Welcome to the MySQL monitor.  Commands end with ; or \\g.  Your MySQL connection id is 17  Server version: 8.0.22-0ubuntu0.20.04.3 (Ubuntu)  mysql&gt; use testdb;  Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -A  Database changed  mysql&gt; show tables;  +------------------+  | Tables_in_testdb |  +------------------+  | test             |  +------------------+  1 row in set (0.00 sec)  mysql&gt; select * from test;  +--------------------+  | message            |  +--------------------+  | Ansible To Do List |  | Get ready          |  | Ansible is fun     |  +--------------------+  3 rows in set (0.00 sec)<\/code><\/pre>\n<p>  <\/p>\n<p>\u0412\u043e\u0442 \u0438 \u0432\u0441\u0435. \u041d\u0438\u0447\u0435\u0433\u043e \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0433\u043e, \u043f\u0440\u0430\u0432\u0434\u0430? \u0412\u0441\u0435\u0433\u043e \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043c\u0438\u043d\u0443\u0442 \u0438 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u0442\u0440\u043e\u043a \u0432 Ansible \u2014 \u0438 \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u0440\u0430\u0431\u043e\u0447\u0430\u044f \u0431\u0430\u0437\u0430 \u0434\u0430\u043d\u043d\u044b\u0445.<\/p>\n<p>  <\/p>\n<p><em>\u0412 \u043a\u043d\u0438\u0433\u0435 <a href=\"https:\/\/www.amazon.com\/Practical-Ansible-Configuration-Management-Finish-dp-1484264843\/dp\/1484264843\">Practical Ansible: Configuration Management from Start to Finish<\/a> \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442\u0441\u044f, \u043a\u0430\u043a \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0435\u0439 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e Ansible.<br \/>  <\/em><\/p>\n<\/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=\"https:\/\/habr.com\/ru\/company\/southbridge\/blog\/557838\/\"> https:\/\/habr.com\/ru\/company\/southbridge\/blog\/557838\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\">\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/vs\/nx\/gv\/vsnxgvus0eo5nt97xm64vx61e-0.jpeg\" alt=\"image\"><br \/>  <em>\u0424\u043e\u0442\u043e Courtesy Of Pexels.com<\/em><\/p>\n<p>  <\/p>\n<p>Ansible \u0438\u0434\u0435\u0430\u043b\u044c\u043d\u043e \u043f\u043e\u0434\u0445\u043e\u0434\u0438\u0442 \u0434\u043b\u044f \u0434\u0435\u043f\u043b\u043e\u0439\u043c\u0435\u043d\u0442\u0430 MySQL \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0435 \u0431\u0435\u0437 \u043b\u0438\u0448\u043d\u0438\u0445 \u0443\u0441\u0438\u043b\u0438\u0439 \u0441 \u043d\u0430\u0448\u0435\u0439 \u0441\u0442\u043e\u0440\u043e\u043d\u044b. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0432\u043c\u0435\u0441\u0442\u0435 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c, \u043a\u0430\u043a \u044d\u0442\u043e \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442. \u0414\u0430\u0436\u0435 \u0435\u0441\u043b\u0438 \u0443 \u0432\u0430\u0441 \u043f\u043e\u043a\u0430 \u043d\u0435\u0442 \u043e\u043f\u044b\u0442\u0430 \u0441 Ansible, \u0432\u044b \u043b\u0435\u0433\u043a\u043e \u0432\u043e \u0432\u0441\u0435\u043c \u0440\u0430\u0437\u0431\u0435\u0440\u0435\u0442\u0435\u0441\u044c. <\/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-323248","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/323248","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=323248"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/323248\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=323248"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=323248"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=323248"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}