blob: fac17d8fe07921198c9eae1801b3e359e1532a00 [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 Williamsbf43d752017-07-01 15:27:11 -070033- name: Install docker-compose, docker python module, imagebuilder deps via pip
Zack Williamsa2763112017-01-03 11:38:38 -070034 become: yes
35 pip:
36 name: "{{ item }}"
37 with_items:
Zack Williams0ab8f512017-06-29 08:41:51 -070038 - docker>=2.4.2
39 - docker-compose>=1.14.0
Zack Williamsbf43d752017-07-01 15:27:11 -070040 - gitpython
41 - graphviz
Zack Williamsa2763112017-01-03 11:38:38 -070042
43- name: Make current user part of the Docker group
44 become: yes
45 user:
46 name: "{{ ansible_user_id }}"
47 groups: "docker"
48 append: yes
49
Zack Williamsbf43d752017-07-01 15:27:11 -070050# Doesn't work right now, but reported: https://github.com/ansible/ansible/issues/24794
51# see also http://docs.ansible.com/ansible/intro_configuration.html#openssh-specific-settings
52- name: Reset ssh connection so user gains docker group membership
53 meta: reset_connection
54