# -*- mode: yaml; indent-tabs-mode: nil; tab-width: 2; coding: utf-8-unix -*-
---

- debug:
    verbosity: 1
    msg: "DEBUG: Including proxy Ubuntu_post.yml"

- name: /etc/apt/apt.conf.d/80proxy.conf
  blockinfile:
    dest: /etc/apt/apt.conf.d/80proxy.conf
    create: yes
    marker: "# {mark} ANSIBLE MANAGED BLOCK proxy"
    block: |
      Acquire::http::Proxy "{{HTTP_PROXYTYPE}}://{{HTTP_PROXYHOST}}:{{HTTP_PROXYPORT}}";
      Acquire::https::Proxy "{{HTTP_PROXYTYPE}}://{{HTTPS_PROXYHOST}}:{{HTTPS_PROXYPORT}}";
  when: HTTP_PROXYHOST != ''

- name: /etc/apt/apt.conf.d/80proxy.conf
  file:
    path: /etc/apt/apt.conf.d/80proxy.conf
    state: absent
  when: HTTP_PROXYHOST == ''

