2022-02-13 01:37:39 +01:00
|
|
|
---
|
|
|
|
- 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 }}"
|
|
|
|
|
|
|
|
- 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
|
2022-02-13 16:56:12 +01:00
|
|
|
tags:
|
|
|
|
- init_ssh
|
2022-02-13 01:37:39 +01:00
|
|
|
|
|
|
|
|