Rebuild validator-agent; ansible role checks traceroute and new settings
The role warns about new variables missing from the env file and, after the container starts, checks that traceroute is installed and the agent config has the retry and traceroute settings. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
5c75ece8b1
commit
65c6975a24
7 files changed
+155
-5
No files matched your search
@@ -40,6 +40,40 @@
|
||||
quiet: true
|
||||
run_once: true
|
||||
|
||||
# Новые переменные (повтор HTTPS, трассировка): если их нет в env-файле, агент
|
||||
# работает на значениях по умолчанию из docker-entrypoint.sh. В факт попадают
|
||||
# только имена переменных, не значения (в файле токен).
|
||||
- name: Look for new variables missing in the env file
|
||||
ansible.builtin.set_fact:
|
||||
env_missing_vars: >-
|
||||
{%- set missing = [] -%}
|
||||
{%- for name in new_env_vars -%}
|
||||
{%- if not (env_file_text is regex('(?m)^' ~ name ~ '=')) -%}
|
||||
{%- set _ = missing.append(name) -%}
|
||||
{%- endif -%}
|
||||
{%- endfor -%}
|
||||
{{- missing | to_json -}}
|
||||
vars:
|
||||
env_file_text: "{{ lookup('ansible.builtin.file', local_env_file) }}"
|
||||
new_env_vars:
|
||||
- VALIDATOR_AGENT_HTTPS_ATTEMPTS
|
||||
- VALIDATOR_AGENT_HTTPS_RETRY_DELAY_SECONDS
|
||||
- VALIDATOR_AGENT_TRACEROUTE_ENABLED
|
||||
- VALIDATOR_AGENT_TRACEROUTE_TIMEOUT_SECONDS
|
||||
- VALIDATOR_AGENT_TRACEROUTE_MAX_HOPS
|
||||
- VALIDATOR_AGENT_TRACEROUTE_POLL_INTERVAL_SECONDS
|
||||
run_once: true
|
||||
no_log: true
|
||||
|
||||
- name: Warn about new variables missing in the env file
|
||||
ansible.builtin.debug:
|
||||
msg: >-
|
||||
В {{ local_env_file }} не заданы: {{ env_missing_vars | from_json | join(', ') }}.
|
||||
Будут использованы значения по умолчанию из docker-entrypoint.sh.
|
||||
Образец — env/validator-agent.env.example.
|
||||
when: (env_missing_vars | from_json) | length > 0
|
||||
run_once: true
|
||||
|
||||
# --- на каждом валидаторе -----------------------------------------------
|
||||
- name: Check that Docker answers
|
||||
ansible.builtin.command: docker version --format {% raw %}'{{.Server.Version}}'{% endraw %}
|
||||
|
||||
Reference in new issue
Block a user