Comment 1 for bug 1635880

Revision history for this message
Chris Martin (6-chris-z) wrote :

After some testing, I don't actually think the ping module will help. If it can't reach a target via SSH then it aborts playbook execution with a "fatal"/"unreachable" error.

Instead, the following code seems to work for testing SSH reachability. It uses whatever SSH users and ports are defined in ~/.ssh/config, the same way that you override these defaults for OSA overall.

```
- name: Verify Ceph monitors are up
  local_action: shell ssh {{ item }} "echo pong"
  with_items: "{{ ceph_mons }}"
  changed_when: false
  failed_when: false
  register: ceph_mon_upcheck
  tags:
  - ceph-config-create-config
  - ceph-auth-client-keyrings
  - ceph-auth-nova-libvirt-secret

- name: Set ceph_mon_host to an online monitor host
  set_fact:
                  ceph_mon_host: '{{ item.item }}'
  when: item.stdout == 'pong'
  with_items: "{{ ceph_mon_upcheck.results }}"
  tags:
  - ceph-config-create-config
  - ceph-auth-client-keyrings
  - ceph-auth-nova-libvirt-secret
```