Обновить ansible/npm-setup.yml

This commit is contained in:
2026-05-22 13:39:56 +03:00
parent 810946c758
commit 7f6fe16a58
+20 -17
View File
@@ -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 - name: Setup Minimal Linux with Docker and Nginx Proxy Manager
hosts: all hosts: npm_servers
become: yes become: yes
gather_facts: yes
tasks: tasks:
- name: Update apt cache and install prerequisites - name: Update apt cache and install prerequisites
apt: apt:
name: name: ['apt-transport-https', 'ca-certificates', 'curl', 'gnupg', 'lsb-release']
- apt-transport-https
- ca-certificates
- curl
- gnupg
- lsb-release
state: present state: present
update_cache: yes update_cache: yes
@@ -26,11 +35,7 @@
- name: Install Docker and Docker Compose Plugin - name: Install Docker and Docker Compose Plugin
apt: apt:
name: name: ['docker-ce', 'docker-ce-cli', 'containerd.io', 'docker-compose-plugin']
- docker-ce
- docker-ce-cli
- containerd.io
- docker-compose-plugin
state: present state: present
update_cache: yes update_cache: yes
@@ -44,8 +49,6 @@
file: file:
path: /opt/npm path: /opt/npm
state: directory state: directory
owner: root
group: root
mode: '0755' mode: '0755'
- name: Create docker-compose.yml for NPM - name: Create docker-compose.yml for NPM
@@ -58,9 +61,9 @@
image: 'jc21/nginx-proxy-manager:latest' image: 'jc21/nginx-proxy-manager:latest'
restart: unless-stopped restart: unless-stopped
ports: ports:
- '80:80' # Public HTTP Port - '80:80'
- '81:81' # Admin Web Port - '81:81'
- '443:443' # Public HTTPS Port - '443:443'
volumes: volumes:
- ./data:/data - ./data:/data
- ./letsencrypt:/etc/letsencrypt - ./letsencrypt:/etc/letsencrypt