Allow usage of ansible_host, ansible_ssh_host or inventory_hostname in this order.
| | |
| | | |
| | | - name: Set Hostname |
| | | set_fact: |
| | | lab_host_hostname: "{{ hostvars[lab_host]['ansible_host'] }}" |
| | | lab_host_hostname: "{{ hostvars[lab_host]['ansible_host'] | default(hostvars[lab_host]['ansible_ssh_host']) | default(hostvars[lab_host]['inventory_hostname']) }}" |
| | | |
| | | - name: Determine if Host Exists |
| | | uri: |
| | |
| | | - 201 |
| | | register: response |
| | | changed_when: response.status == 201 |
| | | when: response.json.count == 0 |
| | | when: response.json.count == 0 |