Skip to content

Commit

Permalink
Split repo tasks to independent file (#23)
Browse files Browse the repository at this point in the history
  • Loading branch information
teddyphreak authored Dec 16, 2023
1 parent 045a897 commit 77a7d58
Show file tree
Hide file tree
Showing 3 changed files with 74 additions and 68 deletions.
2 changes: 2 additions & 0 deletions .talismanrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
fileignoreconfig:
- filename: poetry.lock
ignore_detectors: [ filecontent ]
- filename: tasks/repo.yml
ignore_detectors: [ filecontent ]
72 changes: 4 additions & 68 deletions tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,79 +1,15 @@
---
- name: Configure Docker repository
ansible.builtin.include_tasks: repo.yml
tags: install

- name: Remove incompatible packages
ansible.builtin.package:
name: "{{ docker_remove_packages }}"
state: absent
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:
Expand Down
68 changes: 68 additions & 0 deletions tasks/repo.yml
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 77a7d58

Please sign in to comment.