Zack Williams | 642388d | 2017-04-12 22:39:15 -0700 | [diff] [blame^] | 1 | --- |
| 2 | |
| 3 | - name: Prereqs and SSL support for apt for SSL |
David K. Bainbridge | 317e7d7 | 2016-05-11 08:31:44 -0700 | [diff] [blame] | 4 | become: yes |
Zack Williams | 642388d | 2017-04-12 22:39:15 -0700 | [diff] [blame^] | 5 | apt: |
| 6 | name: "{{ item }}" |
| 7 | update_cache: yes |
| 8 | cache_valid_time: 3600 |
David K. Bainbridge | 317e7d7 | 2016-05-11 08:31:44 -0700 | [diff] [blame] | 9 | with_items: |
Zack Williams | 642388d | 2017-04-12 22:39:15 -0700 | [diff] [blame^] | 10 | - apt-transport-https |
| 11 | - ca-certificates |
| 12 | - python-pip |
David K. Bainbridge | 317e7d7 | 2016-05-11 08:31:44 -0700 | [diff] [blame] | 13 | |
| 14 | - name: Docker Apt Key |
| 15 | become: yes |
| 16 | apt_key: |
Zack Williams | 642388d | 2017-04-12 22:39:15 -0700 | [diff] [blame^] | 17 | data: "{{ lookup('file', 'docker_apt_key.gpg') }}" |
David K. Bainbridge | 317e7d7 | 2016-05-11 08:31:44 -0700 | [diff] [blame] | 18 | |
| 19 | - name: Docker repository |
| 20 | become: yes |
| 21 | apt_repository: |
Zack Williams | 642388d | 2017-04-12 22:39:15 -0700 | [diff] [blame^] | 22 | repo: "{{ docker_apt_repo }}" |
David K. Bainbridge | 317e7d7 | 2016-05-11 08:31:44 -0700 | [diff] [blame] | 23 | |
Zack Williams | 642388d | 2017-04-12 22:39:15 -0700 | [diff] [blame^] | 24 | - name: Install docker engine |
David K. Bainbridge | 317e7d7 | 2016-05-11 08:31:44 -0700 | [diff] [blame] | 25 | become: yes |
| 26 | apt: |
David K. Bainbridge | 17248c0 | 2016-08-29 17:04:34 -0700 | [diff] [blame] | 27 | name: docker-engine=1.12* |
David K. Bainbridge | 317e7d7 | 2016-05-11 08:31:44 -0700 | [diff] [blame] | 28 | force: yes |
Zack Williams | 642388d | 2017-04-12 22:39:15 -0700 | [diff] [blame^] | 29 | update_cache: yes |
| 30 | cache_valid_time: 3600 |
David K. Bainbridge | 317e7d7 | 2016-05-11 08:31:44 -0700 | [diff] [blame] | 31 | |
David K. Bainbridge | f62e70d | 2016-06-13 17:23:01 -0700 | [diff] [blame] | 32 | - name: Docker Exposed via TCP |
David K. Bainbridge | 2a80422 | 2016-05-16 12:36:32 -0700 | [diff] [blame] | 33 | become: yes |
| 34 | lineinfile: |
| 35 | dest=/etc/default/docker |
| 36 | state=present |
| 37 | insertafter='#DOCKER_OPTS' |
David K. Bainbridge | 8b17904 | 2016-11-30 15:38:42 -0800 | [diff] [blame] | 38 | line='DOCKER_OPTS="-H unix:///var/run/docker.sock"' |
David K. Bainbridge | 2a80422 | 2016-05-16 12:36:32 -0700 | [diff] [blame] | 39 | 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 Williams | 642388d | 2017-04-12 22:39:15 -0700 | [diff] [blame^] | 48 | # 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. Bainbridge | 2a80422 | 2016-05-16 12:36:32 -0700 | [diff] [blame] | 58 | become: yes |
| 59 | user: |
Zack Williams | 642388d | 2017-04-12 22:39:15 -0700 | [diff] [blame^] | 60 | name: "{{ ansible_user_id }}" |
| 61 | groups: "docker" |
| 62 | append: yes |
David K. Bainbridge | 2a80422 | 2016-05-16 12:36:32 -0700 | [diff] [blame] | 63 | |