aboutsummaryrefslogtreecommitdiffstats
path: root/ansible/roles/docker/tasks/main.yml
blob: 813b5ac440bbc009831e16258560b2aa2407637e (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
---

- name: add https support
  apt:
    name: "{{ item }}"
    cache_valid_time: 3600
    update_cache: yes
  with_items:
    - apt-transport-https
    - gnupg
    - cron

- name: add docker gpg key to apt keyring
  apt_key:
    id: 9DC858229FC7DD38854AE2D88D81803C0EBFCD88
    url: https://download.docker.com/linux/debian/gpg

- apt_repository:
    repo: "deb https://download.docker.com/linux/debian {{ ansible_distribution_release }} stable"
    state: present
    update_cache: yes
  when: ansible_distribution == "Debian"

- name: install docker
  apt:
    name: docker-ce

- name: add jenkins to the docker group
  user:
    name: "{{ jenkins_user }}"
    groups: docker
    append: yes

- name: cleanup old docker images
  cron:
    name: cleanup-docker-images
    minute: 0
    hour: '*/3'
    user: "{{ jenkins_user }}"
    job: "test -x /home/{{ jenkins_user }}/osmo-ci/scripts/docker-cleanup.sh && /home/{{ jenkins_user }}/osmo-ci/scripts/docker-cleanup.sh >/dev/null"