diff --git a/tasks/main.yml b/tasks/main.yml
index 9ced492a2b095e3e8274916bc3ce3c4e3e124eb4..1bbf41d7c5e25fa180c687ea18576dc0328ee7c1 100644
--- a/tasks/main.yml
+++ b/tasks/main.yml
@@ -13,6 +13,12 @@
 - name: install apt-transport-https
   apt: pkg=apt-transport-https
 
+- name: setup apt proxy
+  template:
+    src: 50proxy.j2
+    dest: /etc/apt/apt.conf.d/50proxy
+  when: apt.proxy is defined
+
 - name: setup repositories
   include_tasks: repo.yml
   with_items: "{{ packages.repos }}"
diff --git a/templates/50proxy.j2 b/templates/50proxy.j2
new file mode 100644
index 0000000000000000000000000000000000000000..0a80c9acb9485330f2edaa682e6d5e94aaa0a88b
--- /dev/null
+++ b/templates/50proxy.j2
@@ -0,0 +1,2 @@
+Acquire::http::Proxy "http://{{ apt.proxy }}";
+Acquire::https::Proxy "https://{{ apt.proxy }}";