diff --git a/.talismanrc b/.talismanrc index 38c272b..b90f252 100644 --- a/.talismanrc +++ b/.talismanrc @@ -1,3 +1,5 @@ fileignoreconfig: - filename: poetry.lock ignore_detectors: [ filecontent ] + - filename: tasks/repo.yml + ignore_detectors: [ filecontent ] diff --git a/tasks/main.yml b/tasks/main.yml index a45e49c..b7011ed 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -1,4 +1,8 @@ --- +- name: Configure Docker repository + ansible.builtin.include_tasks: repo.yml + tags: install + - name: Remove incompatible packages ansible.builtin.package: name: "{{ docker_remove_packages }}" @@ -6,74 +10,6 @@ when: docker_remove_packages is defined tags: install -- name: Configure apt repository - when: - - ansible_os_family == "Debian" - - docker_repo_manage - tags: install - block: - - - name: Install Debian package helpers - ansible.builtin.package: - name: - - apt-transport-https - - ca-certificates - - python3-docker - - python3-pip - - curl - - - name: Install apt key - ansible.builtin.apt_key: - keyserver: "{{ docker_deb_repo.keyserver }}" - state: present - id: "{{ docker_deb_repo.key }}" - ignore_errors: true - register: apt_key_module - - - name: Force install apt key - ansible.builtin.shell: | - curl -fsSL {{ docker_deb_repo.keyserver }} | sudo apt-key add - - when: apt_key_module.failed - tags: skip_ansible_lint - - - name: Install apt repository - ansible.builtin.apt_repository: - repo: "{{ docker_deb_repo.url }}" - state: "{{ docker_repo_state }}" - filename: docker - validate_certs: no - -- name: Configure yum repository - when: - - ansible_os_family == "RedHat" - - docker_repo_manage - tags: install - block: - - - name: Install epel repository - ansible.builtin.package: - name: epel-release - - - name: Install RedHat package helpers - ansible.builtin.package: - name: - - python3-pip - - python3-docker - - - name: Install yum repository - ansible.builtin.get_url: - url: "{{ docker_rpm_repo.url }}" - dest: /etc/yum.repos.d/docker.repo - mode: 0644 - - - name: Remove yum repository - ansible.builtin.file: - dest: /etc/yum.repos.d/docker.repo - state: absent - -- name: Flush handlers - ansible.builtin.meta: flush_handlers - - name: Release package holds ansible.builtin.include_tasks: lock.yml vars: diff --git a/tasks/repo.yml b/tasks/repo.yml new file mode 100644 index 0000000..b2679f3 --- /dev/null +++ b/tasks/repo.yml @@ -0,0 +1,68 @@ +--- +- name: Configure apt repository + when: + - ansible_os_family == "Debian" + - docker_repo_manage + tags: install + block: + + - name: Install Debian package helpers + ansible.builtin.package: + name: + - apt-transport-https + - ca-certificates + - python3-docker + - python3-pip + - curl + + - name: Install apt key + ansible.builtin.apt_key: + keyserver: "{{ docker_deb_repo.keyserver }}" + state: present + id: "{{ docker_deb_repo.key }}" + ignore_errors: true + register: apt_key_module + + - name: Force install apt key + ansible.builtin.shell: | + curl -fsSL {{ docker_deb_repo.keyserver }} | sudo apt-key add - + when: apt_key_module.failed + tags: skip_ansible_lint + + - name: Install apt repository + ansible.builtin.apt_repository: + repo: "{{ docker_deb_repo.url }}" + state: "{{ docker_repo_state }}" + filename: docker + validate_certs: no + +- name: Configure yum repository + when: + - ansible_os_family == "RedHat" + - docker_repo_manage + tags: install + block: + + - name: Install epel repository + ansible.builtin.package: + name: epel-release + + - name: Install RedHat package helpers + ansible.builtin.package: + name: + - python3-pip + - python3-docker + + - name: Install yum repository + ansible.builtin.get_url: + url: "{{ docker_rpm_repo.url }}" + dest: /etc/yum.repos.d/docker.repo + mode: 0644 + + - name: Remove yum repository + ansible.builtin.file: + dest: /etc/yum.repos.d/docker.repo + state: absent + +- name: Flush handlers + ansible.builtin.meta: flush_handlers