From: Chris Wheeler Date: Fri, 21 Mar 2025 20:16:47 +0000 (-0700) Subject: OKD O-Cloud bug fixes and docs updates X-Git-Tag: l-release~15 X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=commitdiff_plain;h=e51a2474ab26c21f6898d5d3784f7b0c9e6d2edb;p=pti%2Frtp.git OKD O-Cloud bug fixes and docs updates - Updated README to clarify prerequisites and inventory contents - Skip ocloud_infra_vm and ocloud_infra_baremetal roles if OKD is already deployed (i.e. if ocloud_platform_image is defined) - Install yq in ocloud_platform_stolostron role - Remove erroneous dependency on 'bastion' host in setup_http_store role Issue-ID: INF-492 Change-Id: Iaf6aa925b577220458e9d7253536a0a56961f6d5 Signed-Off-By: Chris Wheeler --- diff --git a/okd/README.md b/okd/README.md index deb777a5..7087bc9b 100644 --- a/okd/README.md +++ b/okd/README.md @@ -13,16 +13,35 @@ Currently supported Kubernetes platforms and infrastructure targets are: # Prerequisites The following prerequisites must be installed on the host where the playbook will be run (localhost, by default): -# DNS -To enable network access to cluster services, DNS address records must be defined for the following endpoints: +## Deployer -* api.. (e.g. api.ocloud.example.com) -* api-int.. (e.g. api-int.ocloud.example.com) -* *.apps.. (e.g. *.apps.ocloud.example.com) +A Linux deployer host is required from which to execute Ansible playbooks. By default, localhost is used as the deployer. +A minimum of 2GB must be available in /tmp for generation of the installer boot image. -In the case of all-in-one topology clusters, all addresses must resolve to the machine network IP assigned to the node. +## Packages -The okd/playbooks/deploy_dns.yml playbook can be used to deploy dnsmasq if a DNS server needs to be configured. +Several packages are required by Ansible modules or deployment scripts that are invoked by Ansible roles, including: + +- ansible +- make +- pip +- wget +- python development headers/libraries +- libvirt development headers/libraries + +Following are examples of how to install these packages on common distributions: +``` + +Fedora Linux +``` +dnf install https://dl.fedoraproject.org/pub/epel/epel{,-next}-release-latest-9.noarch.rpm +dnf group install "Development Tools" +dnf install python3-devel python3-libvirt python3-netaddr ansible pip pkgconfig libvirt-devel python-lxml nmstate wget make +``` + +Ubuntu Linux +``` +apt-get install libpython3-dev python3-libvirt python3-netaddr ansible python3-pip wget make ## Ansible @@ -30,7 +49,7 @@ Install Ansible per [Installing Ansible on specific operating systems](https://d ## libvirt/KVM -If deploying the O-Cloud as a virtual machine, the host must be configured as a libvirt/KVM host. +If deploying the O-Cloud as a virtual machine, the host (as defined in the 'kvm' inventory group) must be configured as a libvirt/KVM host. Instructions for doing so vary by Linux distribution, for example: - [Fedora](https://docs.fedoraproject.org/en-US/quick-docs/virtualization-getting-started/) @@ -38,6 +57,9 @@ Instructions for doing so vary by Linux distribution, for example: Ensure that the 'libvirt-devel' package is installed, as it is a dependency for the 'libvirt-python' module. +Ensure that the images filesystem (as defined by the 'ocloud_infra_vm_disk_dir' variable) has enough space to accomodate the size of +the VM disk image (as defined by the 'ocloud_infra_vm_disk_gb' variable). + ## Python Modules Install required python modules by installing via the package manager (e.g. yum, dnf, apt) or running: @@ -54,10 +76,37 @@ Install required Ansible collections by running: ansible-galaxy collection install -r requirements.yml ``` +## DNS +To enable network access to cluster services, DNS address records must be defined for the following endpoints: + +* api.. (e.g. api.ocloud.example.com) +* api-int.. (e.g. api-int.ocloud.example.com) +* *.apps.. (e.g. *.apps.ocloud.example.com) + +In the case of all-in-one topology clusters, all addresses must resolve to the machine network IP assigned to the node. + +The okd/playbooks/deploy_dns.yml playbook can be used to deploy dnsmasq if a DNS server needs to be configured. + +## HTTP +An HTTP server is required for bare metal deployment in order to provide a source from which to mount the +installer image via virtual media. The okd/playbooks/deploy_http_store.yml playbook can be used to deploy one if needed. + +The following inventory variables must be defined for the 'http_store' host if the okd/playbooks/deploy_http_store.yml playbook +is being used (see okd/inventory/host_vars/http_store/ for example): +- ansible_host: hostname/IP of the HTTP store that will serve the agent-based installer ISO image +- http_store_dir: document root on the HTTP store where thet agent-based installer ISO image will be copied +- http_port: port on which the HTTP store listens + ## Ansible Variables ### General +Update inventory/hosts.yml to specify the deployment target host(s) under the 'ocloud' group. The sample +inventory can be used without modification to deploy to a VM host. For bare metal deployment, populate +the 'ocloud' group with the hostname(s) of the baremetal server(s) and create a directory for each +host under inventory/host_vars/ containing required variables as defined under [Infrastructure / Bare Metal](#infrastructure--bare-metal) +below. + #### Optional The following variables can be set to override deployment defaults: - ocloud_infra [default="vm"]: infrastructure target (supported values: "vm", "baremetal") @@ -99,13 +148,6 @@ The following variables must be set for deploying to a bare metal infrastructure - ocloud_ntp_servers: list of NTP servers to configure (see okd/playbooks/deploy_ntp.yml if an NTP server needs to be deployed) - role: cluster role of the node (supported values: "master") -#### Inventory -The following inventory variables must be defined for the 'http_store' host (see okd/inventory/host_vars/http_store/ for example -x inventory and okd/playbooks/deploy_http_store.yml if an HTTP store needs to be deployed): -- ansible_host: hostname/IP of the HTTP store that will serve the agent-based installer ISO image -- http_store_dir: document root on the HTTP store where thet agent-based installer ISO image will be copied -- http_port: port on which the HTTP store listens - #### Optional ### Platform / OKD diff --git a/okd/roles/ocloud/tasks/main.yml b/okd/roles/ocloud/tasks/main.yml index 38469977..4e20b804 100644 --- a/okd/roles/ocloud/tasks/main.yml +++ b/okd/roles/ocloud/tasks/main.yml @@ -9,13 +9,13 @@ ansible.builtin.import_role: name: "ocloud_infra_vm" delegate_to: "{{ groups['kvm'][0] }}" - when: ocloud_infra == "vm" + when: ocloud_infra == "vm" and ocloud_platform_image is defined - name: Include infra role - {{ ocloud_infra }} ansible.builtin.import_role: name: "ocloud_infra_baremetal" delegate_to: "{{ groups['deployer'][0] }}" - when: ocloud_infra == "baremetal" + when: ocloud_infra == "baremetal" and ocloud_platform_image is defined - meta: flush_handlers diff --git a/okd/roles/ocloud_platform_stolostron/defaults/main.yml b/okd/roles/ocloud_platform_stolostron/defaults/main.yml index ec967847..deec31d6 100644 --- a/okd/roles/ocloud_platform_stolostron/defaults/main.yml +++ b/okd/roles/ocloud_platform_stolostron/defaults/main.yml @@ -3,3 +3,4 @@ ocloud_platform_stolostron_pull_secret: "{{ ocloud_platform_okd_pull_secret }}" ocloud_platform_stolostron_kubeconfig: "{{ ocloud_platform_okd_kubeconfig }}" ocloud_platform_stolostron_snapshot: "2.11.2-SNAPSHOT-2024-08-27-14-52-55" ocloud_platform_stolostron_repo_url: "https://github.com/stolostron/deploy.git" +ocloud_platform_stolostron_yq_url: "https://github.com/mikefarah/yq/releases/download/v4.45.1/yq_linux_amd64" diff --git a/okd/roles/ocloud_platform_stolostron/tasks/main.yml b/okd/roles/ocloud_platform_stolostron/tasks/main.yml index cc446c12..afe3185e 100644 --- a/okd/roles/ocloud_platform_stolostron/tasks/main.yml +++ b/okd/roles/ocloud_platform_stolostron/tasks/main.yml @@ -39,6 +39,12 @@ dest: "{{ ocloud_platform_stolostron_staging_dir['path'] }}/bin" remote_src: true +- name: Download yq + ansible.builtin.get_url: + url: "{{ ocloud_platform_stolostron_yq_url }}" + dest: "{{ ocloud_platform_stolostron_staging_dir['path'] }}/bin/yq" + mode: '0555' + - name: Clone stolostron/deploy repo ansible.builtin.git: repo: "{{ ocloud_platform_stolostron_repo_url }}" diff --git a/okd/roles/setup_http_store/tasks/validate.yml b/okd/roles/setup_http_store/tasks/validate.yml index 34e5f336..54989150 100644 --- a/okd/roles/setup_http_store/tasks/validate.yml +++ b/okd/roles/setup_http_store/tasks/validate.yml @@ -17,7 +17,7 @@ url: "{{ http_host }}/{{ test_file_name }}" return_content: true register: response - delegate_to: bastion + delegate_to: "{{ groups['deployer'][0] }}" - name: Check content matches ansible.builtin.assert: