blob: ce0e90b5d20e5825985b4c18a1a789b003c6d2b5 [file] [log] [blame]
Zack Williams4d09b3b2017-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 Williams4d09b3b2017-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 Williams4d09b3b2017-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 Williams4d09b3b2017-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 Williams4d09b3b2017-04-12 22:39:15 -070022 repo: "{{ docker_apt_repo }}"
David K. Bainbridge317e7d72016-05-11 08:31:44 -070023
Zack Williams4d09b3b2017-04-12 22:39:15 -070024- name: Install docker engine
David K. Bainbridge317e7d72016-05-11 08:31:44 -070025 become: yes
26 apt:
David K. Bainbridge17248c02016-08-29 17:04:34 -070027 name: docker-engine=1.12*
David K. Bainbridge317e7d72016-05-11 08:31:44 -070028 force: yes
Zack Williams4d09b3b2017-04-12 22:39:15 -070029 update_cache: yes
30 cache_valid_time: 3600
David K. Bainbridge317e7d72016-05-11 08:31:44 -070031
David K. Bainbridgef62e70d2016-06-13 17:23:01 -070032- name: Docker Exposed via TCP
David K. Bainbridge2a804222016-05-16 12:36:32 -070033 become: yes
34 lineinfile:
35 dest=/etc/default/docker
36 state=present
37 insertafter='#DOCKER_OPTS'
David K. Bainbridge8b179042016-11-30 15:38:42 -080038 line='DOCKER_OPTS="-H unix:///var/run/docker.sock"'
David K. Bainbridge2a804222016-05-16 12:36:32 -070039 register: docker_config
40
41- name: Docker Restart
42 become: yes
43 service:
44 name=docker
45 state=restarted
46 when: docker_config.changed
47
Zack Williams4d09b3b2017-04-12 22:39:15 -070048# docker fails without docker-py, docker-compose >1.9 fails with docker-py installed
49- name: Install docker-compose and docker-py
50 become: yes
51 pip:
52 name: "{{ item }}"
53 with_items:
54 - docker-py
55 - docker-compose==1.9
56
57- name: Make current user part of the Docker group
David K. Bainbridge2a804222016-05-16 12:36:32 -070058 become: yes
59 user:
Zack Williams4d09b3b2017-04-12 22:39:15 -070060 name: "{{ ansible_user_id }}"
61 groups: "docker"
62 append: yes
David K. Bainbridge2a804222016-05-16 12:36:32 -070063