ansible/roles/docker/tasks/setup_repo_debian.yml
ilia e05b3aa0d5 Update ansible.cfg and auto-fallback script for improved connectivity handling
- Modify ansible.cfg to increase SSH connection retries from 2 to 3 and add a connection timeout setting for better reliability.
- Enhance auto-fallback.sh script to provide detailed feedback during IP connectivity tests, including clearer status messages for primary and fallback IP checks.
- Update documentation to reflect changes in connectivity testing and fallback procedures.

These updates improve the robustness of the connectivity testing process and ensure smoother operations during IP failover scenarios.
2025-09-16 23:00:32 -04:00

29 lines
1.0 KiB
YAML

---
- name: Check if Docker repository exists and is correct
ansible.builtin.shell: |
if [ -f /etc/apt/sources.list.d/docker.list ]; then
if grep -q "deb \[arch=amd64 signed-by=/etc/apt/keyrings/docker.gpg\] https://download.docker.com/linux/debian" /etc/apt/sources.list.d/docker.list; then
echo "correct_config"
else
echo "wrong_config"
fi
else
echo "not_exists"
fi
register: docker_repo_check
failed_when: false
- name: Remove incorrect Docker repository
ansible.builtin.file:
path: /etc/apt/sources.list.d/docker.list
state: absent
become: true
when: docker_repo_check.stdout == "wrong_config"
- name: Add Docker repository for Debian only if needed
ansible.builtin.apt_repository:
repo: "deb [arch=amd64 signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/debian {{ ansible_distribution_release }} stable"
state: present
update_cache: true
when: docker_repo_check.stdout in ["not_exists", "wrong_config"]