collection of ansible roles
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

40 lines
1.2 KiB

- name: send unlock command
raw: "printf '{{ autoinstall_disk_encryption_secret }}' | cryptroot-unlock"
- name: wait for boot
wait_for:
delay: 5
port: '{{ hostvars[inventory_hostname].ansible_ssh_port|default(22) }}'
host: '{{ hostvars[inventory_hostname].ansible_host }}'
search_regex: OpenSSH|dropbear
timeout: 300
delegate_to: localhost
delegate_facts: yes
- name: test ssh connection with {{ ansible_user }}
shell: |
ssh -p{{ hostvars[inventory_hostname].ansible_ssh_port|default(22) }} \
-i {{ hostvars[inventory_hostname].ansible_ssh_private_key_file }} \
-oStrictHostkeyChecking=no \
-oBatchMode=yes \
{{ hostvars[inventory_hostname].ansible_user }}@{{ hostvars[inventory_hostname].ansible_host }} echo test
register: connection_test
ignore_errors: yes
delegate_to: localhost
delegate_facts: yes
- name: set ansible_user
set_fact:
ansible_ssh_user: "{{ ansible_user }}"
when: connection_test is succeeded
- name: set python interpreter
set_fact:
ansible_ssh_user: /usr/bin/env python
- name: Clear gathered facts from all currently targeted hosts
ansible.builtin.meta: clear_facts
- name: reload facts
setup: