summaryrefslogtreecommitdiffstats
path: root/ansible/deployment_poc/tasks/init_vm_console.yml
diff options
context:
space:
mode:
authorGeorg Pfuetzenreuter2022-02-13 01:37:39 +0100
committerGeorg Pfuetzenreuter2022-02-13 01:41:30 +0100
commit642290c73407a7969857197810123633c83c6a26 (patch)
tree501c138a617d11abaf88d28812baab5a2ee639dd /ansible/deployment_poc/tasks/init_vm_console.yml
parenta2be10311173cef2c39da721b3e47888c379e7bc (diff)
downloadsystem-642290c73407a7969857197810123633c83c6a26.tar.gz
system-642290c73407a7969857197810123633c83c6a26.tar.bz2
system-642290c73407a7969857197810123633c83c6a26.zip
Bulk update
Signed-off-by: Georg Pfuetzenreuter <georg@lysergic.dev>
Diffstat (limited to 'ansible/deployment_poc/tasks/init_vm_console.yml')
-rw-r--r--ansible/deployment_poc/tasks/init_vm_console.yml39
1 files changed, 39 insertions, 0 deletions
diff --git a/ansible/deployment_poc/tasks/init_vm_console.yml b/ansible/deployment_poc/tasks/init_vm_console.yml
new file mode 100644
index 0000000..1007c90
--- /dev/null
+++ b/ansible/deployment_poc/tasks/init_vm_console.yml
@@ -0,0 +1,39 @@
+---
+- 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
+
+