# Copyright (c) 2018 Intel Corporation. # # Licensed 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. --- - file: path: /lib/systemd/system/docker.service.d state: directory - copy: content: | [Service] MountFlags=shared dest: /lib/systemd/system/docker.service.d/kolla.conf - set_fact: ostack_hosts: "{{ ostack_hosts | default([]) + [hostvars[item].ansible_host] }}" with_items: "{{ groups['ostack'] }}" - name: Create proxy configuration for docker copy: content: | [Service] Environment="HTTP_PROXY={{ lookup('env', 'http_proxy') }}" Environment="HTTPS_PROXY={{ lookup('env', 'https_proxy') }}" Environment="FTP_PROXY={{ lookup('env', 'ftp_proxy') }}" Environment="NO_PROXY={{ lookup('env', 'no_proxy') }},{{ hostvars[ansible_host].ansible_default_ipv4.address }},{{ ostack_hosts | join(',') }}" dest: /lib/systemd/system/docker.service.d/http-proxy.conf - name: Update /etc/default/docker lineinfile: path: /etc/default/docker line: 'DOCKER_OPTS="--dns {{ hostvars[ansible_host].ansible_default_ipv4.gateway }} --insecure-registry {{ deploy_host }}:4000"' - name: reload restart docker systemd: state: restarted daemon_reload: yes name: docker