From 7f6fe16a5893833851b67ff6582756f7e72e7806 Mon Sep 17 00:00:00 2001 From: ogrechko Date: Fri, 22 May 2026 13:39:56 +0300 Subject: [PATCH] =?UTF-8?q?=D0=9E=D0=B1=D0=BD=D0=BE=D0=B2=D0=B8=D1=82?= =?UTF-8?q?=D1=8C=20ansible/npm-setup.yml?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ansible/npm-setup.yml | 37 ++++++++++++++++++++----------------- 1 file changed, 20 insertions(+), 17 deletions(-) diff --git a/ansible/npm-setup.yml b/ansible/npm-setup.yml index b1093ba..e4a7afe 100644 --- a/ansible/npm-setup.yml +++ b/ansible/npm-setup.yml @@ -1,16 +1,25 @@ --- +# 1. Динамическое добавление машины в инвентарь +- name: Add dynamically provisioned host + hosts: localhost + gather_facts: no + tasks: + - name: Add new VM IP to inventory + add_host: + name: "{{ vm_ip }}" + groups: npm_servers + ansible_user: debian # Замените на логин вашего шаблона + ansible_ssh_common_args: '-o StrictHostKeyChecking=no' + +# 2. Основная настройка NPM - name: Setup Minimal Linux with Docker and Nginx Proxy Manager - hosts: all + hosts: npm_servers become: yes + gather_facts: yes tasks: - name: Update apt cache and install prerequisites apt: - name: - - apt-transport-https - - ca-certificates - - curl - - gnupg - - lsb-release + name: ['apt-transport-https', 'ca-certificates', 'curl', 'gnupg', 'lsb-release'] state: present update_cache: yes @@ -26,11 +35,7 @@ - name: Install Docker and Docker Compose Plugin apt: - name: - - docker-ce - - docker-ce-cli - - containerd.io - - docker-compose-plugin + name: ['docker-ce', 'docker-ce-cli', 'containerd.io', 'docker-compose-plugin'] state: present update_cache: yes @@ -44,8 +49,6 @@ file: path: /opt/npm state: directory - owner: root - group: root mode: '0755' - name: Create docker-compose.yml for NPM @@ -58,9 +61,9 @@ image: 'jc21/nginx-proxy-manager:latest' restart: unless-stopped ports: - - '80:80' # Public HTTP Port - - '81:81' # Admin Web Port - - '443:443' # Public HTTPS Port + - '80:80' + - '81:81' + - '443:443' volumes: - ./data:/data - ./letsencrypt:/etc/letsencrypt