Deployment PoC - Add pexpect supervision
Signed-off-by: Georg Pfuetzenreuter <georg@lysergic.dev>
This commit is contained in:
parent
2ce8450b89
commit
7e55910b27
@ -99,6 +99,7 @@
|
|||||||
block:
|
block:
|
||||||
- import_tasks: "../tasks/netbox_init_ip.yml"
|
- import_tasks: "../tasks/netbox_init_ip.yml"
|
||||||
- import_tasks: "../tasks/netbox_primaryip.yml"
|
- import_tasks: "../tasks/netbox_primaryip.yml"
|
||||||
|
no_log: true
|
||||||
|
|
||||||
- name: Start VM and attach console
|
- name: Start VM and attach console
|
||||||
import_tasks: "../tasks/init_vm_console.yml"
|
import_tasks: "../tasks/init_vm_console.yml"
|
||||||
@ -106,6 +107,9 @@
|
|||||||
- name: Initialize SSH CA
|
- name: Initialize SSH CA
|
||||||
import_tasks: "../tasks/init_ssh.yml"
|
import_tasks: "../tasks/init_ssh.yml"
|
||||||
|
|
||||||
|
- name: Assist guest OS installation
|
||||||
|
import_tasks: "../tasks/autoyast_assistant.yml"
|
||||||
|
|
||||||
- name: Wait for guest OS installation
|
- name: Wait for guest OS installation
|
||||||
import_tasks: "../tasks/wait.yml"
|
import_tasks: "../tasks/wait.yml"
|
||||||
|
|
||||||
|
38
ansible/deployment_poc/tasks/autoyast_assistant.yml
Normal file
38
ansible/deployment_poc/tasks/autoyast_assistant.yml
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
---
|
||||||
|
- name: Monitor OS installation
|
||||||
|
block:
|
||||||
|
- name: Monitor first stage
|
||||||
|
ansible.builtin.expect:
|
||||||
|
command: "/usr/bin/virsh -c {{ libvirt_url }} console {{ vm_name }} --force"
|
||||||
|
responses:
|
||||||
|
"reboot: Restarting system":
|
||||||
|
- "\u001d"
|
||||||
|
timeout: 720
|
||||||
|
ignore_errors: true
|
||||||
|
no_log: true
|
||||||
|
|
||||||
|
- name: Destroy
|
||||||
|
community.libvirt.virt:
|
||||||
|
uri: "{{ libvirt_url }}"
|
||||||
|
command: destroy
|
||||||
|
name: "{{ vm_name }}"
|
||||||
|
state: destroyed
|
||||||
|
|
||||||
|
- name: Start
|
||||||
|
community.libvirt.virt:
|
||||||
|
uri: "{{ libvirt_url }}"
|
||||||
|
command: start
|
||||||
|
name: "{{ vm_name }}"
|
||||||
|
state: running
|
||||||
|
|
||||||
|
- name: Unlock
|
||||||
|
ansible.builtin.expect:
|
||||||
|
command: "/usr/bin/virsh -c {{ libvirt_url }} console {{ vm_name }} --force"
|
||||||
|
responses:
|
||||||
|
"Please enter passphrase for disk cr_root:":
|
||||||
|
- "{{ luks_passphrase }}"
|
||||||
|
- "\u001d"
|
||||||
|
ignore_errors: yes
|
||||||
|
no_log: true
|
||||||
|
|
||||||
|
delegate_to: localhost
|
@ -48,6 +48,7 @@
|
|||||||
get_attributes: no
|
get_attributes: no
|
||||||
register: stat_ssh_spk
|
register: stat_ssh_spk
|
||||||
|
|
||||||
|
no_log: true
|
||||||
delegate_to: localhost
|
delegate_to: localhost
|
||||||
tags:
|
tags:
|
||||||
- init_ssh
|
- init_ssh
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
- -d
|
- -d
|
||||||
- -s
|
- -s
|
||||||
- "{{ vm_name }}"
|
- "{{ vm_name }}"
|
||||||
|
ignore_errors: true
|
||||||
|
|
||||||
- name: Attach console inside tmux
|
- name: Attach console inside tmux
|
||||||
ansible.builtin.command:
|
ansible.builtin.command:
|
||||||
|
@ -1,14 +1,42 @@
|
|||||||
---
|
---
|
||||||
- name: Wait for guest to become alive
|
- name: Sit patiently
|
||||||
|
block:
|
||||||
|
- name: Wait for guest to become alive
|
||||||
wait_for:
|
wait_for:
|
||||||
#delay: 240
|
delay: 240
|
||||||
connect_timeout: 3
|
connect_timeout: 3
|
||||||
sleep: 15
|
sleep: 15
|
||||||
port: 22
|
port: 22
|
||||||
host: '{{ ip_address }}'
|
host: '{{ ip_address }}'
|
||||||
search_regex: OpenSSH
|
search_regex: OpenSSH
|
||||||
timeout: 900
|
timeout: 600
|
||||||
#connection: local
|
|
||||||
|
# rescue:
|
||||||
|
# - name: Destroy
|
||||||
|
# community.libvirt.virt:
|
||||||
|
# uri: "{{ libvirt_url }}"
|
||||||
|
# command: destroy
|
||||||
|
# name: "{{ vm_name }}"
|
||||||
|
# state: destroyed
|
||||||
|
#
|
||||||
|
# - name: Start
|
||||||
|
# community.libvirt.virt:
|
||||||
|
# uri: "{{ libvirt_url }}"
|
||||||
|
# command: start
|
||||||
|
# name: "{{ vm_name }}"
|
||||||
|
# state: running
|
||||||
|
#
|
||||||
|
# - name: Wait for guest to become alive
|
||||||
|
# wait_for:
|
||||||
|
# delay: 120
|
||||||
|
# connect_timeout: 3
|
||||||
|
# sleep: 15
|
||||||
|
# port: 22
|
||||||
|
# host: '{{ ip_address }}'
|
||||||
|
# search_regex: OpenSSH
|
||||||
|
# timeout: 600
|
||||||
|
|
||||||
delegate_to: localhost
|
delegate_to: localhost
|
||||||
tags:
|
tags:
|
||||||
- init_ssh
|
- init_ssh
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user