kolla-ansible/ansible/roles/prechecks/tasks/service_checks.yml
Mark Goddard be4568334c Fix failure handling in prechecks
In a HAProxy precheck task, the command module is used, and the results
inspected by checking the stdout attribute of the result. However, if
the command fails (non-zero exit code), in some cases there may not be a
stdout attribute in the result object. This causes an AttributeError and
prevents ansible's useful diagnostic output from being displayed.

Change-Id: Id502b5d0b71fe2150a29df43154c925dca96ef06
Trivial Fix
2017-12-14 14:05:39 +00:00

19 lines
838 B
YAML

---
- name: Checking Docker version
command: docker version
register: result
changed_when: false
when: inventory_hostname in groups['baremetal']
failed_when: result | failed
or (result.stdout | from_yaml).Server.Version | regex_replace('(\\d+\\.\\d+\\.\\d+).*', '\\1') | version_compare(docker_version_min, '<')
# NOTE(mgoddard): If passwords.yml is encrypted using ansible-vault, this check
# will pass, but only because nothing in the vault file has the format of a
# YAML dict item.
- name: Checking empty passwords in passwords.yml. Run kolla-genpwd if this task fails
local_action: command grep '^[^#].*:\s*$' "{{ CONFIG_DIR | default('/etc/kolla') }}/passwords.yml"
run_once: True
register: result
changed_when: false
failed_when: result.stdout | regex_replace('(.*ssh_key.*)', '') | search(":")