| # |
| # Licensed to the Apache Software Foundation (ASF) under one or more |
| # contributor license agreements. See the NOTICE file distributed with |
| # this work for additional information regarding copyright ownership. |
| # The ASF licenses this file to You under the Apache License, Version 2.0 |
| # (the "License"); you may not use this file except in compliance with |
| # the License. You may obtain a copy of the License at |
| # |
| # http://www.apache.org/licenses/LICENSE-2.0 |
| # |
| # Unless required by applicable law or agreed to in writing, software |
| # distributed under the License is distributed on an "AS IS" BASIS, |
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| # See the License for the specific language governing permissions and |
| # limitations under the License. |
| # |
| |
| - name: install required packages for docker |
| yum: |
| name: "{{ packages }}" |
| vars: |
| packages: |
| - yum-utils |
| - device-mapper-persistent-data |
| - lvm2 |
| - name: add docker repo |
| yum_repository: |
| name: docker-ce-stable |
| description: "Docker CE Stable - $basearch" |
| baseurl: "{{ docker_repo_baseurl }}" |
| gpgcheck: yes |
| gpgkey: https://download.docker.com/linux/centos/gpg |
| - name: install docker |
| yum: |
| name: docker-ce |
| - name: create docker directory in data dir |
| file: |
| path: "{{ default_data_dirs[0] }}/docker" |
| state: directory |
| mode: 0755 |
| - name: link /var/lib/docker |
| file: |
| src: "{{ default_data_dirs[0] }}/docker" |
| dest: /var/lib/docker |
| state: link |
| - name: "add {{ cluster_user }} to docker group" |
| user: |
| name: "{{ cluster_user }}" |
| groups: docker |
| append: yes |
| - name: "start docker service" |
| service: |
| name: docker |
| state: started |