system-config/playbooks/roles/install-docker/tasks/upstream.yaml

62 lines
1.3 KiB
YAML

- name: Install pre-reqs
package:
name: "{{ item }}"
state: present
with_items:
- apt-transport-https
- ca-certificates
- curl
- software-properties-common
- apparmor
become: yes
- name: Ensure /etc/apt/keyrings exists
file:
path: /etc/apt/keyrings
state: directory
owner: root
group: root
mode: '0755'
- name: Add docker GPG key
become: yes
copy:
src: docker.gpg.asc
dest: /etc/apt/keyrings/docker.gpg.asc
owner: root
group: root
mode: 0644
register: _update_docker_key
# NOTE(ianw): 2022-02-07 : we can remove this after a run that has
# removed the deprecated key.
- name: Remove old key to stop deprecation warnings
become: yes
when: _update_docker_key.changed
command: 'apt-key del "9DC8 5822 9FC7 DD38 854A E2D8 8D81 803C 0EBF CD88"'
- name: Ensure /etc/apt/sources.list.d exists
file:
path: /etc/apt/sources.list.d
state: directory
owner: root
group: root
mode: '0755'
# TODO(mordred) We should add a proxy cache mirror for this
- name: Add docker apt repo
become: yes
template:
dest: /etc/apt/sources.list.d/docker.list
group: root
mode: 0644
owner: root
src: sources.list.j2
- name: Install docker
become: yes
apt:
name: docker-ce
state: present
update_cache: yes