-
Notifications
You must be signed in to change notification settings - Fork 5
/
300-update-template-vms.yaml
49 lines (44 loc) · 1.38 KB
/
300-update-template-vms.yaml
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
42
43
44
45
46
47
48
49
---
# This playbook updates a template vm
# Example to run manually:
# ansible-playbook -e@../stormshift-dev.vars 300-update-templates.yaml
- hosts: "template_vms"
gather_facts: false
tasks:
- name: Start VM
changed_when: false # starting the VM does not really change its state on disk, at least not in the update OS context
local_action:
module: kubevirt.core.kubevirt_vm
state: present
running: true
wait: true
name: "{{ vm_cr_name }}"
namespace: "{{ stormshift_template_vms_namespace }}"
- name: Wait for VM to be online
local_action:
module: ansible.builtin.wait_for
host: "{{ inventory_hostname }}.{{ sysctx_dns_domain }}"
port: 22
state: started
# - name: Register with Red Hat Subscription Manager
# tags: rhsm,slow
# redhat_subscription:
# state: present
# username: "{{ sysctx_rhsm_user}}"
# password: "{{ sysctx_rhsm_pswd}}"
# force_register: true
- name: Update baseos
tags: upd, slow
yum:
name: '*'
state: latest
register: osupdate
- name: Stop VM
changed_when: false
local_action:
module: kubevirt.core.kubevirt_vm
state: present
running: false
wait: true
name: "{{ vm_cr_name }}"
namespace: "{{ stormshift_template_vms_namespace }}"