system/ansible/deployment_poc/tasks/init_vm_console.yml
Georg Pfuetzenreuter 7e55910b27
Deployment PoC - Add pexpect supervision
Signed-off-by: Georg Pfuetzenreuter <georg@lysergic.dev>
2022-02-14 00:32:26 +01:00

43 lines
866 B
YAML

---
- name: Start VM and attach console inside tmux
block:
- name: Start VM
community.libvirt.virt:
uri: "{{ libvirt_url }}"
command: start
name: "{{ vm_name }}"
state: running
- name: Spawn tmux session
ansible.builtin.command:
argv:
- /usr/bin/tmux
- -S
- /tmp/ansible
- new-session
- -d
- -s
- "{{ vm_name }}"
ignore_errors: true
- name: Attach console inside tmux
ansible.builtin.command:
argv:
- /usr/bin/tmux
- -S
- /tmp/ansible
- new-window
- -t
- "{{ vm_name }}"
- /usr/bin/virsh
- -c
- "{{ libvirt_url }}"
- console
- "{{ vm_name }}"
delegate_to: localhost
tags:
- init_ssh