blob: a74fde6b721babf753283b0efbcf46e0d361e2db (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
---
- 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
tags:
- init_ssh
|