aboutsummaryrefslogtreecommitdiffstats
path: root/ansible/roles/infra_rampup_stack_nodes/tasks/configure_docker.yml
blob: a6ae00e5108ae232cc9698ebf63c63d1920e05db (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# 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