Skip to content
This repository was archived by the owner on Aug 18, 2023. It is now read-only.

Commit 9205e25

Browse files
committed
Mask environment configuration with no_log
Environment files are frequently used to inject sensitive values to daemons. This change enables the no_log flag on this task. Alternatively, we could have two tasks that do the same thing and require users to opt out/in like such: ```yaml prometheus_my_exporter_env_vars: foo: 'not a secret, i like my diffs' prometheus_my_exporter_env_insensitive: true ```
1 parent 378b74a commit 9205e25

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

tasks/_service.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
notify:
2424
- Restart Prometheus service
2525
when: prometheus_software_env_vars is defined and prometheus_software_env_vars
26+
no_log: True
2627

2728
- name: Include task to setup {{ prometheus_software_name_version }} {{ ansible_service_mgr }} service
2829
include_tasks: '_service_mgr_{{ ansible_service_mgr | regex_replace("^(openrc|upstart)$", "init") }}.yml'

tasks/_setup_software_facts.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,6 @@
117117
- name: Set {{ prometheus_software_name }} generic facts
118118
set_fact:
119119
prometheus_software_build_prerequisites: '{{ prometheus_software_os_options.build_prerequisites | default([]) }}'
120-
prometheus_software_env_vars: '{{ lookup("vars", "prometheus_" + prometheus_software_name + "_env_vars", default={}) }}'
121120
prometheus_software_extra_opts: '{{ lookup("vars", "prometheus_" + prometheus_software_name + "_extra_opts", default="") }}'
122121
prometheus_software_fallback_to_build: >-
123122
{{ lookup("vars", "prometheus_" + prometheus_software_name + "_fallback_to_build", default=prometheus_fallback_to_build) }}
@@ -141,3 +140,8 @@
141140
{% endif %}"
142141
prometheus_software_tgroup_jobname: >-
143142
{{ lookup("vars", "prometheus_" + prometheus_software_name + "_jobname", default=prometheus_software_default_jobname) }}
143+
144+
- name: Set {{ prometheus_software_name }} sensitive facts
145+
set_fact:
146+
prometheus_software_env_vars: '{{ lookup("vars", "prometheus_" + prometheus_software_name + "_env_vars", default={}) }}'
147+
no_log: true

0 commit comments

Comments
 (0)