Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure we configure any "managed" VM #2327

Merged
merged 1 commit into from
Sep 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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