blob: c7b7d7343577a007a14bf5db1ba0969b7429eccc [file] [log] [blame]
Zack Williamsa2763112017-01-03 11:38:38 -07001---
2# docker-install/tasks/main.yml
3# note - all tasks run with become to preserve the `ansible_user_id` var
4
5- name: Prereqs and SSL support for apt for SSL
6 become: yes
7 apt:
Zack Williams1396aa32017-06-06 10:28:29 -07008 name: "{{ item }}"
9 update_cache: yes
10 cache_valid_time: 3600
Zack Williamsa2763112017-01-03 11:38:38 -070011 with_items:
12 - apt-transport-https
13 - ca-certificates
14 - python-pip
15
16- name: Trust docker apt key
17 become: yes
18 apt_key:
19 data: "{{ lookup('file', 'docker_apt_key.gpg') }}"
20
21- name: Add docker apt repo
22 become: yes
23 apt_repository:
24 repo: "{{ docker_apt_repo }}"
25
26- name: Install docker
27 become: yes
28 apt:
Zack Williams0ab8f512017-06-29 08:41:51 -070029 name: "docker-ce=17.06.*"
Zack Williams1396aa32017-06-06 10:28:29 -070030 update_cache: yes
31 cache_valid_time: 3600
Zack Williamsa2763112017-01-03 11:38:38 -070032
Zack Williams0ab8f512017-06-29 08:41:51 -070033- name: Remove obsolete docker-py pip module
34 become: yes
35 pip:
36 name: docker-py
37 state: absent
38
39- name: Install pip modules for docker and docker-compose
Zack Williamsa2763112017-01-03 11:38:38 -070040 become: yes
41 pip:
42 name: "{{ item }}"
43 with_items:
Zack Williams0ab8f512017-06-29 08:41:51 -070044 - docker>=2.4.2
45 - docker-compose>=1.14.0
Zack Williamsa2763112017-01-03 11:38:38 -070046
47- name: Make current user part of the Docker group
48 become: yes
49 user:
50 name: "{{ ansible_user_id }}"
51 groups: "docker"
52 append: yes
53