postgres_exporter version
command: "{{ postgres_exporter_bin_dir }}/postgres_exporter --version 2>&1 | grep -oP 'version \d+.\d+.\d+'"
changed_when: false
failed_when: false
check_mode: false
register: postgres_exporter_current_version
when: postgres_exporter_is_installed.stat.exists == True
ругается так:
ERROR! We were unable to read either as JSON nor YAML, these are the errors we got from each:
JSON: Expecting value: line 1 column 1 (char 0)
Syntax Error while loading YAML.
found unknown escape character
The error appears to be in '/tmp/awx_5978_1bu0dtc3/requirements_roles/postgres_exporter/tasks/main.yaml': line 11, column 98, but may
be elsewhere in the file depending on the exact syntax problem.
The offending line appears to be:
- name: Check current postgres_exporter version
command: "{{ postgres_exporter_bin_dir }}/postgres_exporter --version 2>&1 | grep -oP 'version \d+.\d+.\d+'"
^ here
We could be wrong, but this one looks like it might be an issue with
missing quotes. Always quote template expression brackets when they
start a value. For instance:
with_items:
- {{ foo }}
Should be written as:
with_items:
- "{{ foo }}"
сделал так:
- name: Check current postgres_exporter version
command: >
{{ postgres_exporter_bin_dir }}/postgres_exporter --version 2>&1 | grep -oP 'version \d+.\d+.\d+'
changed_when: false
failed_when: false
check_mode: false
register: postgres_exporter_current_version
when: postgres_exporter_is_installed.stat.exists == True
работает нормально
я тут сам не понял что сделал, можете пожалуйста объяснить?)))
Кавычки не нужны в command. На счёт YAML multiline, вот - https://yaml-multiline.info/
Простыню из чата унеси на пастбин, пожалуйста.
Обсуждают сегодня