You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ansible/roles/bootstrap/tasks/try_else_shift.yml

15 lines
387 B
YAML

---
- name: Try to ping host with expected credentials
action: ping
ignore_unreachable: true
ignore_errors: yes
register: pingtest
- meta: clear_host_errors
- name: Shift if ping fails
set_fact:
bootstrap_used: yes
ansible_user: '{{ bootstrap_user }}'
ansible_become_pass: '{{ bootstrap_become_pass }}'
when: pingtest.failed | d(pingtest.unreachable) | d(false)