Skip to content

Commit

Permalink
Enhancement: Updated conditions for LPAR HCP (#361)
Browse files Browse the repository at this point in the history
Updated conditions for LPAR HCP

---------

Signed-off-by: DAMISETTI-VEERABHADRARAO <[email protected]>
  • Loading branch information
veera-damisetti authored Dec 5, 2024
1 parent 0f68843 commit 10072b9
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 23 deletions.
6 changes: 3 additions & 3 deletions inventories/default/group_vars/hcp.yaml.template
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ hcp:
fcp:

lpar:
network_mode: vswitch # Supported modes: osa, RoCE
network_mode: osa # Supported modes: osa, RoCE
disk_type: # Supported modes: fcp , dasd , NVMe
subnetmask:
gateway:
Expand All @@ -149,9 +149,9 @@ hcp:
- name:
hmc_host:
interface:
ifname: encbdf0
ifname: enc1100
nettype: qeth
subchannels: 0.0.bdf0,0.0.bdf1,0.0.bdf2
subchannels: 0.0.1100,0.0.1101,0.0.1102
options: layer2=1
ip:

Expand Down
33 changes: 25 additions & 8 deletions playbooks/create_agents_and_wait_for_install_complete.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,33 +2,50 @@
hosts: kvm_host_hcp
become: true
roles:
- boot_agents_hcp
- boot_agents_hcp

- name: Boot zvm nodes
hosts: bastion_hcp
tasks:
- name: Getting packages for zvm
set_fact:
ansible.builtin.set_fact.set_fact:
env:
pkgs:
zvm: "{{ hcp.pkgs.zvm }}"
zvm: "{{ hcp.pkgs.zvm }}"
when: hcp.compute_node_type | lower == 'zvm'

- name: Install tessia baselib
import_role:
- name: Install tessia baselib
ansible.builtin.import_role:
name: install_tessia_baselib
when: hcp.compute_node_type | lower == 'zvm'

- name: Start zvm nodes
include_tasks: ../roles/boot_zvm_nodes_hcp/tasks/main.yaml
loop: "{{ range(hcp.data_plane.compute_count| int) | list }}"
loop: "{{ range(hcp.data_plane.compute_count | int) | list }}"
when: hcp.compute_node_type | lower == 'zvm'

- name: Boot LPARs
hosts: bastion_hcp
vars_files:
- "{{playbook_dir}}/secrets.yaml"
tasks:

- name: Install tessia baselib
ansible.builtin.import_role:
name: install_tessia_baselib
when: hcp.compute_node_type | lower == 'lpar'

- name: Boot LPARs
ansible.builtin.include_tasks: ../roles/boot_LPAR_hcp/tasks/main.yaml
loop: "{{ range(hcp.data_plane.compute_count | int) | list }}"
when: hcp.compute_node_type | lower == 'lpar'


- name: Scale Nodepool & Configure Haproxy on bastion for hosted workers
hosts: bastion_hcp
roles:
- scale_nodepool_and_wait_for_compute_hcp
- add_hc_workers_to_haproxy_hcp
- scale_nodepool_and_wait_for_compute_hcp
- add_hc_workers_to_haproxy_hcp

- name: Wait for all Console operators to come up
hosts: bastion_hcp
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,25 +26,25 @@
--devicenr "{{ hcp.data_plane.lpar.nodes[item].live_disk.devicenr }}" \
--livedisklun "{{ hcp.data_plane.lpar.nodes[item].live_disk.lun }}" \
--livediskwwpn "{{ hcp.data_plane.lpar.nodes[item].live_disk.wwpn }}" \
--netset_ip "{{ hcp.data_plane.zvm.nodes[item].interface.ip }}" \
--netset_gateway "{{ hcp.data_plane.zvm.gateway }}" \
--netset_ip "{{ hcp.data_plane.lpar.nodes[item].interface.ip }}" \
--netset_gateway "{{ hcp.data_plane.lpar.gateway }}" \
--netset_network_type "osa" \
--netset_network_device "{{ hcp.data_plane.zvm.nodes[item].interface.subchannels }}" \
--netset_network_device "{{ hcp.data_plane.lpar.nodes[item].interface.subchannels }}" \
--netset_password "{{ hcp.data_plane.lpar.nodes[item].live_disk.password }}" \
--netset_dns "{{ hcp.bastion_params.ip }}" \
--log_level DEBUG \
--cmdline "$(cat /root/ansible_workdir/agent-{{ item }}.parm)"
- name: Wait for the agent to come up
shell: oc get agents -n "{{ hcp.control_plane.clusters_namespace }}-{{ hcp.control_plane.hosted_cluster_name }}" --no-headers -o custom-columns=NAME:.metadata.name,APPROVED:.spec.approved | awk '$2 == "false"' | wc -l
shell: oc get agents -n {{ hcp.control_plane.hosted_cluster_name }}-agents --no-headers -o custom-columns=NAME:.metadata.name,APPROVED:.spec.approved | awk '$2 == "false"' | wc -l
register: agent_count
until: agent_count.stdout | int == 1
retries: 40
delay: 10

- name: Get the name of agent
shell: oc get agents -n {{ hcp.control_plane.clusters_namespace }}-{{ hcp.control_plane.hosted_cluster_name }} --no-headers -o custom-columns=NAME:.metadata.name,APPROVED:.spec.approved | awk '$2 == "false"'
shell: oc get agents -n {{ hcp.control_plane.hosted_cluster_name }}-agents --no-headers -o custom-columns=NAME:.metadata.name,APPROVED:.spec.approved | awk '$2 == "false"'
register: agent_name

- name: Approve agents
shell: oc -n {{ hcp.control_plane.clusters_namespace }}-{{ hcp.control_plane.hosted_cluster_name }} patch agent {{ agent_name.stdout.split(' ')[0] }} -p '{"spec":{"approved":true,"hostname":"compute-{{ item }}.{{hcp.control_plane.hosted_cluster_name }}.{{ hcp.control_plane.basedomain }}"}}' --type merge
shell: oc -n {{ hcp.control_plane.hosted_cluster_name }}-agents patch agent {{ agent_name.stdout.split(' ')[0] }} -p '{"spec":{"approved":true,"hostname":"compute-{{ item }}.{{hcp.control_plane.hosted_cluster_name }}.{{ hcp.control_plane.basedomain }}"}}' --type merge
10 changes: 5 additions & 5 deletions roles/create_hcp_InfraEnv/tasks/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -122,21 +122,21 @@
agent_mac_addr: []
when:
- hcp.data_plane.kvm.ip_params.static_ip.enabled == true
- hcp.compute_node_type | lower != 'zvm'
- hcp.compute_node_type | lower == 'kvm'

- name: Getting mac addresss for agents
set_fact:
agent_mac_addr: "{{ hcp.data_plane.kvm.ip_params.mac }}"
when:
- ( hcp.data_plane.kvm.ip_params.static_ip.enabled == true ) and ( hcp.data_plane.kvm.ip_params.mac != None )
- hcp.compute_node_type | lower != 'zvm'
- hcp.compute_node_type | lower == 'kvm'

- name: Generate mac addresses for agents
set_fact:
agent_mac_addr: "{{ agent_mac_addr + ['52:54:00' | community.general.random_mac] }}"
when:
- ( hcp.data_plane.kvm.ip_params.static_ip.enabled == true ) and ( hcp.data_plane.kvm.ip_params.mac == None )
- hcp.compute_node_type | lower != 'zvm'
- hcp.compute_node_type | lower == 'kvm'
loop: "{{ range(hcp.data_plane.compute_count|int) | list }}"

- name: Create NMState Configs
Expand All @@ -145,14 +145,14 @@
dest: /root/ansible_workdir/nmStateConfig-agent-{{ item }}.yaml
when:
- hcp.data_plane.kvm.ip_params.static_ip.enabled == true
- hcp.compute_node_type | lower != 'zvm'
- hcp.compute_node_type | lower == 'kvm'
loop: "{{ range(hcp.data_plane.compute_count|int) | list }}"

- name: Deploy NMState Configs
command: oc apply -f /root/ansible_workdir/nmStateConfig-agent-{{ item }}.yaml
when:
- hcp.data_plane.kvm.ip_params.static_ip.enabled == true
- hcp.compute_node_type | lower != 'zvm'
- hcp.compute_node_type | lower == 'kvm'
loop: "{{ range(hcp.data_plane.compute_count|int) | list }}"

- name: Wait for ISO to generate in InfraEnv
Expand Down
2 changes: 1 addition & 1 deletion roles/install_tessia_baselib/tasks/main.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
- name: Install Packages on zvm host
- name: Install Packages on host
yum:
name:
- "{{ item }}"
Expand Down

0 comments on commit 10072b9

Please sign in to comment.