olimp/roles/npm/tasks/main.yml
Administrator fade4e8a2f Update 2 files
- /roles/npm/tasks/main.yml
- /roles/heimdall/tasks/main.yml
2025-10-15 10:54:33 +00:00

65 lines
1.4 KiB
YAML

---
- name: Create directories for NPM
file:
path: "{{ item }}"
state: directory
mode: 0755
loop:
- "{{ npm_base_dir }}"
- "{{ npm_data_dir }}"
- "{{ npm_letsencrypt_dir }}"
- name: Deploy NPM docker-compose.yml
template:
src: docker-compose.yml.j2
dest: "{{ npm_base_dir }}/docker-compose.yml"
mode: 0644
- name: Pull NPM Docker images
shell: |
cd {{ npm_base_dir }}
docker compose pull
args:
executable: /bin/bash
- name: Start NPM container
shell: |
cd {{ npm_base_dir }}
docker compose up -d
args:
executable: /bin/bash
- name: Wait for NPM to start
pause:
seconds: 15
- name: Check NPM container status
shell: |
docker ps --filter name=npm --format "json"
register: npm_status
changed_when: false
- name: Show NPM status
debug:
msg: "NPM container: {{ npm_status.stdout }}"
- name: Verify NPM is running
shell: |
docker ps --filter name=npm --filter status=running --quiet | wc -l
register: npm_running
changed_when: false
- name: Show NPM running status
debug:
msg: "NPM is running: {{ npm_running.stdout | int > 0 }}"
- name: Check NPM logs
shell: |
cd {{ npm_base_dir }}
docker compose logs --tail=5
register: npm_logs
failed_when: false
- name: Show NPM logs
debug:
msg: "NPM logs: {{ npm_logs.stdout }}"