This repository has been archived on 2023-09-13. You can view files and clone it, but cannot push or open issues or pull requests.
homeserver-ansible/tasks/ssh_port.yml

43 lines
978 B
YAML
Raw Normal View History

2022-03-04 07:30:52 -05:00
- name: Use default credentials for ssh
2022-03-02 19:58:31 -05:00
set_fact:
ansible_user: "{{ admin_username }}"
- name: Attempt ssh connection
become: no
2022-03-04 07:30:52 -05:00
raw: "echo Pong!"
ignore_unreachable: true
changed_when: false
2022-03-02 19:58:31 -05:00
register: ssh_result_default
2022-03-04 07:30:52 -05:00
- name: Use fallback port for ssh
2022-03-02 19:58:31 -05:00
set_fact:
ansible_ssh_port: 22
when:
2022-03-04 07:30:52 -05:00
- ssh_result_default is unreachable
2022-03-02 19:58:31 -05:00
- name: Attempt ssh connection
become: no
2022-03-04 07:30:52 -05:00
raw: "echo Pong!"
ignore_unreachable: true
changed_when: false
2022-03-02 19:58:31 -05:00
register: ssh_result_port
when:
2022-03-04 07:30:52 -05:00
- ssh_result_default is unreachable
2022-03-02 19:58:31 -05:00
2022-03-04 07:30:52 -05:00
- name: Use fallback port and default Arch Linux ARM credentials for ssh
2022-03-02 19:58:31 -05:00
set_fact:
ansible_ssh_port: "22"
ansible_user: "alarm"
ansible_ssh_password: "alarm"
when:
2022-03-04 07:30:52 -05:00
- ssh_result_default is unreachable
- ssh_result_port is unreachable
2022-03-02 19:58:31 -05:00
- name: Attempt ssh connection
become: no
2022-03-04 07:30:52 -05:00
changed_when: false
raw: "echo Pong!"
2022-03-02 19:58:31 -05:00
when:
2022-03-04 07:30:52 -05:00
- ssh_result_default is unreachable
- ssh_result_port is unreachable