| --- |
| # ============LICENSE_START======================================================= |
| # Copyright (C) 2019 The Nordix Foundation. All rights reserved. |
| # ================================================================================ |
| # 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. |
| # |
| # SPDX-License-Identifier: Apache-2.0 |
| # ============LICENSE_END========================================================= |
| |
| - name: Install packages on {{ ansible_os_family }} |
| include_tasks: "install-packages-{{ ansible_os_family }}.yml" |
| |
| - name: Config docker proxy |
| block: |
| - name: Check that /etc/systemd/system/docker.service.d exists |
| stat: |
| path: "/etc/systemd/system/docker.service.d" |
| register: dir_stats |
| |
| - name: Create /etc/systemd/system/docker.service.d if not exists |
| file: |
| path: "/etc/systemd/system/docker.service.d" |
| state: directory |
| when: not dir_stats.stat.exists |
| |
| - name: Create proxy conf file under /etc/systemd/system/docker.service.d/ |
| file: |
| path: "/etc/systemd/system/docker.service.d/http-proxy.conf" |
| state: touch |
| |
| - name: Config docker proxy in http-proxy.conf |
| blockinfile: |
| dest: "/etc/systemd/system/docker.service.d/http-proxy.conf" |
| block: | |
| [Service] |
| Environment="HTTP_PROXY={{ idf.proxy_settings.http_proxy }}" |
| Environment="HTTPS_PROXY={{ idf.proxy_settings.https_proxy }}" |
| Environment="NO_PROXY={{ idf.proxy_settings.no_proxy }}" |
| when: |
| idf.proxy_settings is defined |
| |
| # vim: set ts=2 sw=2 expandtab: |