parent
b143298140
commit
447c7cce7d
@ -0,0 +1 @@ |
|||||||
|
unlock_disk_encryption_secret: secret |
||||||
@ -0,0 +1,2 @@ |
|||||||
|
- name: unlock_disk |
||||||
|
include_tasks: tasks/unlock.yml |
||||||
@ -0,0 +1,40 @@ |
|||||||
|
- name: send unlock command |
||||||
|
raw: "printf '{{ unlock_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 |
||||||
|
|
||||||
|
- name: set ansible_user |
||||||
|
set_fact: |
||||||
|
ansible_ssh_user: "{{ ansible_user }}" |
||||||
|
when: connection_test is succeeded |
||||||
|
|
||||||
|
- name: set python interpreter |
||||||
|
set_fact: |
||||||
|
ansible_python_interpreter: /usr/bin/env python3 |
||||||
|
discovered_interpreter_python: |
||||||
|
|
||||||
|
- name: reload facts |
||||||
|
setup: |
||||||
|
|
||||||
|
- name: set python interpreter |
||||||
|
set_fact: |
||||||
|
ansible_python_interpreter: "{{ discovered_interpreter_python }}" |
||||||
Loading…
Reference in new issue