Update file main.yml

This commit is contained in:
Administrator 2025-11-20 11:34:30 +00:00
parent f71efd6a8d
commit 3dd4e1c37f

View File

@ -17,6 +17,17 @@
- "{{ cadvisor_config_dir }}"
become: yes
- name: Check if any container is using port {{ cadvisor_port }}
shell: |
docker ps --format "table {{.Names}}\t{{.Ports}}" | grep {{ cadvisor_port }} || true
register: port_usage
become: no
- name: Fail if port {{ cadvisor_port }} is in use
fail:
msg: "Port {{ cadvisor_port }} is already in use by another container"
when: port_usage.stdout != ""
- name: Deploy cAdvisor docker-compose
template:
src: docker-compose.yml.j2