Skip to content

Commit

Permalink
Merge pull request #6 from RanabirChakraborty/AMW-232
Browse files Browse the repository at this point in the history
AMW-232 Updated Ansible validated content with redhat.openshift_virtualization collection
  • Loading branch information
RanabirChakraborty authored Apr 15, 2024
2 parents c0f6eab + 26ad809 commit d8f0c4c
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 8 deletions.
2 changes: 1 addition & 1 deletion galaxy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 3 additions & 2 deletions requirements.yml
Original file line number Diff line number Diff line change
@@ -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
- name: infra.controller_configuration
- name: redhat.openshift_virtualization
4 changes: 1 addition & 3 deletions roles/deploy_collection/tasks/configure-ocp.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
---

- name: "Create Namespace {{ collection_namespace }}"
kubernetes.core.k8s:
state: present
Expand All @@ -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: |
Expand Down Expand Up @@ -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 }}"
Expand Down
13 changes: 11 additions & 2 deletions roles/k8s_discovery/tasks/add_host.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
---

- name: Debug Queried Resource
ansible.builtin.set_fact:
k8s_discovery_msg: "{{ queried_resource }}"
Expand All @@ -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"
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

0 comments on commit d8f0c4c

Please sign in to comment.