{"id":797,"date":"2026-09-17T22:35:30","date_gmt":"2026-09-17T19:35:30","guid":{"rendered":"https:\/\/imaxis.ru\/?p=797"},"modified":"2026-09-18T00:05:01","modified_gmt":"2026-09-17T21:05:01","slug":"ustanovka-i-nastroyka-ansible-na-linux-inventar-pleybuki-i-reshenie-problem","status":"publish","type":"post","link":"https:\/\/imaxis.ru\/?p=797","title":{"rendered":"\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 Ansible \u043d\u0430 Linux: \u0438\u043d\u0432\u0435\u043d\u0442\u0430\u0440\u044c, \u043f\u043b\u0435\u0439\u0431\u0443\u043a\u0438 \u0438 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0431\u043b\u0435\u043c"},"content":{"rendered":"<h1>\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 Ansible \u043d\u0430 Linux: \u0438\u043d\u0432\u0435\u043d\u0442\u0430\u0440\u044c, \u043f\u043b\u0435\u0439\u0431\u0443\u043a\u0438 \u0438 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0431\u043b\u0435\u043c<\/h1>\n<p>Ansible \u2014 \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044f\u043c\u0438 \u0431\u0435\u0437 \u0430\u0433\u0435\u043d\u0442\u043e\u0432: \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u043a \u0441\u0435\u0440\u0432\u0435\u0440\u0430\u043c \u043f\u043e SSH, \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442 \u0437\u0430\u0434\u0430\u0447\u0438 \u0438\u0437 \u043f\u043b\u0435\u0439\u0431\u0443\u043a\u043e\u0432 \u0438 \u043d\u0435 \u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u043a\u043b\u0438\u0435\u043d\u0442\u0430 \u043d\u0430 \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c\u044b\u0445 \u0445\u043e\u0441\u0442\u0430\u0445. \u0418\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f \u043f\u043e\u0434\u043e\u0439\u0434\u0451\u0442 \u0434\u043b\u044f Ubuntu, Debian, Astra Linux, Rocky \u0438 CentOS.<\/p>\n<p>\u0410\u043a\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0435 \u0432\u0435\u0440\u0441\u0438\u0438 \u043d\u0430 \u0441\u0435\u043d\u0442\u044f\u0431\u0440\u044c 2026: <strong>ansible-core 2.21.4<\/strong> \u0438 \u043c\u0435\u0442\u0430\u043f\u0430\u043a\u0435\u0442 <strong>ansible 14.4.0<\/strong> (\u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u0438).<\/p>\n<hr \/>\n<h2>\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430<\/h2>\n<h3>\u0418\u0437 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u044f<\/h3>\n<p><strong>Ubuntu \/ Debian \/ Astra Linux:<\/strong><\/p>\n<pre><code class=\"language-bash\">apt update\napt install ansible\n<\/code><\/pre>\n<p><strong>CentOS \/ Rocky:<\/strong><\/p>\n<p>\u0412 \u0431\u0430\u0437\u043e\u0432\u043e\u043c \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0438 Ansible \u043d\u0435\u0442 \u2014 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u043c EPEL:<\/p>\n<pre><code class=\"language-bash\">yum install epel-release\nyum install ansible\n<\/code><\/pre>\n<p><strong>\u0420\u0415\u0414 \u041e\u0421:<\/strong><\/p>\n<pre><code class=\"language-bash\">dnf install ansible\n<\/code><\/pre>\n<h3>\u041a\u0430\u043a \u043c\u043e\u0434\u0443\u043b\u044c Python (\u0443\u043d\u0438\u0432\u0435\u0440\u0441\u0430\u043b\u044c\u043d\u044b\u0439 \u0441\u043f\u043e\u0441\u043e\u0431)<\/h3>\n<p>\u0421\u0442\u0430\u0432\u0438\u043c pip:<\/p>\n<pre><code class=\"language-bash\"># Debian \/ Ubuntu \/ Astra\napt install python3-pip\n\n# Rocky \/ \u0420\u0415\u0414 \u041e\u0421\ndnf install python3-pip\n<\/code><\/pre>\n<p>\u0423\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c \u044f\u0434\u0440\u043e Ansible:<\/p>\n<pre><code class=\"language-bash\">python3 -m pip install ansible-core\n<\/code><\/pre>\n<p>\u041a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u0430\u044f \u0432\u0435\u0440\u0441\u0438\u044f:<\/p>\n<pre><code class=\"language-bash\">python3 -m pip install ansible-core==2.21\n<\/code><\/pre>\n<p><strong>\u0421\u043f\u0438\u0441\u043e\u043a \u0432\u0435\u0440\u0441\u0438\u0439 \u2014 \u043d\u0430 <a href=\"https:\/\/pypi.org\/project\/ansible-core\/#history\">pypi.org<\/a>.<\/strong><\/p>\n<p>\u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0430:<\/p>\n<pre><code class=\"language-bash\">ansible --version\n<\/code><\/pre>\n<h3>\u041a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u0438<\/h3>\n<p>\u0420\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u0435\u0442\u0441\u044f \u0441\u0440\u0430\u0437\u0443 \u043f\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0435 \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u0438:<\/p>\n<pre><code class=\"language-bash\">ansible-galaxy collection install community.general\n<\/code><\/pre>\n<hr \/>\n<h2>\u041d\u0430\u0447\u0430\u043b\u044c\u043d\u0430\u044f \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u0438 \u0442\u0435\u0441\u0442\u043e\u0432\u044b\u0439 \u0437\u0430\u043f\u0443\u0441\u043a<\/h2>\n<h3>\u0418\u043d\u0432\u0435\u043d\u0442\u0430\u0440\u043d\u044b\u0439 \u0444\u0430\u0439\u043b<\/h3>\n<p>\u0412 \u043d\u0451\u043c \u0445\u0440\u0430\u043d\u044f\u0442\u0441\u044f \u0445\u043e\u0441\u0442\u044b, \u0433\u0440\u0443\u043f\u043f\u044b \u0438 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435.<\/p>\n<p><strong>1. \u0424\u043e\u0440\u043c\u0430\u0442 ini<\/strong> (\u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e):<\/p>\n<pre><code class=\"language-bash\">vi \/etc\/ansible\/hosts\n<\/code><\/pre>\n<pre><code>[test_servers]\n192.168.1.100\n192.168.1.101\n<\/code><\/pre>\n<p><strong>\u0421\u043e\u0437\u0434\u0430\u043d\u0430 \u0433\u0440\u0443\u043f\u043f\u0430 <code>test_servers<\/code> \u0438\u0437 \u0434\u0432\u0443\u0445 \u0441\u0435\u0440\u0432\u0435\u0440\u043e\u0432.<\/strong><\/p>\n<p><strong>2. \u0424\u043e\u0440\u043c\u0430\u0442 yml:<\/strong><\/p>\n<pre><code class=\"language-bash\">mkdir \/etc\/ansible\/inventory\nvi \/etc\/ansible\/inventory\/test_servers.yml\n<\/code><\/pre>\n<pre><code class=\"language-yaml\">---\ntest_servers:\n  vars:\n    ansible_python_interpreter: \/usr\/bin\/python3\n  hosts:\n    server01:\n      ansible_ssh_host: 192.168.1.100\n      ansible_ssh_port: 22\n    server02:\n      ansible_ssh_host: 192.168.1.101\n      ansible_ssh_port: 22\n    server03:\n      ansible_connection: local\n<\/code><\/pre>\n<p><strong>\u0413\u0440\u0443\u043f\u043f\u0430 <code>test_servers<\/code> \u0438\u0437 \u0442\u0440\u0451\u0445 \u0441\u0435\u0440\u0432\u0435\u0440\u043e\u0432:<\/strong> <code>server01<\/code> \u0438 <code>server02<\/code> \u0441 \u0430\u0434\u0440\u0435\u0441\u0430\u043c\u0438 <code>192.168.1.100<\/code> \u0438 <code>192.168.1.101<\/code>, \u0430 <code>server03<\/code> \u2014 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u044b\u0439 (<code>local<\/code>). \u0410\u0434\u0440\u0435\u0441\u0430 \u043c\u043e\u0436\u043d\u043e \u043d\u0435 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c, \u0435\u0441\u043b\u0438 \u0438\u043c\u0435\u043d\u0430 \u0440\u0430\u0437\u0440\u0435\u0448\u0430\u044e\u0442\u0441\u044f \u0447\u0435\u0440\u0435\u0437 DNS; \u043f\u043e\u0440\u0442 \u2014 \u0435\u0441\u043b\u0438 \u043e\u043d \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0439 (22). \u0422\u0430\u043a\u0436\u0435 \u0437\u0430\u0434\u0430\u043d\u0430 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f <code>ansible_python_interpreter<\/code>.<\/p>\n<h3>\u041a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044f Ansible<\/h3>\n<pre><code class=\"language-bash\">vi \/etc\/ansible\/ansible.cfg\n<\/code><\/pre>\n<p>\u0412 \u043d\u043e\u0432\u044b\u0445 \u0432\u0435\u0440\u0441\u0438\u044f\u0445 \u0444\u0430\u0439\u043b \u043c\u043e\u0436\u0435\u0442 \u043d\u0435 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c\u0441\u044f \u2014 \u0441\u043e\u0437\u0434\u0430\u0451\u043c \u043a\u0430\u0442\u0430\u043b\u043e\u0433 \u0438 \u0444\u0430\u0439\u043b:<\/p>\n<pre><code class=\"language-bash\">mkdir -p \/etc\/ansible\nvi \/etc\/ansible\/ansible.cfg\n<\/code><\/pre>\n<p>\u0420\u0430\u0441\u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0438\u0440\u0443\u0435\u043c \u0438 \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u043c \u043a \u0432\u0438\u0434\u0443:<\/p>\n<pre><code>[defaults]\nhost_key_checking = False\ninterpreter_python = auto_silent\n<\/code><\/pre>\n<p><strong><code>host_key_checking = False<\/code><\/strong> \u2014 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0442\u044c SSH fingerprint \u0431\u0435\u0437 \u0432\u0432\u043e\u0434\u0430 <code>yes<\/code>.<br \/>\n<strong><code>interpreter_python = auto_silent<\/code><\/strong> \u2014 \u0438\u0441\u043a\u0430\u0442\u044c Python \u043d\u0430 \u0446\u0435\u043b\u0435\u0432\u043e\u043c \u0445\u043e\u0441\u0442\u0435 \u0431\u0435\u0437 \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0439.<\/p>\n<h3>\u0422\u0435\u0441\u0442\u043e\u0432\u044b\u0439 \u0437\u0430\u043f\u0443\u0441\u043a<\/h3>\n<pre><code class=\"language-bash\">ansible -m ping test_servers -u root -kK\n<\/code><\/pre>\n<p><strong>\u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u043e\u0441\u0442\u0438 \u0441\u0435\u0440\u0432\u0435\u0440\u043e\u0432 \u0433\u0440\u0443\u043f\u043f\u044b <code>test_servers<\/code> \u043e\u0442 <code>root<\/code>.<\/strong><\/p>\n<p>\u0421 yml-\u0438\u043d\u0432\u0435\u043d\u0442\u0430\u0440\u0451\u043c:<\/p>\n<pre><code class=\"language-bash\">ansible -i \/etc\/ansible\/inventory\/test_servers.yml -m ping test_servers -u root -kK\n<\/code><\/pre>\n<p>\u041b\u043e\u043a\u0430\u043b\u044c\u043d\u043e:<\/p>\n<pre><code class=\"language-bash\">ansible -m ping localhost --connection=local\n<\/code><\/pre>\n<p>\u041f\u0440\u0438\u043c\u0435\u0440 \u043e\u0442\u0432\u0435\u0442\u0430:<\/p>\n<pre><code>192.168.1.100 | SUCCESS =&gt; {\n    &quot;ansible_facts&quot;: {\n        &quot;discovered_interpreter_python&quot;: &quot;\/usr\/bin\/python3&quot;\n    },\n    &quot;changed&quot;: false,\n    &quot;ping&quot;: &quot;pong&quot;\n}\n<\/code><\/pre>\n<hr \/>\n<h2>\u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u0431\u0435\u0437 \u043f\u0430\u0440\u043e\u043b\u044f (SSH-\u043a\u043b\u044e\u0447\u0438)<\/h2>\n<p>\u0413\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u043c \u043f\u0430\u0440\u0443 \u043a\u043b\u044e\u0447\u0435\u0439:<\/p>\n<pre><code class=\"language-bash\">ssh-keygen -t ed25519\n<\/code><\/pre>\n<p>\u041d\u0430\u0436\u0438\u043c\u0430\u0435\u043c <strong>Enter<\/strong> \u043d\u0430 \u0432\u0441\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u044b (\u043f\u0443\u0442\u044c \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e, \u0431\u0435\u0437 \u043f\u0430\u0440\u043e\u043b\u044f):<\/p>\n<pre><code>Your identification has been saved in \/root\/.ssh\/id_ed25519\nYour public key has been saved in \/root\/.ssh\/id_ed25519.pub\n<\/code><\/pre>\n<p><strong>\u041a\u043b\u044e\u0447\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u044b \u043f\u043e\u0434 <code>root<\/code> \u0432 <code>\/root\/.ssh<\/code>.<\/strong><\/p>\n<p>\u041a\u043e\u043f\u0438\u0440\u0443\u0435\u043c \u043f\u0443\u0431\u043b\u0438\u0447\u043d\u044b\u0439 \u043a\u043b\u044e\u0447 \u043d\u0430 \u0432\u0441\u0435 \u0441\u0435\u0440\u0432\u0435\u0440\u044b:<\/p>\n<pre><code class=\"language-bash\">ssh-copy-id -i \/root\/.ssh\/id_ed25519.pub root@192.168.1.100\nssh-copy-id -i \/root\/.ssh\/id_ed25519.pub root@192.168.1.101\n<\/code><\/pre>\n<p>\u0412\u0440\u0443\u0447\u043d\u0443\u044e \u2014 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 <code>id_ed25519.pub<\/code> \u0432 <code>authorized_keys<\/code> \u043d\u0443\u0436\u043d\u043e\u0433\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f:<\/p>\n<pre><code class=\"language-bash\">mkdir -p \/root\/.ssh\nvi \/root\/.ssh\/authorized_keys\n<\/code><\/pre>\n<p>\u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u0432\u0445\u043e\u0434 \u0431\u0435\u0437 \u043f\u0430\u0440\u043e\u043b\u044f:<\/p>\n<pre><code class=\"language-bash\">ssh root@192.168.1.100\n<\/code><\/pre>\n<p>\u0418 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c Ansible \u0431\u0435\u0437 \u043f\u0430\u0440\u043e\u043b\u0435\u0439:<\/p>\n<pre><code class=\"language-bash\">ansible -m ping test_servers -u root\nansible -i \/etc\/ansible\/inventory\/test_servers.yml -m ping test_servers -u root\n<\/code><\/pre>\n<hr \/>\n<h2>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u043f\u043b\u0435\u0439\u0431\u0443\u043a\u043e\u0432<\/h2>\n<p>\u041f\u043b\u0435\u0439\u0431\u0443\u043a \u2014 \u0444\u0430\u0439\u043b \u0441\u043e \u0441\u043f\u0438\u0441\u043a\u043e\u043c \u0437\u0430\u0434\u0430\u0447 \u0438\/\u0438\u043b\u0438 \u0440\u043e\u043b\u0435\u0439, \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0438 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u0437\u0430\u043f\u0443\u0441\u043a\u0430:<\/p>\n<pre><code class=\"language-bash\">vi my_play.yml\n<\/code><\/pre>\n<pre><code class=\"language-yaml\">- hosts: all\n  gather_facts: yes\n  user: root\n  vars:\n    app_ver: 14\n  roles:\n    - role: prepare\n    - role: install\n    - role: settings\n\n- hosts: server1\n  gather_facts: no\n  user: root\n  tasks:\n    - name: install curl\n      package:\n        name: curl\n        state: present\n<\/code><\/pre>\n<p><strong>\u0412 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0434\u0432\u0430 \u0431\u043b\u043e\u043a\u0430:<\/strong><\/p>\n<ol>\n<li>\u041d\u0430 \u0432\u0441\u0435\u0445 \u0445\u043e\u0441\u0442\u0430\u0445 (<code>hosts: all<\/code>) \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u044e\u0442\u0441\u044f \u0440\u043e\u043b\u0438 <code>prepare<\/code>, <code>install<\/code>, <code>settings<\/code>; \u0441\u0431\u043e\u0440 \u0444\u0430\u043a\u0442\u043e\u0432 (<code>gather_facts: yes<\/code>), \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u043e\u0442 <code>root<\/code>, \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f <code>app_ver: 14<\/code>.<\/li>\n<li>\u041d\u0430 \u0443\u0437\u043b\u0435 <code>server1<\/code> \u2014 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u043f\u0430\u043a\u0435\u0442\u0430 <code>curl<\/code>.<\/li>\n<\/ol>\n<p>\u0417\u0430\u043f\u0443\u0441\u043a:<\/p>\n<pre><code class=\"language-bash\">ansible-playbook -i \/etc\/ansible\/inventory\/test_servers.yml .\/my_play.yml\n<\/code><\/pre>\n<hr \/>\n<h2>\u0420\u0435\u0448\u0435\u043d\u0438\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0445 \u043f\u0440\u043e\u0431\u043b\u0435\u043c<\/h2>\n<h3>Failed to connect to the host<\/h3>\n<p><strong>\u041f\u0440\u0438\u0447\u0438\u043d\u0430:<\/strong> \u043d\u0435\u0442 \u043f\u0440\u0430\u0432 \u043d\u0430 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u043a \u0443\u0434\u0430\u043b\u0451\u043d\u043d\u043e\u043c\u0443 \u0445\u043e\u0441\u0442\u0443 \u043f\u043e SSH.<\/p>\n<p><strong>\u0420\u0435\u0448\u0435\u043d\u0438\u0435:<\/strong> \u043f\u0440\u043e\u0432\u0435\u0440\u044c\u0442\u0435 \u0432\u0445\u043e\u0434 \u0432\u0440\u0443\u0447\u043d\u0443\u044e:<\/p>\n<pre><code class=\"language-bash\">ssh root@192.168.1.100\n<\/code><\/pre>\n<p>\u0415\u0441\u043b\u0438 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u044c\u0441\u044f \u043d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u2014 \u043d\u0435\u0432\u0435\u0440\u043d\u044b\u0439 \u043f\u0430\u0440\u043e\u043b\u044c \u0438\u043b\u0438 \u0432\u0445\u043e\u0434 \u043f\u043e SSH \u0434\u043b\u044f <code>root<\/code> \u0437\u0430\u043f\u0440\u0435\u0449\u0451\u043d. \u0421\u043e\u0437\u0434\u0430\u0439\u0442\u0435 \u0441\u043b\u0443\u0436\u0435\u0431\u043d\u0443\u044e \u0443\u0447\u0451\u0442\u043d\u0443\u044e \u0437\u0430\u043f\u0438\u0441\u044c \u043d\u0430 \u0443\u0434\u0430\u043b\u0451\u043d\u043d\u043e\u043c \u0441\u0435\u0440\u0432\u0435\u0440\u0435:<\/p>\n<pre><code class=\"language-bash\">useradd ansible\npasswd ansible\n<\/code><\/pre>\n<p>\u0418 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0439\u0442\u0435 \u043e\u0442 \u043d\u0435\u0451:<\/p>\n<pre><code class=\"language-bash\">ansible -m ping test_servers -u ansible -kK\n<\/code><\/pre>\n<h3>Python Module not found<\/h3>\n<p><strong>\u041f\u0440\u0438\u0447\u0438\u043d\u0430:<\/strong> \u043d\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d \u043d\u0443\u0436\u043d\u044b\u0439 Python-\u043c\u043e\u0434\u0443\u043b\u044c \u0438\u043b\u0438 \u0435\u0433\u043e \u0432\u0435\u0440\u0441\u0438\u044f \u043d\u0435 \u043f\u043e\u0434\u0445\u043e\u0434\u0438\u0442.<\/p>\n<p><strong>\u0420\u0435\u0448\u0435\u043d\u0438\u0435:<\/strong> \u0441\u0442\u0430\u0432\u0438\u043c \u043c\u043e\u0434\u0443\u043b\u044c \u0447\u0435\u0440\u0435\u0437 pip. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0434\u043b\u044f \u043e\u0448\u0438\u0431\u043a\u0438:<\/p>\n<pre><code>Python Module not found: firewalld and its python module are required ...\n<\/code><\/pre>\n<pre><code class=\"language-bash\">python3 -m pip install firewall\n<\/code><\/pre>\n<p>\u041f\u0440\u0438 \u043e\u0448\u0438\u0431\u043a\u0435 <code>No module named pip<\/code> \u2014 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0435 \u043f\u0430\u043a\u0435\u0442 <code>python3-pip<\/code>.<\/p>\n<h3>No module named &#8216;ansible.module_utils.six.moves&#8217;<\/h3>\n<p><strong>\u041f\u0440\u0438\u0447\u0438\u043d\u0430:<\/strong> \u043d\u0435\u0441\u043e\u0432\u043c\u0435\u0441\u0442\u0438\u043c\u043e\u0441\u0442\u044c \u0432\u0435\u0440\u0441\u0438\u0439 Ansible \u0438 Python (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, Ansible 2.9 \u0438 Python 3.12).<\/p>\n<p><strong>\u0420\u0435\u0448\u0435\u043d\u0438\u0435:<\/strong> \u043e\u0431\u043d\u043e\u0432\u0438\u0442\u044c Ansible. \u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u0432\u0435\u0440\u0441\u0438\u044e:<\/p>\n<pre><code class=\"language-bash\">ansible --version\n<\/code><\/pre>\n<p><strong>Deb-\u0441\u0438\u0441\u0442\u0435\u043c\u044b:<\/strong><\/p>\n<pre><code class=\"language-bash\">apt update\napt install ansible\n<\/code><\/pre>\n<p><strong>RPM-\u0441\u0438\u0441\u0442\u0435\u043c\u044b:<\/strong><\/p>\n<pre><code class=\"language-bash\">dnf install ansible\n<\/code><\/pre>\n<p>\u0415\u0441\u043b\u0438 \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0439 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0443\u0441\u0442\u0430\u0440\u0435\u0432\u0448\u0443\u044e \u0432\u0435\u0440\u0441\u0438\u044e (\u0447\u0430\u0441\u0442\u0430\u044f \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044f \u0432 DEB), \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u043c \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430:<\/p>\n<pre><code class=\"language-bash\">apt install software-properties-common\napt-add-repository ppa:ansible\/ansible\napt install ansible\n<\/code><\/pre>\n<hr \/>\n<h2>\u0422\u043e\u043d\u043a\u043e\u0441\u0442\u0438 \u0438 \u043f\u043e\u0434\u0432\u043e\u0434\u043d\u044b\u0435 \u043a\u0430\u043c\u043d\u0438<\/h2>\n<ul>\n<li><strong><code>host_key_checking = False<\/code><\/strong> \u2014 \u0443\u0434\u043e\u0431\u043d\u043e \u0434\u043b\u044f \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0430\u0446\u0438\u0438, \u043d\u043e \u0441\u043d\u0438\u0436\u0430\u0435\u0442 \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u044c: \u0434\u043e\u0432\u0435\u0440\u044f\u0439\u0442\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0441\u0432\u043e\u0435\u0439 \u0441\u0435\u0442\u0438.<\/li>\n<li><strong><code>interpreter_python = auto_silent<\/code><\/strong> \u2014 \u0443\u0431\u0438\u0440\u0430\u0435\u0442 \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u044f \u043e \u043f\u043e\u0438\u0441\u043a\u0435 Python \u043d\u0430 \u0446\u0435\u043b\u0435\u0432\u044b\u0445 \u0445\u043e\u0441\u0442\u0430\u0445.<\/li>\n<li><strong>\u041a\u043b\u044e\u0447\u0438 \u043f\u043e\u0434 root<\/strong> \u2014 <code>ssh-copy-id<\/code> \u0434\u043b\u044f <code>root<\/code> \u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u0440\u0430\u0437\u0440\u0435\u0448\u0451\u043d\u043d\u043e\u0433\u043e \u0432\u0445\u043e\u0434\u0430 \u043f\u043e SSH \u043e\u0442 \u0441\u0443\u043f\u0435\u0440\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f; \u043d\u0430 \u043f\u0440\u043e\u0434\u0435 \u043b\u0443\u0447\u0448\u0435 \u0441\u043b\u0443\u0436\u0435\u0431\u043d\u044b\u0439 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0441 <code>sudo<\/code>.<\/li>\n<li><strong><code>ansible-core<\/code> vs <code>ansible<\/code><\/strong> \u2014 <code>core<\/code> \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u0432\u0438\u0436\u043e\u043a \u0438 \u0431\u0430\u0437\u043e\u0432\u044b\u0435 \u043c\u043e\u0434\u0443\u043b\u0438; \u0434\u043b\u044f \u043f\u043e\u043b\u043d\u043e\u0433\u043e \u043d\u0430\u0431\u043e\u0440\u0430 \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u0439 \u0441\u0442\u0430\u0432\u044c\u0442\u0435 \u043c\u0435\u0442\u0430\u043f\u0430\u043a\u0435\u0442 <code>ansible<\/code> \u0438\u043b\u0438 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0435 \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u0438 \u0447\u0435\u0440\u0435\u0437 <code>ansible-galaxy<\/code>.<\/li>\n<li><strong>\u0418\u043d\u0432\u0435\u043d\u0442\u0430\u0440\u044c yml<\/strong> \u2014 \u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u043e\u043f\u0446\u0438\u0438 <code>-i<\/code>, ini-\u0444\u043e\u0440\u043c\u0430\u0442 \u0432 <code>\/etc\/ansible\/hosts<\/code> \u043f\u043e\u0434\u0445\u0432\u0430\u0442\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e.<\/li>\n<\/ul>\n<hr \/>\n<h2>\u0428\u043f\u0430\u0440\u0433\u0430\u043b\u043a\u0430<\/h2>\n<pre><code class=\"language-bash\"># \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430\napt install ansible              # Ubuntu\/Debian\/Astra\nyum install epel-release ansible # CentOS\/Rocky\npython3 -m pip install ansible-core\n\n# \u0438\u043d\u0432\u0435\u043d\u0442\u0430\u0440\u044c\nvi \/etc\/ansible\/hosts\n\n# \u043a\u043e\u043d\u0444\u0438\u0433\nvi \/etc\/ansible\/ansible.cfg      # host_key_checking = False\n\n# \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430\nansible -m ping test_servers -u root -kK\n\n# \u043a\u043b\u044e\u0447\u0438\nssh-keygen -t ed25519\nssh-copy-id -i \/root\/.ssh\/id_ed25519.pub root@192.168.1.100\n\n# \u043f\u043b\u0435\u0439\u0431\u0443\u043a\nansible-playbook -i \/etc\/ansible\/inventory\/test_servers.yml .\/my_play.yml\n<\/code><\/pre>\n<p><em>\u041f\u0440\u043e\u0432\u0435\u0440\u0435\u043d\u043e \u043d\u0430: Ubuntu 22.04\/24.04\/26.04, Rocky Linux + ansible-core 2.21.4.<\/em><br \/>\n<em>\u0414\u0430\u0442\u0430: \u0421\u0435\u043d\u0442\u044f\u0431\u0440\u044c 2026.<\/em><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 Ansible \u043d\u0430 Linux: \u0438\u043d\u0432\u0435\u043d\u0442\u0430\u0440\u044c, \u043f\u043b\u0435\u0439\u0431\u0443\u043a\u0438 \u0438 \u0440\u0435\u0448\u0435\u043d\u0438\u0435<\/p>\n","protected":false},"author":0,"featured_media":954,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"footnotes":""},"categories":[3],"tags":[],"class_list":["post-797","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-linux"],"aioseo_notices":[],"views":9,"_links":{"self":[{"href":"https:\/\/imaxis.ru\/index.php?rest_route=\/wp\/v2\/posts\/797","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/imaxis.ru\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/imaxis.ru\/index.php?rest_route=\/wp\/v2\/types\/post"}],"replies":[{"embeddable":true,"href":"https:\/\/imaxis.ru\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=797"}],"version-history":[{"count":1,"href":"https:\/\/imaxis.ru\/index.php?rest_route=\/wp\/v2\/posts\/797\/revisions"}],"predecessor-version":[{"id":798,"href":"https:\/\/imaxis.ru\/index.php?rest_route=\/wp\/v2\/posts\/797\/revisions\/798"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/imaxis.ru\/index.php?rest_route=\/wp\/v2\/media\/954"}],"wp:attachment":[{"href":"https:\/\/imaxis.ru\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=797"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/imaxis.ru\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=797"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/imaxis.ru\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=797"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}