From a6161e0217078642951cdaa081db26915f8f2522 Mon Sep 17 00:00:00 2001 From: Robert Kaussow Date: Sun, 25 Jul 2021 15:27:44 +0200 Subject: [PATCH] feat: add optional umask setting for pip --- defaults/main.yml | 10 ++++++++++ tasks/setup.yml | 3 +++ templates/etc/sysconfig/pve_sd.j2 | 8 ++++++++ 3 files changed, 21 insertions(+) diff --git a/defaults/main.yml b/defaults/main.yml index d1eb5ec..46b0ad3 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -8,6 +8,10 @@ pve_sd_packages_extra: [] pve_sd_virtualenv_command: /usr/bin/python3 -m venv pve_sd_virtualenv: /opt/python3/pve_sd +# @var pve_sd_virtualenv_umask:description: Set a custom umask and ignore the system default settings. +# @var pve_sd_virtualenv_umask: $ "_unset_" +# @var pve_sd_virtualenv_umask:example: $ "0022" + pve_sd_user: "prometheus_adm" pve_sd_group: "{{ pve_sd_user }}" pve_sd_extra_groups: [] @@ -18,8 +22,14 @@ pve_sd_service_stopped: False pve_sd_log_level: info pve_sd_log_format: console + pve_sd_output_file: /out/pve.json + +pve_sd_exclude_state: [] +pve_sd_exclude_vmid: [] + pve_sd_service: False + pve_sd_pve_server: pve.example.com pve_sd_pve_user: root pve_sd_pve_password: secure diff --git a/tasks/setup.yml b/tasks/setup.yml index 9a75b0b..fafefa5 100644 --- a/tasks/setup.yml +++ b/tasks/setup.yml @@ -18,6 +18,7 @@ virtualenv: "{{ pve_sd_virtualenv }}" virtualenv_command: "{{ pve_sd_virtualenv_command }}" extra_args: --upgrade + umask: "{{ pve_sd_virtualenv_umask | default(omit) }}" loop: - pip - setuptools @@ -27,6 +28,7 @@ name: "{{ item }}" virtualenv: "{{ pve_sd_virtualenv }}" virtualenv_command: "{{ pve_sd_virtualenv_command }}" + umask: "{{ pve_sd_virtualenv_umask | default(omit) }}" environment: TMPDIR: /opt/python3/tmp loop: "{{ pve_sd_packages_extra }}" @@ -36,6 +38,7 @@ name: "{{ item }}" virtualenv: "{{ pve_sd_virtualenv }}" virtualenv_command: "{{ pve_sd_virtualenv_command }}" + umask: "{{ pve_sd_virtualenv_umask | default(omit) }}" loop: "{{ __pve_sd_packages }}" - name: Adjust file permissions diff --git a/templates/etc/sysconfig/pve_sd.j2 b/templates/etc/sysconfig/pve_sd.j2 index 6c8dd41..c214e12 100644 --- a/templates/etc/sysconfig/pve_sd.j2 +++ b/templates/etc/sysconfig/pve_sd.j2 @@ -2,8 +2,16 @@ {{ ansible_managed | comment }} PROMETHEUS_PVE_SD_LOG_LEVEL={{ pve_sd_log_level }} PROMETHEUS_PVE_SD_LOG_FORMAT={{ pve_sd_log_format }} + PROMETHEUS_PVE_SD_OUTPUT_FILE={{ pve_sd_output_file }} + PROMETHEUS_PVE_SD_SERVICE={{ pve_sd_service | bool | lower }} + +PROMETHEUS_PVE_SD_EXCLUDE_STATE={{ pve_sd_exclude_state | join(",") }} +PROMETHEUS_PVE_SD_EXCLUDE_VMID={{ pve_sd_exclude_vmid | join(",") }} + PROMETHEUS_PVE_SD_PVE_SERVER={{ pve_sd_pve_server }} PROMETHEUS_PVE_SD_PVE_USER={{ pve_sd_pve_user }} PROMETHEUS_PVE_SD_PVE_PASSWORD={{ pve_sd_pve_password }} +PROMETHEUS_PVE_SD_PVE_AUTH_TIMEOUT=5 +PROMETHEUS_PVE_SD_PVE_VERIFY_SSL=true