| --- |
| # ============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========================================================= |
| |
| # NOTE (fdegir): gpg-agent is required for being able to run apt-key add |
| - name: Install gpg-agent |
| apt: |
| name: gpg-agent |
| state: present |
| update_cache: true |
| |
| - name: Add docker apt key |
| apt_key: |
| url: https://download.docker.com/linux/ubuntu/gpg |
| state: present |
| |
| # NOTE(fdegir): ansible apt_repository gives segmentation fault so failling back to command |
| - name: Add docker apt repository |
| command: |- |
| add-apt-repository \ |
| "deb [arch=amd64] https://download.docker.com/linux/ubuntu {{ ansible_distribution_release }} stable" |
| changed_when: false |
| |
| - name: Run apt update |
| apt: |
| update_cache: true |
| |
| - 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 |
| |
| - name: Install packages on {{ ansible_os_family }} |
| include_tasks: "install-packages-{{ ansible_os_family }}.yml" |
| |
| # vim: set ts=2 sw=2 expandtab: |