From 2bf6c639e305873de591832e55bfc79b2404f678 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adam=20R=C5=AF=C5=BEi=C4=8Dka?= Date: Wed, 15 Jul 2020 18:00:16 +0200 Subject: [PATCH] Fix setting HTTPS?_PROXY for receptor (#22) This change also introduced per-receptor-instance environment files instead of setting the proxy directly in the template systemd unit. --- tasks/main.yml | 9 +++++++++ templates/receptor@.service.j2 | 3 +-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/tasks/main.yml b/tasks/main.yml index 5658235..3634ffd 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -106,6 +106,15 @@ tags: register_with_sources - name: Create Receptor systemd unit files per account and start them block: + - name: Genereate environment files + copy: + dest: "{{ receptor_config_dir }}/{{ account_dir }}/receptor.env" + content: | + HTTP_PROXY={{ http_proxy }} + HTTPS_PROXY={{ http_proxy }} + loop: "{{ account_dirs }}" + loop_control: + loop_var: account_dir - name: Generate template unit file template: src: receptor@.service.j2 diff --git a/templates/receptor@.service.j2 b/templates/receptor@.service.j2 index 4ec76ea..9488d0d 100644 --- a/templates/receptor@.service.j2 +++ b/templates/receptor@.service.j2 @@ -4,8 +4,7 @@ After=network.target [Service] ExecStart=/usr/bin/receptor -c {{receptor_config_dir}}/%i/receptor.conf -d {{receptor_data_dir}}/%i node -Environment=HTTP_PROXY="{{ http_proxy }}" -Environment=HTTPS_PROXY="{{ http_proxy }}" +EnvironmentFile=-{{ receptor_config_dir }}/%i/receptor.env [Install] WantedBy=multi-user.target