{"id":567,"date":"2024-10-01T21:32:45","date_gmt":"2024-10-01T12:32:45","guid":{"rendered":"https:\/\/ssunmini.com\/wordpress\/?page_id=567"},"modified":"2025-12-31T20:58:21","modified_gmt":"2025-12-31T11:58:21","slug":"ansible","status":"publish","type":"page","link":"https:\/\/wp.ssunmini.com\/?page_id=567","title":{"rendered":"Automation \/ Orchestration"},"content":{"rendered":"\n<div class=\"wp-block-esab-accordion esab-egvufl5p\" data-mode=\"individual\" data-close=\"true\"><div class=\"esab__container\">\n<div class=\"wp-block-esab-accordion-child\"><div class=\"esab__head\" role=\"button\" aria-expanded=\"false\"><div class=\"esab__heading_txt\"><p class=\"esab__heading_tag\">Ansible playbook<\/p><\/div><div class=\"esab__icon\"><div class=\"esab__collapse\"> <svg version=\"1.2\" viewBox=\"0 0 24 24\" width=\"24\" height=\"24\"><path fill-rule=\"evenodd\" d=\"m3.5 20.5c-4.7-4.7-4.7-12.3 0-17 4.7-4.7 12.3-4.7 17 0 4.6 4.7 4.6 12.3 0 17-4.7 4.6-12.3 4.6-17 0zm0.9-0.9c4.2 4.2 11 4.2 15.2 0 4.2-4.2 4.2-11 0-15.2-4.2-4.3-11-4.3-15.2 0-4.3 4.2-4.3 11 0 15.2z\"><\/path><path d=\"m11.4 15.9v-3.3h-3.3c-0.3 0-0.6-0.3-0.6-0.6 0-0.4 0.3-0.6 0.6-0.6h3.3v-3.3c0-0.3 0.3-0.6 0.6-0.6 0.3 0 0.6 0.3 0.6 0.6v3.3h3.3c0.3 0 0.6 0.2 0.6 0.6q0 0.2-0.2 0.4-0.2 0.2-0.4 0.2h-3.3v3.3q0 0.2-0.2 0.4-0.2 0.2-0.4 0.2c-0.4 0-0.6-0.3-0.6-0.6z\"><\/path><\/svg> <\/div><div class=\"esab__expand\"> <svg version=\"1.2\" viewBox=\"0 0 24 24\" width=\"24\" height=\"24\"><path fill-rule=\"evenodd\" d=\"m12 24c-6.6 0-12-5.4-12-12 0-6.6 5.4-12 12-12 6.6 0 12 5.4 12 12 0 6.6-5.4 12-12 12zm10.6-12c0-5.9-4.7-10.6-10.6-10.6-5.9 0-10.6 4.7-10.6 10.6 0 5.9 4.7 10.6 10.6 10.6 5.9 0 10.6-4.7 10.6-10.6z\"><\/path><path d=\"m5.6 11.3h12.8v1.4h-12.8z\"><\/path><\/svg> <\/div><\/div><\/div><div class=\"esab__body\">\n<p class=\"has-vivid-cyan-blue-color has-text-color has-link-color wp-elements-1 wp-block-paragraph\"><strong>Ansible\uc740 IT \uc790\ub3d9\ud654 \ub3c4\uad6c\ub85c, \uc8fc\ub85c \uc11c\ubc84 \uad6c\uc131 \uad00\ub9ac, \uc560\ud50c\ub9ac\ucf00\uc774\uc158 \ubc30\ud3ec, \uadf8\ub9ac\uace0 \ub124\ud2b8\uc6cc\ud06c \uc7a5\ube44 \uad00\ub9ac \ub4f1\uc744 \uc790\ub3d9\ud654\ud558\ub294 \ub370 \uc0ac\uc6a9\ub429\ub2c8\ub2e4. Ansible\uc740 \uc5d0\uc774\uc804\ud2b8\ub9ac\uc2a4 \ubc29\uc2dd\uc73c\ub85c, \uc6d0\uaca9 \uc11c\ubc84\uc5d0 \ubcc4\ub3c4\uc758 \uc18c\ud504\ud2b8\uc6e8\uc5b4\ub97c \uc124\uce58\ud560 \ud544\uc694 \uc5c6\uc774 SSH\ub97c \ud1b5\ud574 \uba85\ub839\uc744 \uc804\ub2ec\ud558\uace0 \uc2e4\ud589\ud569\ub2c8\ub2e4. YAML \ud615\uc2dd\uc758 \uac04\ub2e8\ud55c \ud30c\uc77c(\ud50c\ub808\uc774\ubd81)\uc744 \uc0ac\uc6a9\ud558\uc5ec \uc791\uc5c5\uc744 \uc815\uc758\ud558\uace0, \uc5ec\ub7ec \uc11c\ubc84\uc5d0\uc11c \ub3d9\uc2dc\uc5d0 \uc2e4\ud589\ud560 \uc218 \uc788\uc5b4 \ub300\uaddc\ubaa8 \uc778\ud504\ub77c \uad00\ub9ac\uc5d0 \uc720\uc6a9\ud569\ub2c8\ub2e4.<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\uc8fc\uc694 \ud2b9\uc9d5<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\uc5d0\uc774\uc804\ud2b8 \uc124\uce58 \ubd88\ud544\uc694<\/li>\n\n\n\n<li>\uac04\ub2e8\ud55c YAML \uae30\ubc18 \uad6c\uc131<\/li>\n\n\n\n<li>\uc11c\ubc84, \ub124\ud2b8\uc6cc\ud06c, \ud074\ub77c\uc6b0\ub4dc \uc778\ud504\ub77c \uc790\ub3d9\ud654<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Rocky 9.4\n<ul class=\"wp-block-list\">\n<li>master \/ 192.168.0.50<\/li>\n\n\n\n<li>node1 \/ 192.168.0.51<\/li>\n\n\n\n<li>node2 \/ 192.168.0.52<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>master \uc11c\ubc84\uac00 ansible \uad00\ub9ac \uc11c\ubc84\n<ul class=\"wp-block-list\">\n<li>ansible \uc124\uce58<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li>node \uc11c\ubc84 \uad00\ub9ac\ub97c \uc704\ud558\uc5ec ssh \ud0a4 \uad50\ud658<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">master \uc11c\ubc84\uc5d0\uc11c \uc564\uc11c\ube14 \uc124\uce58<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>ansible \uad00\ub9ac \uc11c\ubc84\uc5d0\uc11c ssh \ud0a4 \uc124\uc815\n<ul class=\"wp-block-list\">\n<li>\uad00\ub9ac \uc11c\ubc84\uc5d0\uc11c node1, node2\ub85c \ube44\ubc00\ubc88\ud638 \uc5c6\uc774 SSH \uc811\uc18d\uc774 \uac00\ub2a5\ud574\uc57c \ud55c\ub2e4.<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>ssh-keygen -t rsa\n# \uae30\ubcf8 \/root\/.ssh\/ \uc5d0 \uc124\uc815\n# \uc8fc\uc758 \ud560\uc810\uc740 \uc774\ubbf8 \ud0a4\uac00 \uc788\ub294\ub370 \uc7ac\uc0dd\uc131 \ud560\uacbd\uc6b0 \uae30\uc874 \ub370\uc774\ud130\ub294 \uc0ac\ub77c\uc9c0\ub2c8 \ud655\uc778\ud558\uace0 \uc2e4\ud589\ud558\ub3c4\ub85d\n\nvim \/root\/.ssh\/id_rsa.pub \n# \ud574\ub2f9 \ud30c\uc77c\uc548\uc758 \ub0b4\uc6a9\uc744 \ubcf5\uc0ac\ud558\uc5ec node1, node2  \/root\/.ssh\/authorized_keys \uc5d0 \ubcf5\uc0ac\n\nvim \/root\/.ssh\/authorized_keys\n# master \uc11c\ubc84\uc5d0 \uc788\ub358 id_rsa.pub \ud0a4 \uac12\uc744 node1, node2 \uc11c\ubc84 authorized_keys\uc5d0 \ubcf5\uc0ac\n\n\ud328\uc2a4\uc6cc\ub4dc \uc5c6\uc774 \uc790\ub3d9 \uc811\uc18d\uc774 \ub418\ub294\uc9c0 \ud655\uc778\n<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\uc2dc\uc2a4\ud15c \uc5c5\ub370\uc774\ud2b8<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>dnf -y update\n<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li>EPEL \uc800\uc7a5\uc18c \ucd94\uac00<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>dnf -y install epel-release\n<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li>ansible \uc124\uce58<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>dnf -y install ansible\n<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\ubc84\uc804 \ud655\uc778<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>ansible --version\n<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\uc778\ubca4\ud1a0\ub9ac \uc124\uc815\n<ul class=\"wp-block-list\">\n<li>\uad00\ub9ac\ud560 \uc11c\ubc84\uc758 \ubaa9\ub85d\uc744 \uc778\ubca4\ud1a0\ub9ac \ud30c\uc77c\uc5d0 \uae30\ub85d\ud558\uc5ec \uc0ac\uc6a9<\/li>\n\n\n\n<li>\uae30\ubcf8\uc801\uc73c\ub85c \/etc\/ansible\/hosts\/ \ud30c\uc77c\uc744 \uc0ac\uc6a9 \ud558\uc9c0\ub9cc, \ubcc4\ub3c4\uc758 \uc778\ubca4\ud1a0\ub9ac \ud30c\uc77c\uc744 \ub9cc\ub4e4\uc5b4 \uc0ac\uc6a9\ud560 \uc218\ub3c4 \uc788\ub2e4.<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>\/etc\/ansible\/hosts  # \uc778\ubca4\ud1a0\ub9ac \uc124\uc815\n\n\n&#91;node_servers]\n192.168.0.51\n192.168.0.52<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li>ansible ping \ubaa8\ub4c8\ub85c \uc11c\ubc84 \ud655\uc778\n<ul class=\"wp-block-list\">\n<li>ansible\uc774 \uc11c\ubc84\uc5d0 \uc815\uc0c1\uc801\uc73c\ub85c \uc811\uc18d\ud560 \uc218 \uc788\ub294\uc9c0 \ud655\uc778\ud558\ub824\uba74 ping \ubaa8\ub4c8\uc744 \uc0ac\uc6a9<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>ansible all -m ping\n<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li>playbook \uc791\uc131\n<ul class=\"wp-block-list\">\n<li>\ud50c\ub808\uc774\ubd81\uc740 YAML \ud30c\uc77c\ub85c \uc791\uc131\ub418\uba70, \uc5ec\ub7ec \uc11c\ubc84\uc5d0\uc11c \uc2e4\ud589\ud560 \uc791\uc5c5\uc744 \uc815\uc758<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>vim \/etc\/ansible\/nginx_mysql_docker.yml \n<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\ud50c\ub808\uc774\ubd81 \uc791\uc131\n<ul class=\"wp-block-list\">\n<li>\ud50c\ub808\uc774\ubd81 \ub0b4\uc6a9: node1, node2 \uc11c\ubc84\uc5d0 nginx \uc124\uce58, port 81 \ubcc0\uacbd, mysql \uc124\uce58, docker \uc124\uce58 \ud6c4\uc5d0 image apache \uc124\uce58, port 82 \ubcc0\uacbd, firealld \uc911\uc9c0 \ubc0f \ube44\ud65c\uc131\ud654 \uc124\uc815<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;root@master ansible]# cat nginx_mysql_docker.yml\n---\n- hosts: node_servers\n  become: yes\n  tasks:\n\n    # 1. Install Nginx\n    - name: Install Nginx\n      dnf:\n        name: nginx\n        state: present\n\n    # 2. Configure Nginx to use port 81\n    - name: Change Nginx to listen on port 81\n      lineinfile:\n        path: \/etc\/nginx\/nginx.conf\n        regexp: 'listen       80;'\n        line: 'listen       81;'\n        state: present\n      notify:\n        - restart nginx\n\n    # 3. Start and enable Nginx\n    - name: Ensure Nginx is running and enabled\n      systemd:\n        name: nginx\n        state: started\n        enabled: yes\n\n    # 4. Install MySQL\n    - name: Install MySQL\n      dnf:\n        name: mariadb-server\n        state: present\n\n    # 5. Start and enable MySQL\n    - name: Ensure MySQL is running and enabled\n      systemd:\n        name: mariadb\n        state: started\n        enabled: yes\n\n    # 6. Install Docker\n    - name: Install Docker\n      dnf:\n        name: docker\n        state: present\n\n    # 7. Start and enable Docker\n    - name: Ensure Docker is running and enabled\n      systemd:\n        name: docker\n        state: started\n        enabled: yes\n\n    # 8. Pull Apache Docker image\n    - name: Pull Apache Docker image\n      docker_image:\n        name: httpd\n        source: pull\n\n    # 9. Run Apache Docker container on port 82\n    - name: Run Apache container on port 82\n      docker_container:\n        name: apache_server\n        image: httpd\n        ports:\n          - \"82:80\"\n        state: started\n        restart_policy: always\n\n    # 10. Disable and stop firewalld\n    - name: Stop firewalld\n      systemd:\n        name: firewalld\n        state: stopped\n\n    - name: Disable firewalld\n      systemd:\n        name: firewalld\n        enabled: no\n\n  handlers:\n    - name: restart nginx\n      systemd:\n        name: nginx\n        state: restarted\n\n<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\ud50c\ub808\uc774\ubd81 \uc2e4\ud589<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>ansible-playbook nginx_mysql_docker.yml\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">2\ubc88 \uc9f8 \ud50c\ub808\uc774\ubd81 \uc791\uc131<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\ud50c\ub808\uc774\ubd81 \uc791\uc131\n<ul class=\"wp-block-list\">\n<li>\ud50c\ub808\uc774\ubd81 \ub0b4\uc6a9: disk \ub0a8\uc740 \uc6a9\ub7c9, \uba54\ubaa8\ub9ac \ubc84\ud37c\/\uce90\uc26c, cpu \uc0ac\uc6a9\ub960 \ud655\uc778<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;root@master ansible]# cat 3.test.yml\n---\n- hosts: all\n  become: yes\n  gather_facts: no\n  tasks:\n\n    # 1. \ub514\uc2a4\ud06c \ub0a8\uc740 \uc6a9\ub7c9 \ud655\uc778\n    - name: Check available disk space\n      command: df -h --output=avail \/\n      register: disk_available\n    - name: Show available disk space\n      debug:\n        msg: \"Available disk space: {{ disk_available.stdout_lines&#91;1] }}\"\n\n    # 2. \uba54\ubaa8\ub9ac \uc804\uccb4 \uc815\ubcf4 \ud655\uc778 (debug\ub85c \ucd9c\ub825)\n    - name: Check memory information\n      command: free -m\n      register: memory_info\n    - name: Show full memory info\n      debug:\n        var: memory_info.stdout_lines\n\n    # 3. \uba54\ubaa8\ub9ac \ubc84\ud37c \uce90\uc2dc \ud655\uc778\n    - name: Show buffer\/cache memory\n      debug:\n        msg: \"Buffer\/Cache memory: {{ memory_info.stdout_lines&#91;1].split()&#91;5] }} MB\"\n\n    # 2. CPU \uc0ac\uc6a9\ub960 \ud655\uc778 (iowait, steal \uc81c\uac70)\n    - name: Check CPU usage with sar (remove %iowait and %steal using sed)\n      shell: sar 1 1 | grep -v Linux | sed 's\/\\\\s*&#91;0-9\\\\.]\\\\+\\\\s*&#91;0-9\\\\.]\\\\+\\\\s*$\/\/'\n      register: cpu_usage_sed\n      ignore_errors: yes  # \uc5d0\ub7ec\uac00 \ubc1c\uc0dd\ud558\ub354\ub77c\ub3c4 \ud50c\ub808\uc774\ubd81 \uc2e4\ud589\uc744 \uc911\ub2e8\ud558\uc9c0 \uc54a\uc74c\n\n    - name: Show CPU usage (without %iowait and %steal)\n      debug:\n        msg: \"{{ cpu_usage_sed.stdout }}\"\n<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\ud50c\ub808\uc774\ubd81 \uc2e4\ud589<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>ansible-playbook 3.test.yml\n<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\uc2e4\ud589 \uacb0\uacfc\n<ul class=\"wp-block-list\">\n<li>fail \uc5c6\uc774 \uc804\ubd80 ok \uc0c1\ud0dc\uc778 \uac83\uc744 \ud655\uc778\ud560 \uc218 \uc788\ub2e4.<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;root@master ansible]# ansible-playbook 3.test.yml\n\nPLAY &#91;all] **********************************************************************************************************************************************************************************************************\n\nTASK &#91;Check available disk space] ***********************************************************************************************************************************************************************************\nchanged: &#91;192.168.0.51]\nchanged: &#91;192.168.0.52]\n\nTASK &#91;Show available disk space] ************************************************************************************************************************************************************************************\nok: &#91;192.168.0.51] =&gt; {\n    \"msg\": \"Available disk space:  9.6G\"\n}\nok: &#91;192.168.0.52] =&gt; {\n    \"msg\": \"Available disk space:  9.6G\"\n}\n\nTASK &#91;Check memory information] *************************************************************************************************************************************************************************************\nchanged: &#91;192.168.0.52]\nchanged: &#91;192.168.0.51]\n\nTASK &#91;Show full memory info] ****************************************************************************************************************************************************************************************\nok: &#91;192.168.0.51] =&gt; {\n    \"memory_info.stdout_lines\": &#91;\n        \"               total        used        free      shared  buff\/cache   available\",\n        \"Mem:            3659         825        2620          14         444        2834\",\n        \"Swap:           4095           0        4095\"\n    ]\n}\nok: &#91;192.168.0.52] =&gt; {\n    \"memory_info.stdout_lines\": &#91;\n        \"               total        used        free      shared  buff\/cache   available\",\n        \"Mem:            3659         840        2531          14         519        2819\",\n        \"Swap:           4095           0        4095\"\n    ]\n}\n\nTASK &#91;Show buffer\/cache memory] *************************************************************************************************************************************************************************************\nok: &#91;192.168.0.51] =&gt; {\n    \"msg\": \"Buffer\/Cache memory: 444 MB\"\n}\nok: &#91;192.168.0.52] =&gt; {\n    \"msg\": \"Buffer\/Cache memory: 519 MB\"\n}\n\nTASK &#91;Check CPU usage with sar (remove %iowait and %steal using sed)] ***********************************************************************************************************************************************\nchanged: &#91;192.168.0.51]\nchanged: &#91;192.168.0.52]\n\nTASK &#91;Show CPU usage (without %iowait and %steal)] ******************************************************************************************************************************************************************\nok: &#91;192.168.0.51] =&gt; {\n    \"msg\": \"\\n14\uc2dc 08\ubd84 07\ucd08     CPU     %user     %nice   %system   %iowait    %steal     %idle\\n14\uc2dc 08\ubd84 08\ucd08     all      0.00      0.00      0.00      0.00\\n\ud3c9\uade0\uac12:      all      0.00      0.00      0.00      0.00\"\n}\nok: &#91;192.168.0.52] =&gt; {\n    \"msg\": \"\\n14\uc2dc 08\ubd84 07\ucd08     CPU     %user     %nice   %system   %iowait    %steal     %idle\\n14\uc2dc 08\ubd84 08\ucd08     all      1.00      0.00      0.00      0.00\\n\ud3c9\uade0\uac12:      all      1.00      0.00      0.00      0.00\"\n}\n\nPLAY RECAP **********************************************************************************************************************************************************************************************************\n192.168.0.51               : ok=7    changed=3    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0\n192.168.0.52               : ok=7    changed=3    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-full\"><img fetchpriority=\"high\" decoding=\"async\" width=\"1706\" height=\"899\" src=\"https:\/\/wp.ssunmini.com\/wp-content\/uploads\/2024\/11\/image-8.png\" alt=\"\" class=\"wp-image-636\"\/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n<\/div><\/div>\n\n\n\n<div class=\"wp-block-esab-accordion-child\"><div class=\"esab__head\" role=\"button\" aria-expanded=\"false\"><div class=\"esab__heading_txt\"><p class=\"esab__heading_tag\">n8n \uc124\uce58\u00b7\uc6b4\uc601 \ub9e4\ub274\uc5bc<\/p><\/div><div class=\"esab__icon\"><div class=\"esab__collapse\"> <svg version=\"1.2\" viewBox=\"0 0 24 24\" width=\"24\" height=\"24\"><path fill-rule=\"evenodd\" d=\"m3.5 20.5c-4.7-4.7-4.7-12.3 0-17 4.7-4.7 12.3-4.7 17 0 4.6 4.7 4.6 12.3 0 17-4.7 4.6-12.3 4.6-17 0zm0.9-0.9c4.2 4.2 11 4.2 15.2 0 4.2-4.2 4.2-11 0-15.2-4.2-4.3-11-4.3-15.2 0-4.3 4.2-4.3 11 0 15.2z\"><\/path><path d=\"m11.4 15.9v-3.3h-3.3c-0.3 0-0.6-0.3-0.6-0.6 0-0.4 0.3-0.6 0.6-0.6h3.3v-3.3c0-0.3 0.3-0.6 0.6-0.6 0.3 0 0.6 0.3 0.6 0.6v3.3h3.3c0.3 0 0.6 0.2 0.6 0.6q0 0.2-0.2 0.4-0.2 0.2-0.4 0.2h-3.3v3.3q0 0.2-0.2 0.4-0.2 0.2-0.4 0.2c-0.4 0-0.6-0.3-0.6-0.6z\"><\/path><\/svg> <\/div><div class=\"esab__expand\"> <svg version=\"1.2\" viewBox=\"0 0 24 24\" width=\"24\" height=\"24\"><path fill-rule=\"evenodd\" d=\"m12 24c-6.6 0-12-5.4-12-12 0-6.6 5.4-12 12-12 6.6 0 12 5.4 12 12 0 6.6-5.4 12-12 12zm10.6-12c0-5.9-4.7-10.6-10.6-10.6-5.9 0-10.6 4.7-10.6 10.6 0 5.9 4.7 10.6 10.6 10.6 5.9 0 10.6-4.7 10.6-10.6z\"><\/path><path d=\"m5.6 11.3h12.8v1.4h-12.8z\"><\/path><\/svg> <\/div><\/div><\/div><div class=\"esab__body\">\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">1. \ud658\uacbd \uc815\ubcf4<\/h2>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>\ud56d\ubaa9<\/th><th>\uac12<\/th><\/tr><\/thead><tbody><tr><td>OS<\/td><td>Ubuntu<\/td><\/tr><tr><td>\uc11c\ubc84 IP<\/td><td><code>192.168.1.35<\/code><\/td><\/tr><tr><td>\uc0ac\uc6a9\uc790<\/td><td><code>root<\/code><\/td><\/tr><tr><td>\uc124\uce58 \uacbd\ub85c<\/td><td><code>\/home\/min\/download\/n8n\/<\/code><\/td><\/tr><tr><td>\uc2e4\ud589 \ubc29\uc2dd<\/td><td>Docker Compose<\/td><\/tr><tr><td>n8n \ud3ec\ud2b8<\/td><td><code>5678<\/code><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">2. \ub514\ub809\ud1a0\ub9ac \uad6c\uc870<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>\/home\/min\/download\/n8n\/\n\u251c\u2500\u2500 docker-compose.yml\n\u2514\u2500\u2500 n8n_data\/\n    \u251c\u2500\u2500 config\n    \u251c\u2500\u2500 workflows\n    \u251c\u2500\u2500 credentials\n    \u2514\u2500\u2500 database.sqlite\n<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>n8n_data<\/code> \u2192 <strong>\ub370\uc774\ud130 \uc601\uad6c \ubcf4\uc874 \ub514\ub809\ud1a0\ub9ac<\/strong><\/li>\n\n\n\n<li>\ucee8\ud14c\uc774\ub108 \uc0ad\uc81c\/\uc7ac\uc0dd\uc131\ud574\ub3c4 \ub370\uc774\ud130 \uc720\uc9c0\ub428<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">3. docker-compose.yml<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>version:\"3.8\"\n\nservices:\nn8n:\nimage:n8nio\/n8n:latest\ncontainer_name:n8n\nrestart:always\n\nports:\n-\"5678:5678\"\n\nenvironment:\nTZ:Asia\/Seoul\nN8N_HOST:192.168.1.35\nN8N_PORT:5678\nN8N_PROTOCOL:http\nNODE_ENV:production\nN8N_SECURE_COOKIE:\"false\"\n\nvolumes:\n-.\/n8n_data:\/home\/node\/.n8n\n<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\ub3c4\uba54\uc778 \uc8fc\uc18c \ub54c\ubb38\uc5d0 \ubcc0\uacbd<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>min@ubuntu-terraform:~\/download\/n8n$ cat docker-compose.yml\nversion: \"3.8\"\n\nservices:\n  n8n:\n    image: n8nio\/n8n:latest\n    container_name: n8n\n    restart: always\n\n    ports:\n      - \"5678:5678\"\n\n    environment:\n      TZ: Asia\/Seoul\n\n      N8N_HOST: n8n.ssunmini.com\n      N8N_PROTOCOL: http\n      N8N_PORT: 5678\n\n      N8N_EDITOR_BASE_URL: &lt;https:\/\/n8n.ssunmini.com>\n      WEBHOOK_URL: &lt;https:\/\/n8n.ssunmini.com>\n\n      N8N_TRUST_PROXY: \"true\"\n\n      NODE_ENV: production\n      N8N_SECURE_COOKIE: \"true\"\n\n    volumes:\n      - .\/n8n_data:\/home\/node\/.n8n\n<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">4. \uc2e4\ud589 \ubc29\ubc95<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">4.1 \ucd5c\ucd08 \uc2e4\ud589<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>cd \/home\/min\/download\/n8n\ndocker compose up -d<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">4.2 \uc2e4\ud589 \uc0c1\ud0dc \ud655\uc778<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>docker ps<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">4.3 \ub85c\uadf8 \ud655\uc778<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>docker logs -f n8n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\uc815\uc0c1 \ub85c\uadf8 \uc608\uc2dc<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Editor is now accessible via\n&lt;http:\/\/localhost:5678><\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">5. \uc6f9 \uc811\uc18d<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">\ube0c\ub77c\uc6b0\uc800\uc5d0\uc11c \uc811\uc18d<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>http:&#47;&#47;192.168.1.35:5678\nhttps:\/\/n8n.ssunmini.com<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">6. \uad8c\ud55c \uc774\uc288 \ubc0f \ud574\uacb0 \ubc29\ubc95<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">6.1 \ubc1c\uc0dd \uc5d0\ub7ec<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>Error: EACCES: permission denied, open '\/home\/node\/.n8n\/config'<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">6.2 \uc6d0\uc778<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li>n8n \ucee8\ud14c\uc774\ub108\ub294 <strong>node \uc0ac\uc6a9\uc790 (UID 1000)<\/strong> \ub85c \uc2e4\ud589<\/li>\n\n\n\n<li><code>n8n_data<\/code> \ub514\ub809\ud1a0\ub9ac\uac00 <strong>root \uc18c\uc720<\/strong><\/li>\n\n\n\n<li>node \uc0ac\uc6a9\uc790\uac00 \ud30c\uc77c \uc0dd\uc131\/\uc4f0\uae30 \ubd88\uac00<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">6.3 \ud574\uacb0 \uba85\ub839\uc5b4<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>docker compose down\n\nchown -R 1000:1000 \/home\/min\/download\/n8n\/n8n_data\nchmod -R 755 \/home\/min\/download\/n8n\/n8n_data\n\ndocker compose up -d<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">6.4 \uc815\uc0c1 \uc0c1\ud0dc \ud655\uc778<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>ls -l \/home\/min\/download\/n8n\/n8n_data<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\uc815\uc0c1 \uc608\uc2dc<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>node node database.sqlite\nnode node workflows\/\nnode node credentials\/<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">7. \uc6b4\uc601 \uba85\ub839\uc5b4 \uc815\ub9ac<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code># \uc911\uc9c0\ndocker compose down\n\n# \uc7ac\uc2dc\uc791\ndocker compose restart\n\n# \uc2e4\ud589\ndocker compose up -d\n\n# \ub85c\uadf8 \ud655\uc778\ndocker logs -f n8n\n\n# \uc774\ubbf8\uc9c0 \uc5c5\ub370\uc774\ud2b8\ndocker compose pull\ndocker compose up -d<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">8. \ub370\uc774\ud130 \ubc31\uc5c5<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">8.1 \ubc31\uc5c5 \ub300\uc0c1<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>\/home\/min\/download\/n8n\/n8n_data\/<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">8.2 \uac04\ub2e8 \ubc31\uc5c5 \uc608\uc2dc<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>tar czvf n8n_backup_$(date +%F).tar.gz n8n_data\/<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">9. \uc790\uc8fc \ubc1c\uc0dd\ud558\ub294 \ubb38\uc81c \uc694\uc57d<\/h2>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>\uc99d\uc0c1<\/th><th>\uc6d0\uc778<\/th><th>\ud574\uacb0<\/th><\/tr><\/thead><tbody><tr><td>EACCES \uc5d0\ub7ec<\/td><td>\ubcfc\ub968 \uad8c\ud55c<\/td><td><code>chown 1000:1000<\/code><\/td><\/tr><tr><td>\uc811\uc18d \ubd88\uac00<\/td><td>\ud3ec\ud2b8 \ucda9\ub3cc<\/td><td>5678 \uc0ac\uc6a9 \uc5ec\ubd80 \ud655\uc778<\/td><\/tr><tr><td>\ub370\uc774\ud130 \ucd08\uae30\ud654<\/td><td>\ubcfc\ub968 \ub204\ub77d<\/td><td><code>.\/n8n_data<\/code> \ud655\uc778<\/td><\/tr><tr><td>\ucfe0\ud0a4 \uc624\ub958<\/td><td>HTTPS \uc5c6\uc74c<\/td><td><code>N8N_SECURE_COOKIE=false<\/code><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<ul class=\"wp-block-list\">\n<li>n8n workflow \ub4f1\ub85d<\/li>\n<\/ul>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" width=\"1908\" height=\"891\" src=\"https:\/\/wp.ssunmini.com\/wp-content\/uploads\/2025\/12\/\uc2a4\ud06c\ub9b0\uc0f7-2025-12-31-204022.jpg\" alt=\"\" class=\"wp-image-1120\"\/><\/figure>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\ud544\uc694\ud55c API \ub4f1\ub85d<\/li>\n<\/ul>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" width=\"1575\" height=\"894\" src=\"https:\/\/wp.ssunmini.com\/wp-content\/uploads\/2025\/12\/\uc2a4\ud06c\ub9b0\uc0f7-2025-12-31-205221.png\" alt=\"\" class=\"wp-image-1122\"\/><\/figure>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Gpt, Claude, Gemini \ub4f1 \ud1b5\ud569\uc73c\ub85c \ucc44\ud305 \uc0ac\uc6a9<\/li>\n<\/ul>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1467\" height=\"805\" src=\"https:\/\/wp.ssunmini.com\/wp-content\/uploads\/2025\/12\/\uc2a4\ud06c\ub9b0\uc0f7-2025-12-31-205526.png\" alt=\"\" class=\"wp-image-1124\"\/><\/figure>\n<\/div><\/div>\n<\/div><\/div>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n","protected":false},"excerpt":{"rendered":"","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":5,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-567","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/wp.ssunmini.com\/index.php?rest_route=\/wp\/v2\/pages\/567","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wp.ssunmini.com\/index.php?rest_route=\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/wp.ssunmini.com\/index.php?rest_route=\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/wp.ssunmini.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/wp.ssunmini.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=567"}],"version-history":[{"count":15,"href":"https:\/\/wp.ssunmini.com\/index.php?rest_route=\/wp\/v2\/pages\/567\/revisions"}],"predecessor-version":[{"id":1125,"href":"https:\/\/wp.ssunmini.com\/index.php?rest_route=\/wp\/v2\/pages\/567\/revisions\/1125"}],"wp:attachment":[{"href":"https:\/\/wp.ssunmini.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=567"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}