Skip to content

Commit

Permalink
env.bridge_name - Documentation / naming unclear. (#246)
Browse files Browse the repository at this point in the history
For clarity rename env.bridge_name to env.vnet_name.
Basically libvirt is not creating a bridge but a
virtual network. This created network will use mode=bridge.

Fix for issue #163

Signed-off-by: Amadeuds Podvratnik <[email protected]>
  • Loading branch information
AmadeusPodvratnik authored Mar 11, 2024
1 parent e2e1208 commit b440fe5
Show file tree
Hide file tree
Showing 12 changed files with 25 additions and 19 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,8 @@
# Ansible-Automated OpenShift Provisioning on KVM on IBM zSystems / LinuxONE
The documentation for this project can be found [here](https://ibm.github.io/Ansible-OpenShift-Provisioning/).

## What's new:

###Variables renamed:

####Rename the variable defining the name of the virtual network for clarity. **env.bridge_name** is renamed to **env.vnet_name**.
2 changes: 1 addition & 1 deletion docs/set-variables-group-vars.md
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@
**env.keyboard** | Which keyboard layout would you like Red Hat Enterprise Linux to use? | us
**env.ansible_key_name** | (Optional) Name of the SSH key that Ansible will use to connect to hosts. | ansible-ocpz
**env.ocp_key_name** | Comment to describe the SSH key used for OCP. Arbitrary value. | OCPZ-01 key
**env.bridge_name** | (Optional) Name of the macvtap bridge that will be created on the KVM host or in case of NAT the name of the NAT network defenition (usually it is 'default'). If NAT is being used and a jumphost is needed, the parameters network_mode, jumphost.name, jumphost.user and jumphost.pass must be specified, too. In case of default (NAT) network verify that the configured IP ranges does not interfere with the IPs defined for the controle and compute nodes. Modify the default network (dhcp range setting) to prevent issues with VMs using dhcp and OCP nodes having fixed IPs.| macvtap-net
**env.vnet_name** | (Optional) Name of the bridged virtual network that will be created on the KVM host if network mode is not set to NAT. In case of NAT network mode the name of the NAT network definition used to create the nodes(usually it is 'default'). If NAT is being used and a jumphost is needed, the parameters network_mode, jumphost.name, jumphost.user and jumphost.pass must be specified, too. For default (NAT) network verify that the configured IP ranges does not interfere with the IPs defined for the controle and compute nodes. Modify the default network (dhcp range setting) to prevent issues with VMs using dhcp and OCP nodes having fixed IPs. Default is create a bridge network.| macvtap-net
**env.network_mode** | (Optional) In case the network mode will be NAT and the installation will be executed from remote (e.g. your laptop), a jumphost needs to be defined to let the installation access the bastion host. If macvtap for networking is being used this variable should be empty. | NAT
**env.use_ipv6** | If ipv6 addresses should be assigned to the controle and compute nodes, this variable should be true (default) and the matching ipv6 settings should be specified. | True
**env.use_dhcp** | If dhcp service should be used to get an IP address, this variable should be true and the matching mac address must be specified. | False
Expand Down
2 changes: 1 addition & 1 deletion inventories/default/group_vars/all.yaml.template
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ env:
root_access: false
ansible_key_name: ansible-ocpz
ocp_ssh_key_comment: OpenShift key
bridge_name: macvtap
vnet_name: macvtap
network_mode:
use_ipv6: True
use_dhcp: False
Expand Down
2 changes: 1 addition & 1 deletion roles/boot_agents_hypershift/tasks/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
--vcpus="{{ hypershift.agents_parms.vcpus }}" \
--location "/var/lib/libvirt/images/pxeboot/,kernel=kernel.img,initrd=initrd.img" \
--disk {{ hypershift.agents_parms.storage.pool_path }}{{ hypershift.hcp.hosted_cluster_name }}-agent{{ item }}.qcow2 \
--network network:{{ env.bridge_name }},mac=$mac_address \
--network network:{{ env.vnet_name }},mac=$mac_address \
--graphics none \
--noautoconsole \
--wait=-1 \
Expand Down
2 changes: 1 addition & 1 deletion roles/create_bastion/tasks/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
--vcpus={{ env.bastion.resources.vcpu }} \
--location {{ env.file_server.protocol }}://{{ env.file_server.user + ':' + env.file_server.pass + '@' if env.file_server.protocol == 'ftp' else '' }}{{ env.file_server.ip }}{{ ':' + env.file_server.port if env.file_server.port | default('') | length > 0 else '' }}/{{ env.file_server.iso_mount_dir }} \
--disk pool={{ env.cluster.networking.metadata_name }}-vdisk,size={{ env.bastion.resources.disk_size }} \
--network network={{ env.bridge_name }}{{ (',mac=' + env.bastion.networking.mac) if (env.bastion.networking.mac is defined and env.use_dhcp) }} \
--network network={{ env.vnet_name }}{{ (',mac=' + env.bastion.networking.mac) if (env.bastion.networking.mac is defined and env.use_dhcp) }} \
--graphics none \
--console pty,target_type=serial \
--noautoconsole --wait=-1 \
Expand Down
2 changes: 1 addition & 1 deletion roles/create_bastion_hypershift/tasks/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
--vcpus sockets=1,cores=4,threads=1 \
--disk {{ hypershift.agents_parms.storage.pool_path }}{{ hypershift.hcp.hosted_cluster_name }}-bastion.qcow2,format=qcow2,bus=virtio,cache=none \
--os-variant "rhel{{hypershift.bastion_parms.os_variant}}" \
--network network:{{ env.bridge_name }} \
--network network:{{ env.vnet_name }} \
--location '{{ env.file_server.protocol }}://{{ env.file_server.user + ':' + env.file_server.pass + '@' if env.file_server.protocol == 'ftp' else '' }}{{ env.file_server.ip }}{{ ':' + env.file_server.port if env.file_server.port | default('') | length > 0 else '' }}/{{ env.file_server.iso_mount_dir }}/' \
--rng=/dev/urandom --initrd-inject /home/libvirt/bastion.ks \
--extra-args="ks=file:/bastion.ks ip={{ hypershift.bastion_hypershift }}::{{hypershift.bastion_parms.gateway}}:{{hypershift.bastion_parms.subnet_mask}}:{{ hypershift.bastion_parms.hostname }}.{{ hypershift.bastion_parms.base_domain }}:{{ hypershift.bastion_parms.interface }}:none console=ttysclp0 nameserver={{hypershift.bastion_parms.nameserver}}" \
Expand Down
2 changes: 1 addition & 1 deletion roles/create_bootstrap/tasks/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
--ram {{ env.cluster.nodes.bootstrap.ram }} \
{{ env.cluster.nodes.bootstrap.vcpu_model_option }} \
--vcpus {{ env.cluster.nodes.bootstrap.vcpu }} \
--network network={{ env.bridge_name }}{{ (',mac=' + env.cluster.nodes.bootstrap.mac) if (env.cluster.nodes.bootstrap.mac is defined and env.use_dhcp) }} \
--network network={{ env.vnet_name }}{{ (',mac=' + env.cluster.nodes.bootstrap.mac) if (env.cluster.nodes.bootstrap.mac is defined and env.use_dhcp) }} \
--location {{ rhcos_download_url }},kernel={{ rhcos_live_kernel }},initrd={{ rhcos_live_initrd }} \
--extra-args "rd.neednet=1 coreos.inst=yes coreos.inst.install_dev=vda" \
--extra-args "coreos.live.rootfs_url=http://{{ env.bastion.networking.ip }}:8080/bin/{{ rhcos_live_rootfs }}" \
Expand Down
2 changes: 1 addition & 1 deletion roles/create_compute_node/tasks/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
--ram {{ env.cluster.nodes.compute.ram }} \
${CPU_MODEL} \
--vcpus {{ env.cluster.nodes.compute.vcpu }} \
--network network={{ env.bridge_name }}{{ (',mac=' + param_compute_node.vm_mac) if (param_compute_node.vm_mac is defined and env.use_dhcp) }} \
--network network={{ env.vnet_name }}{{ (',mac=' + param_compute_node.vm_mac) if (param_compute_node.vm_mac is defined and env.use_dhcp) }} \
--graphics none \
--console pty,target_type=serial \
--wait -1 \
Expand Down
8 changes: 4 additions & 4 deletions roles/create_compute_nodes/tasks/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
--ram {{ env.cluster.nodes.compute.ram }} \
{{ env.cluster.nodes.compute.vcpu_model_option }} \
--vcpus {{ env.cluster.nodes.compute.vcpu }} \
--network network={{ env.bridge_name }}{{ (',mac=' + env.cluster.nodes.compute.mac[i]) if (env.cluster.nodes.compute.mac[i] is defined and env.use_dhcp) }} \
--network network={{ env.vnet_name }}{{ (',mac=' + env.cluster.nodes.compute.mac[i]) if (env.cluster.nodes.compute.mac[i] is defined and env.use_dhcp) }} \
--location {{ rhcos_download_url }},kernel={{ rhcos_live_kernel }},initrd={{ rhcos_live_initrd }} \
--extra-args "rd.neednet=1 coreos.inst=yes coreos.inst.install_dev=vda" \
--extra-args "coreos.live.rootfs_url=http://{{ env.bastion.networking.ip }}:8080/bin/{{ rhcos_live_rootfs }}" \
Expand Down Expand Up @@ -47,7 +47,7 @@
--ram {{ env.cluster.nodes.infra.ram }} \
{{ env.cluster.nodes.infra.vcpu_model_option }} \
--vcpus {{ env.cluster.nodes.infra.vcpu }} \
--network network={{ env.bridge_name }} \
--network network={{ env.vnet_name }} \
--location {{ rhcos_download_url }},kernel={{ rhcos_live_kernel }},initrd={{ rhcos_live_initrd }} \
--extra-args "rd.neednet=1 coreos.inst=yes coreos.inst.install_dev=vda" \
--extra-args "coreos.live.rootfs_url=http://{{ env.bastion.networking.ip }}:8080/bin/{{ rhcos_live_rootfs }}" \
Expand Down Expand Up @@ -96,7 +96,7 @@
--ram {{ env.cluster.nodes.compute.ram }} \
{{ env.cluster.nodes.compute.vcpu_model_option }} \
--vcpus {{ env.cluster.nodes.compute.vcpu }} \
--network network={{ env.bridge_name }}{{ (',mac=' + compute_mac[i] if (compute_mac[i] is defined and env.use_dhcp) }} \
--network network={{ env.vnet_name }}{{ (',mac=' + compute_mac[i] if (compute_mac[i] is defined and env.use_dhcp) }} \
--location {{ rhcos_download_url }},kernel={{ rhcos_live_kernel }},initrd={{ rhcos_live_initrd }} \
--extra-args "rd.neednet=1 coreos.inst=yes coreos.inst.install_dev=vda" \
--extra-args "coreos.live.rootfs_url=http://{{ env.bastion.networking.ip }}:8080/bin/{{ rhcos_live_rootfs }}" \
Expand Down Expand Up @@ -129,7 +129,7 @@
--ram {{ env.cluster.nodes.infra.ram }} \
{{ env.cluster.nodes.infra.vcpu_model_option }} \
--vcpus {{ env.cluster.nodes.infra.vcpu }} \
--network network={{ env.bridge_name }} \
--network network={{ env.vnet_name }} \
--location {{ rhcos_download_url }},kernel={{ rhcos_live_kernel }},initrd={{ rhcos_live_initrd }} \
--extra-args "rd.neednet=1 coreos.inst=yes coreos.inst.install_dev=vda" \
--extra-args "coreos.live.rootfs_url=http://{{ env.bastion.networking.ip }}:8080/bin/{{ rhcos_live_rootfs }}" \
Expand Down
8 changes: 4 additions & 4 deletions roles/create_control_nodes/tasks/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
--ram {{ env.cluster.nodes.control.ram }} \
{{ env.cluster.nodes.control.vcpu_model_option }} \
--vcpus {{ env.cluster.nodes.control.vcpu }} \
--network network={{ env.bridge_name }}{{ (',mac=' + env.cluster.nodes.control.mac[i]) if (env.cluster.nodes.control.mac[i] is defined and env.use_dhcp) }} \
--network network={{ env.vnet_name }}{{ (',mac=' + env.cluster.nodes.control.mac[i]) if (env.cluster.nodes.control.mac[i] is defined and env.use_dhcp) }} \
--location {{ rhcos_download_url }},kernel={{ rhcos_live_kernel }},initrd={{ rhcos_live_initrd }} \
--extra-args "rd.neednet=1 coreos.inst=yes coreos.inst.install_dev=vda" \
--extra-args "coreos.live.rootfs_url=http://{{ env.bastion.networking.ip }}:8080/bin/{{ rhcos_live_rootfs }}" \
Expand Down Expand Up @@ -48,7 +48,7 @@
--ram {{ env.cluster.nodes.control.ram }} \
{{ env.cluster.nodes.control.vcpu_model_option }} \
--vcpus {{ env.cluster.nodes.control.vcpu }} \
--network network={{ env.bridge_name }}{{ (',mac=' + env.cluster.nodes.control.mac[0]) if (env.cluster.nodes.control.mac[0] is defined and env.use_dhcp) }} \
--network network={{ env.vnet_name }}{{ (',mac=' + env.cluster.nodes.control.mac[0]) if (env.cluster.nodes.control.mac[0] is defined and env.use_dhcp) }} \
--location {{ rhcos_download_url }},kernel={{ rhcos_live_kernel }},initrd={{ rhcos_live_initrd }} \
--extra-args "rd.neednet=1 coreos.inst=yes coreos.inst.install_dev=vda" \
--extra-args "coreos.live.rootfs_url=http://{{ env.bastion.networking.ip }}:8080/bin/{{ rhcos_live_rootfs }}" \
Expand Down Expand Up @@ -78,7 +78,7 @@
--ram {{ env.cluster.nodes.control.ram }} \
{{ env.cluster.nodes.control.vcpu_model_option }} \
--vcpus {{ env.cluster.nodes.control.vcpu }} \
--network network={{ env.bridge_name }}{{ (',mac=' + env.cluster.nodes.control.mac[1]) if (env.cluster.nodes.control.mac[1] is defined and env.use_dhcp) }} \
--network network={{ env.vnet_name }}{{ (',mac=' + env.cluster.nodes.control.mac[1]) if (env.cluster.nodes.control.mac[1] is defined and env.use_dhcp) }} \
--location {{ rhcos_download_url }},kernel={{ rhcos_live_kernel }},initrd={{ rhcos_live_initrd }} \
--extra-args "rd.neednet=1 coreos.inst=yes coreos.inst.install_dev=vda" \
--extra-args "coreos.live.rootfs_url=http://{{ env.bastion.networking.ip }}:8080/bin/{{ rhcos_live_rootfs }}" \
Expand Down Expand Up @@ -108,7 +108,7 @@
--ram {{ env.cluster.nodes.control.ram }} \
{{ env.cluster.nodes.control.vcpu_model_option }} \
--vcpus {{ env.cluster.nodes.control.vcpu }} \
--network network={{ env.bridge_name }}{{ (',mac=' + env.cluster.nodes.control.mac[2]) if (env.cluster.nodes.control.mac[2] is defined and env.use_dhcp) }} \
--network network={{ env.vnet_name }}{{ (',mac=' + env.cluster.nodes.control.mac[2]) if (env.cluster.nodes.control.mac[2] is defined and env.use_dhcp) }} \
--location {{ rhcos_download_url }},kernel={{ rhcos_live_kernel }},initrd={{ rhcos_live_initrd }} \
--extra-args "rd.neednet=1 coreos.inst=yes coreos.inst.install_dev=vda" \
--extra-args "coreos.live.rootfs_url=http://{{ env.bastion.networking.ip }}:8080/bin/{{ rhcos_live_rootfs }}" \
Expand Down
6 changes: 3 additions & 3 deletions roles/macvtap/tasks/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@
tags: macvtap
community.libvirt.virt_net:
command: define
name: "{{ env.bridge_name }}"
name: "{{ env.vnet_name }}"
xml: "{{ lookup ('template', 'macvtap.xml.j2') }}"

- name: Start macvtap bridge
tags: macvtap
community.libvirt.virt_net:
command: start
name: "{{ env.bridge_name }}"
name: "{{ env.vnet_name }}"

- name: Set macvtap bridge to autostart
tags: macvtap
community.libvirt.virt_net:
autostart: yes
name: "{{ env.bridge_name }}"
name: "{{ env.vnet_name }}"
2 changes: 1 addition & 1 deletion roles/macvtap/templates/macvtap.xml.j2
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<network>
<name>{{ env.bridge_name }}</name>
<name>{{ env.vnet_name }}</name>
<forward dev='{{ networking.device1 }}' mode='bridge'>
<interface dev='{{ networking.device1 }}'/>
</forward>
Expand Down

0 comments on commit b440fe5

Please sign in to comment.