Zack Williams | a276311 | 2017-01-03 11:38:38 -0700 | [diff] [blame] | 1 | --- |
| 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 Williams | 1396aa3 | 2017-06-06 10:28:29 -0700 | [diff] [blame] | 8 | name: "{{ item }}" |
| 9 | update_cache: yes |
| 10 | cache_valid_time: 3600 |
Zack Williams | a276311 | 2017-01-03 11:38:38 -0700 | [diff] [blame] | 11 | 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 Williams | 0ab8f51 | 2017-06-29 08:41:51 -0700 | [diff] [blame] | 29 | name: "docker-ce=17.06.*" |
Zack Williams | 1396aa3 | 2017-06-06 10:28:29 -0700 | [diff] [blame] | 30 | update_cache: yes |
| 31 | cache_valid_time: 3600 |
Zack Williams | a276311 | 2017-01-03 11:38:38 -0700 | [diff] [blame] | 32 | |
Zack Williams | bf43d75 | 2017-07-01 15:27:11 -0700 | [diff] [blame] | 33 | - name: Install docker-compose, docker python module, imagebuilder deps via pip |
Zack Williams | a276311 | 2017-01-03 11:38:38 -0700 | [diff] [blame] | 34 | become: yes |
| 35 | pip: |
| 36 | name: "{{ item }}" |
| 37 | with_items: |
Zack Williams | 0ab8f51 | 2017-06-29 08:41:51 -0700 | [diff] [blame] | 38 | - docker>=2.4.2 |
| 39 | - docker-compose>=1.14.0 |
Zack Williams | bf43d75 | 2017-07-01 15:27:11 -0700 | [diff] [blame] | 40 | - gitpython |
| 41 | - graphviz |
Zack Williams | a276311 | 2017-01-03 11:38:38 -0700 | [diff] [blame] | 42 | |
| 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 Williams | bf43d75 | 2017-07-01 15:27:11 -0700 | [diff] [blame] | 50 | # 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 | |