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 | |
Andy Bavier | 0272aa5 | 2017-08-16 15:40:06 -0700 | [diff] [blame] | 49 | - name: Configure Docker |
| 50 | become: yes |
| 51 | template: |
| 52 | src=default_docker.j2 |
| 53 | dest=/etc/default/docker |
| 54 | mode=0644 |
| 55 | owner=root |
| 56 | group=root |
| 57 | notify: restart docker |
| 58 | |
Zack Williams | bf43d75 | 2017-07-01 15:27:11 -0700 | [diff] [blame] | 59 | - name: Install docker-compose, docker python module, imagebuilder deps via pip |
Zack Williams | a276311 | 2017-01-03 11:38:38 -0700 | [diff] [blame] | 60 | become: yes |
| 61 | pip: |
| 62 | name: "{{ item }}" |
| 63 | with_items: |
Matteo Scandolo | 7bdef98 | 2017-12-19 17:11:16 -0800 | [diff] [blame] | 64 | - docker==2.6.1 |
Zack Williams | 61031b1 | 2017-09-01 11:08:46 -0700 | [diff] [blame] | 65 | - docker-compose==1.15.0 |
Zack Williams | bf43d75 | 2017-07-01 15:27:11 -0700 | [diff] [blame] | 66 | - gitpython |
| 67 | - graphviz |
Zack Williams | a276311 | 2017-01-03 11:38:38 -0700 | [diff] [blame] | 68 | |
| 69 | - name: Make current user part of the Docker group |
| 70 | become: yes |
| 71 | user: |
| 72 | name: "{{ ansible_user_id }}" |
| 73 | groups: "docker" |
| 74 | append: yes |
| 75 | |
Zack Williams | bf43d75 | 2017-07-01 15:27:11 -0700 | [diff] [blame] | 76 | # Doesn't work right now, but reported: https://github.com/ansible/ansible/issues/24794 |
| 77 | # see also http://docs.ansible.com/ansible/intro_configuration.html#openssh-specific-settings |
Zack Williams | 8c7c8aa | 2017-09-19 17:26:09 -0700 | [diff] [blame] | 78 | # FIXME (zdw, 2017-09-19): busted in 2.4, per https://groups.google.com/forum/#!msg/ansible-project/vk7i2DszfZg/myI1uCroAQAJ |
| 79 | #- name: Reset ssh connection so user gains docker group membership |
| 80 | # meta: reset_connection |
Zack Williams | bf43d75 | 2017-07-01 15:27:11 -0700 | [diff] [blame] | 81 | |