ansible-collection-kolla/roles/docker/tasks/repo-Debian.yml
Michal Nasiadka c4a1dcd3c7 Adapt code in preparation for ansible-lint bump
Rename True/False to true/false
Fix permissions values

Change-Id: I75be15fd24aeedf54bb22b9744bc0ee498a62645
2024-10-09 11:27:12 +02:00

71 lines
1.6 KiB
YAML

---
- name: Install CA certificates and gnupg packages
apt:
name:
- ca-certificates
- gnupg
cache_valid_time: "{{ apt_cache_valid_time }}"
update_cache: true
state: present
become: true
- name: Ensure apt sources list directory exists
file:
path: /etc/apt/sources.list.d
state: directory
recurse: true
become: true
- name: Ensure apt keyrings directory exists
file:
path: /etc/apt/keyrings
state: directory
recurse: true
become: true
- name: Install docker apt gpg key
get_url:
url: "{{ docker_apt_url }}/{{ docker_apt_key_file }}"
dest: "/etc/apt/keyrings/docker.asc"
mode: "0644"
force: true
become: true
- name: Install docker apt pin
copy:
dest: "/etc/apt/preferences.d/docker"
content: |
Package: {{ docker_apt_package }}
Pin: version {{ docker_apt_package_pin }}
Pin-Priority: 1000
mode: "0644"
become: true
when: docker_apt_package_pin | length > 0
- name: Ensure old docker repository absent
file:
path: /etc/apt/sources.list.d/docker.list
state: absent
become: true
# TODO(mmalchuk): replace with ansible.builtin.deb822_repository module
# when all stable releases moves to the ansible-core >= 2.15
- name: Enable docker apt repository
copy:
dest: /etc/apt/sources.list.d/docker.sources
content: |
# Ansible managed
Types: deb
URIs: {{ docker_apt_url }}
Suites: {{ ansible_facts.distribution_release }}
Components: stable
Signed-by: /etc/apt/keyrings/docker.asc
mode: "0644"
become: true
- name: Update the apt cache
apt:
update_cache: true
become: true