blob: ba3a6f54a00baec90f54bf6f2d4e5106f246f67c [file] [log] [blame]
Zack Williams642388d2017-04-12 22:39:15 -07001---
2
3- name: Prereqs and SSL support for apt for SSL
David K. Bainbridge317e7d72016-05-11 08:31:44 -07004 become: yes
Zack Williams642388d2017-04-12 22:39:15 -07005 apt:
6 name: "{{ item }}"
7 update_cache: yes
8 cache_valid_time: 3600
David K. Bainbridge317e7d72016-05-11 08:31:44 -07009 with_items:
Zack Williams642388d2017-04-12 22:39:15 -070010 - apt-transport-https
11 - ca-certificates
12 - python-pip
David K. Bainbridge317e7d72016-05-11 08:31:44 -070013
14- name: Docker Apt Key
15 become: yes
16 apt_key:
Zack Williams642388d2017-04-12 22:39:15 -070017 data: "{{ lookup('file', 'docker_apt_key.gpg') }}"
David K. Bainbridge317e7d72016-05-11 08:31:44 -070018
19- name: Docker repository
20 become: yes
21 apt_repository:
Zack Williams642388d2017-04-12 22:39:15 -070022 repo: "{{ docker_apt_repo }}"
David K. Bainbridge317e7d72016-05-11 08:31:44 -070023
Zack Williams6fe46372017-06-29 08:30:21 -070024- name: Install docker-ce
David K. Bainbridge317e7d72016-05-11 08:31:44 -070025 become: yes
26 apt:
Zack Williams6fe46372017-06-29 08:30:21 -070027 name: "docker-ce=17.06.*"
Zack Williams642388d2017-04-12 22:39:15 -070028 update_cache: yes
29 cache_valid_time: 3600
David K. Bainbridge317e7d72016-05-11 08:31:44 -070030
David K. Bainbridgef62e70d2016-06-13 17:23:01 -070031- name: Docker Exposed via TCP
David K. Bainbridge2a804222016-05-16 12:36:32 -070032 become: yes
33 lineinfile:
34 dest=/etc/default/docker
35 state=present
36 insertafter='#DOCKER_OPTS'
David K. Bainbridge8b179042016-11-30 15:38:42 -080037 line='DOCKER_OPTS="-H unix:///var/run/docker.sock"'
David K. Bainbridge2a804222016-05-16 12:36:32 -070038 register: docker_config
39
40- name: Docker Restart
41 become: yes
42 service:
43 name=docker
44 state=restarted
45 when: docker_config.changed
46
Zack Williams642388d2017-04-12 22:39:15 -070047# docker fails without docker-py, docker-compose >1.9 fails with docker-py installed
48- name: Install docker-compose and docker-py
49 become: yes
50 pip:
51 name: "{{ item }}"
52 with_items:
Zack Williams6fe46372017-06-29 08:30:21 -070053 - "docker==2.4.2"
54 - "docker-compose==1.14.0"
Zack Williams642388d2017-04-12 22:39:15 -070055
56- name: Make current user part of the Docker group
David K. Bainbridge2a804222016-05-16 12:36:32 -070057 become: yes
58 user:
Zack Williams642388d2017-04-12 22:39:15 -070059 name: "{{ ansible_user_id }}"
60 groups: "docker"
61 append: yes
David K. Bainbridge2a804222016-05-16 12:36:32 -070062