diff --git a/galaxy.yml b/galaxy.yml index de5d5e6..57a2660 100644 --- a/galaxy.yml +++ b/galaxy.yml @@ -20,7 +20,7 @@ tags: - a4mw dependencies: ansible.posix: '>=1.4.0' - kubernetes.core: '>=2.4.0' + kubernetes.core: '>=3.0.1' repository: https://github.com/redhat-cop/middleware_ocpv homepage: https://github.com/redhat-cop/middleware_ocpv issues: https://github.com/redhat-cop/middleware_ocpv/issues diff --git a/requirements.yml b/requirements.yml index 3a81424..faf0778 100644 --- a/requirements.yml +++ b/requirements.yml @@ -1,8 +1,9 @@ --- collections: - name: kubernetes.core - version: ">=2.4.0" + version: ">=3.0.1" - name: ansible.posix version: ">=1.4.0" - name: ansible.controller - - name: infra.controller_configuration \ No newline at end of file + - name: infra.controller_configuration + - name: redhat.openshift_virtualization diff --git a/roles/deploy_collection/tasks/configure-ocp.yml b/roles/deploy_collection/tasks/configure-ocp.yml index 6304e18..65c4daa 100644 --- a/roles/deploy_collection/tasks/configure-ocp.yml +++ b/roles/deploy_collection/tasks/configure-ocp.yml @@ -1,5 +1,4 @@ --- - - name: "Create Namespace {{ collection_namespace }}" kubernetes.core.k8s: state: present @@ -18,7 +17,6 @@ fail_msg: "'deploy_collection_vm_ssh_public_key' is not defined" quiet: true - - name: Set cloud-init fact ansible.builtin.set_fact: deploy_collection_cloud_init_content: | @@ -46,7 +44,7 @@ template: virtualmachine.yml.j2 - name: Wait for VM to be ready - kubernetes.core.k8s_info: + kubevirt.core.kubevirt_vm_info: api_version: kubevirt.io/v1 kind: VirtualMachine name: "{{ collection_name }}" diff --git a/roles/k8s_discovery/tasks/add_host.yml b/roles/k8s_discovery/tasks/add_host.yml index 7bb7522..9cee5db 100644 --- a/roles/k8s_discovery/tasks/add_host.yml +++ b/roles/k8s_discovery/tasks/add_host.yml @@ -1,5 +1,4 @@ --- - - name: Debug Queried Resource ansible.builtin.set_fact: k8s_discovery_msg: "{{ queried_resource }}" @@ -10,4 +9,14 @@ groups: "{{ queried_resource.discovered_resource.inventory_group_name }}" ansible_host: "{{ item.status.podIP }}" loop: "{{ queried_resource.resources }}" - when: item.kind == "Pod" and item.status.phase == "Running" \ No newline at end of file + when: item.kind == "Pod" and item.status.phase == "Running" + register: add_host_result + +- name: Add host (Pods) using kubevirt plugin + plugin: kubevirt.core.kubevirt + groups: "{{ queried_resource.discovered_resource.inventory_group_name }}" + connections: + - name: "{{ item.metadata.name }}" + network_name: "{{ item.status.podIP }}" + loop: "{{ queried_resource.resources }}" + when: item.kind == "Pod" and item.status.phase == "Running" and add_host_result is not succeeded \ No newline at end of file