ansible/roles/docker/tasks/setup_repo_linux_mint.yml
ilia 83a5d988af
Some checks failed
CI / lint-and-test (pull_request) Successful in 58s
CI / ansible-validation (pull_request) Successful in 2m17s
CI / secret-scanning (pull_request) Successful in 53s
CI / dependency-scan (pull_request) Successful in 57s
CI / sast-scan (pull_request) Successful in 2m17s
CI / license-check (pull_request) Successful in 55s
CI / vault-check (pull_request) Successful in 2m20s
CI / playbook-test (pull_request) Successful in 2m16s
CI / container-scan (pull_request) Successful in 1m25s
CI / sonar-analysis (pull_request) Failing after 1m56s
CI / workflow-summary (pull_request) Successful in 50s
Fix: Update ansible-lint configuration to exclude specific paths and skip certain rules for improved linting flexibility
2025-12-14 21:04:45 -05:00

37 lines
1.4 KiB
YAML

---
- name: Set Ubuntu codename for Linux Mint
ansible.builtin.set_fact:
docker_ubuntu_codename: >
{{ 'jammy' if ansible_distribution_version is version('22', '>=') else
'focal' if ansible_distribution_version is version('21', '>=') else
'focal' if ansible_distribution_version is version('20', '>=') else
'bionic' }}
- 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/ubuntu" /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
changed_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 Linux Mint (using Ubuntu base) only if needed
ansible.builtin.apt_repository:
repo: "deb [arch=amd64 signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu {{ docker_ubuntu_codename }} stable"
state: present
update_cache: true
when: docker_repo_check.stdout in ["not_exists", "wrong_config"]