Merge "WIP: Add role to auto install docker on hosts"
[barometer.git] / docker / ansible / roles / install_docker / tasks / proxy.yml
1 #Copyright 2018 OPNFV and Intel Corporation
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
6 #
7 #     http://www.apache.org/licenses/LICENSE-2.0
8 #
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
14 ---
15
16 - name: create docker proxy configuration file
17   tags:
18      - add_docker_proxy
19   lineinfile:
20      path: "{{ docker_proxy_conf }}"
21      line: "[Service]"
22      create: yes
23
24 - name: add docker http_proxy
25   tags:
26      - add_docker_proxy
27   lineinfile:
28      path: "{{ docker_proxy_conf }}"
29      line: "Environment=\"HTTP_PROXY={{ ansible_env.http_proxy }}\""
30   when: ansible_env.http_proxy is defined
31
32 - name: add docker https_proxy
33   tags:
34      - add_docker_proxy
35   lineinfile:
36      path: "{{ docker_proxy_conf }}"
37      line: "Environment=\"HTTPS_PROXY={{ ansible_env.https_proxy }}\""
38   when: ansible_env.https_proxy is defined
39
40 - name: add docker ftp_proxy
41   tags:
42      - add_docker_proxy
43   lineinfile:
44      path: "{{ docker_proxy_conf }}"
45      line: "Environment=\"FTP_PROXY={{ ansible_env.ftp_proxy }}\""
46   when: ansible_env.ftp_proxy is defined
47
48 - name: add docker no_proxy
49   tags:
50      - add_docker_proxy
51   lineinfile:
52      path: "{{ docker_proxy_conf }}"
53      line: "Environment=\"NO_PROXY={{ ansible_env.no_proxy }}\""
54   when: ansible_env.no_proxy is defined
55