instance wait fails
Summary
Waiting for instance to start fails.
Steps to reproduce
- name: "bootstrap OpenStack instances"
hosts: "openstack-instances"
gather_facts: no
roles:
- role: "openstack"
action: "facts"
- role: "ssh"
action: "set_arguments"
- role: "openstack"
action: "instance/wait"
Expected behavior
Playbook waits until the machines are up.
Actual behavior
Playbook fails when parsing vm logs.
Relevant logs and/or screenshots
fatal: [consul01]: FAILED! => {"failed": true, "msg": "The conditional check '_result_log.stdout | search('Cloud-init v\\. [\\d\\.]+ finished')' failed. The error was: Unexpected templating type error occurred on ({% if _result_log.stdout | search('Cloud-init v\\. [\\d\\.]+ finished') %} True {% else %} False {% endif %}): expected string or buffer"}
Further investigation shows, that the problem is not parsing, but executing command:
fatal: [consul01 -> 127.0.0.1]: FAILED! => {"changed": false, "cmd": "'openstack --os-cloud task-bdaca-project' console log show consul01", "failed": true, "msg": "[Errno 2] No such file or directory", "rc": 2}
Possible fixes
- name: "wait for cloud-init to finish"
command: >-
"{{ _openstack_client_command }}" console log show
"{{ inventory_hostname }}"
register: _result_log
until: "_result_log.stdout | search('Cloud-init v\\. [\\d\\.]+ finished')"
retries: 100
delay: 6
changed_when: "False"
delegate_to: "openstack-client"
command
should not take _openstack_client_command
in inverted commas.