aboutsummaryrefslogtreecommitdiffstats
path: root/deployment/noheat/cluster-rke/ansible/roles/setup_docker/tasks/packages.yml
blob: 814dd285a0cfac39fb22e74076f80cdc3364e56f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
---
- name: Install deps
  apt:
    name: "{{ item }}"
    state: present
  with_items:
    - apt-transport-https
    - ca-certificates
    - curl
    - software-properties-common

- name: Add Docker repo key
  apt_key:
    url: "https://download.docker.com/linux/{{ ansible_distribution | lower }}/gpg"
    state: present

- name: Add Docker repo
  apt_repository:
    repo: "deb https://download.docker.com/linux/{{ ansible_distribution | lower }} {{ ansible_distribution_release | lower }} stable"
    state: present
    update_cache: yes

- name: Find exact Docker version
  shell: "set -o pipefail && apt-cache madison docker-ce | grep {{ docker_version }} | head -n 1 | cut -d ' ' -f 4"
  args:
    executable: "/bin/bash"
  register: docker_pkg_version
  changed_when: false

- name: install Docker
  apt:
    name: "{{ item }}"
    state: present
    allow_downgrade: true
  with_items:
    - "docker-ce={{ docker_pkg_version.stdout }}"
    - "docker-ce-cli={{ docker_pkg_version.stdout }}"

- name: Lock docker version
  command: apt-mark hold docker-ce docker-ce-cli
  changed_when: false