Skip to content

Commit

Permalink
Ensure we configure any "managed" VM
Browse files Browse the repository at this point in the history
UNtile now, we didn't generate any config drive for VM that weren't
started, even though we wanted them managed.

This patch corrects the issue, and also ensure we don't rely on SSH to
configure anything on the VMs.

We just keep plain SSH accesses for OCP/CRC, since they can't rely on
cloud-init.
  • Loading branch information
cjeanner authored and openshift-merge-bot[bot] committed Sep 10, 2024
1 parent 44a91dd commit 3c88f0b
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
1 change: 0 additions & 1 deletion roles/libvirt_manager/tasks/create_vms.yml
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,6 @@
when:
- vm_data.disk_file_name != 'blank'
- vm is not match('^(crc|ocp).*$')
- vm_data.start | default(true) | bool
- vm_data.manage | default(true) | bool
vars:
_img_dir: "{{ cifmw_libvirt_manager_basedir }}/workload"
Expand Down
1 change: 0 additions & 1 deletion roles/libvirt_manager/tasks/deploy_layout.yml
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,6 @@
- name: "Configure managed VMs"
when:
- vm_data.manage | default(true) | bool
- vm_data.start | default(true) | bool
- vm_data.disk_file_name != 'blank'
vars:
vm_type: "{{ _vm.value }}"
Expand Down
15 changes: 8 additions & 7 deletions roles/libvirt_manager/tasks/manage_vms.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,18 +53,16 @@
ansible.builtin.include_role:
name: "ssh_jumper"

# TODO: consider ignition/butane instead
- name: "Configure ssh access on VM {{ vm }}"
vars:
_user: >-
{{
(vm_type is match('^(crc|ocp).*$')) |
ternary('core', _init_admin_user)
}}
when:
- vm is match('^(ocp|crc).*')
- _cifmw_libvirt_manager_layout.vms[vm_type].start | default(true)
ansible.builtin.shell:
cmd: >-
set -o pipefail;
cat ~/.ssh/authorized_keys |
ssh -v {{ _user }}@{{ vm_con_name }} "cat >> ~/.ssh/authorized_keys"
ssh -v core@{{ vm_con_name }} "cat >> ~/.ssh/authorized_keys"
retries: 5
delay: 10
register: _ssh_access
Expand All @@ -74,6 +72,7 @@
- name: Ensure we grow volume for OCP cluster members
when:
- vm is match('^ocp.*')
- _cifmw_libvirt_manager_layout.vms[vm_type].start | default(true)
vars:
_root_part: "{{ vm_data.root_part_id | default('1') }}"
ansible.builtin.shell:
Expand All @@ -84,6 +83,7 @@
- name: "Inject private key on hosts {{ vm }}"
when:
- vm_type is match('^controller.*$')
- _cifmw_libvirt_manager_layout.vms[vm_type].start | default(true)
delegate_to: "{{ vm_con_name }}"
remote_user: "{{ _init_admin_user }}"
ansible.builtin.copy:
Expand All @@ -96,6 +96,7 @@
- name: "Inject public key on hosts {{ vm }}"
when:
- vm_type is match('^controller.*$')
- _cifmw_libvirt_manager_layout.vms[vm_type].start | default(true)
delegate_to: "{{ vm_con_name }}"
remote_user: "{{ _init_admin_user }}"
ansible.builtin.copy:
Expand Down

0 comments on commit 3c88f0b

Please sign in to comment.