Matteo Scandolo | 3896c47 | 2017-08-01 13:31:42 -0700 | [diff] [blame] | 1 | |
| 2 | # Copyright 2017-present Open Networking Foundation |
| 3 | # |
| 4 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | # you may not use this file except in compliance with the License. |
| 6 | # You may obtain a copy of the License at |
| 7 | # |
| 8 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | # |
| 10 | # Unless required by applicable law or agreed to in writing, software |
| 11 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | # See the License for the specific language governing permissions and |
| 14 | # limitations under the License. |
| 15 | |
| 16 | |
Zack Williams | a276311 | 2017-01-03 11:38:38 -0700 | [diff] [blame] | 17 | --- |
| 18 | # docker-install/tasks/main.yml |
| 19 | # note - all tasks run with become to preserve the `ansible_user_id` var |
| 20 | |
| 21 | - name: Prereqs and SSL support for apt for SSL |
| 22 | become: yes |
| 23 | apt: |
Zack Williams | 1396aa3 | 2017-06-06 10:28:29 -0700 | [diff] [blame] | 24 | name: "{{ item }}" |
| 25 | update_cache: yes |
| 26 | cache_valid_time: 3600 |
Zack Williams | a276311 | 2017-01-03 11:38:38 -0700 | [diff] [blame] | 27 | with_items: |
| 28 | - apt-transport-https |
| 29 | - ca-certificates |
| 30 | - python-pip |
| 31 | |
| 32 | - name: Trust docker apt key |
| 33 | become: yes |
| 34 | apt_key: |
| 35 | data: "{{ lookup('file', 'docker_apt_key.gpg') }}" |
| 36 | |
| 37 | - name: Add docker apt repo |
| 38 | become: yes |
| 39 | apt_repository: |
| 40 | repo: "{{ docker_apt_repo }}" |
| 41 | |
| 42 | - name: Install docker |
| 43 | become: yes |
| 44 | apt: |
Zack Williams | 0ab8f51 | 2017-06-29 08:41:51 -0700 | [diff] [blame] | 45 | name: "docker-ce=17.06.*" |
Zack Williams | 1396aa3 | 2017-06-06 10:28:29 -0700 | [diff] [blame] | 46 | update_cache: yes |
| 47 | cache_valid_time: 3600 |
Zack Williams | a276311 | 2017-01-03 11:38:38 -0700 | [diff] [blame] | 48 | |
Zack Williams | bf43d75 | 2017-07-01 15:27:11 -0700 | [diff] [blame] | 49 | - name: Install docker-compose, docker python module, imagebuilder deps via pip |
Zack Williams | a276311 | 2017-01-03 11:38:38 -0700 | [diff] [blame] | 50 | become: yes |
| 51 | pip: |
| 52 | name: "{{ item }}" |
| 53 | with_items: |
Zack Williams | 0ab8f51 | 2017-06-29 08:41:51 -0700 | [diff] [blame] | 54 | - docker>=2.4.2 |
| 55 | - docker-compose>=1.14.0 |
Zack Williams | bf43d75 | 2017-07-01 15:27:11 -0700 | [diff] [blame] | 56 | - gitpython |
| 57 | - graphviz |
Zack Williams | a276311 | 2017-01-03 11:38:38 -0700 | [diff] [blame] | 58 | |
| 59 | - name: Make current user part of the Docker group |
| 60 | become: yes |
| 61 | user: |
| 62 | name: "{{ ansible_user_id }}" |
| 63 | groups: "docker" |
| 64 | append: yes |
| 65 | |
Zack Williams | bf43d75 | 2017-07-01 15:27:11 -0700 | [diff] [blame] | 66 | # Doesn't work right now, but reported: https://github.com/ansible/ansible/issues/24794 |
| 67 | # see also http://docs.ansible.com/ansible/intro_configuration.html#openssh-specific-settings |
| 68 | - name: Reset ssh connection so user gains docker group membership |
| 69 | meta: reset_connection |
| 70 | |