Skip to content

Commit

Permalink
Make pkgs vars default (#326)
Browse files Browse the repository at this point in the history
Remove packages (env.pkgs.) from all.yaml.template and use defaults
instead.

---------

Signed-off-by: Amadeuds Podvratnik <pod@de.ibm.com>
Signed-off-by: K Shiva Sai <shiva.sai.k1@ibm.com>
Signed-off-by: Da Li Liu <liudali@cn.ibm.com>
Signed-off-by: veera-damisetti <damisetti.veerabhadrarao@ibm.com>
Signed-off-by: Klaus Smolin <smolin@de.ibm.com>
Signed-off-by: Sanidhya <sanidhya@Sanidhyas-MacBook-Pro.local>
Signed-off-by: mmondics <matt.mondics@ibm.com>
Signed-off-by: Sumit Solanki <sumitsolanki@Sumits-MacBook-Pro.local>
Signed-off-by: DAMISETTI-VEERABHADRARAO <damisetti.veerabhadrarao@ibm.com>
Signed-off-by: Sanjay Yadav <sanjayyadav@Sanjays-MacBook-Pro.local>
Co-authored-by: k-shiva-sai <73527143+k-shiva-sai@users.noreply.github.com>
Co-authored-by: K Shiva Sai <shiva.sai.k1@ibm.com>
Co-authored-by: liudali <liudali@cn.ibm.com>
Co-authored-by: Veerabhadrarao Damisetti <damisetti.veerabhadrarao@ibm.com>
Co-authored-by: Klaus Smolin <88041391+smolin-de@users.noreply.github.com>
Co-authored-by: Sanidhya <ssanidhy@redhat.com>
Co-authored-by: Sanidhya <sanidhya@Sanidhyas-MacBook-Pro.local>
Co-authored-by: mmondics <46940343+mmondics@users.noreply.github.com>
Co-authored-by: Sumit Solanki <sumit.solanki@ibm.com>
Co-authored-by: Sumit Solanki <sumitsolanki@Sumits-MacBook-Pro.local>
Co-authored-by: sanjayy-ibm <sanjay.1.yadav@ibm.com>
Co-authored-by: Sanjay Yadav <sanjayyadav@Sanjays-MacBook-Pro.local>
  • Loading branch information
13 people committed Sep 9, 2024
1 parent e56c101 commit 5c56cfc
Show file tree
Hide file tree
Showing 11 changed files with 55 additions and 43 deletions.
34 changes: 19 additions & 15 deletions docs/set-variables-group-vars.md
Original file line number Diff line number Diff line change
Expand Up @@ -148,15 +148,7 @@
**env.cluster.nodes.infra.ipv6** | <b>(Optional)</b> IPv6 address of the infra nodes. iThis list can be expanded to any number of nodes, minimum 2. Use provided list formatting (if use_ipv6 variable is 'True'). | fd00::10fd00::11
**env.cluster.nodes.infra.hostname** | <b>(Optional)</b> Hostnames for infra nodes. Must match the total number of IP addresses for infra nodes. If DNS is hosted on the bastion, this can be anything. If DNS is hosted elsewhere, this must match DNS definition. This will be combined with the metadata_name and base_domain to create a Fully Qualififed Domain Name (FQDN). | infra-01infra-02

## 11 - (Optional) Packages
**Variable Name** | **Description** | **Example**
:--- | :--- | :---
**env.pkgs.galaxy** | A list of Ansible Galaxy collections that will be installed during the setup playbook. The collections listed are required. Feel free to add more as needed, just make sure to follow the same list format. | community.general
**env.pkgs.controller** | A list of packages that will be installed on the machine running Ansible during the setup playbook. Feel free to add more as needed, just make sure to follow the same list format. | openssh
**env.pkgs.kvm** | A list of packages that will be installed on the KVM Host during the setup_kvm_host playbook. Feel free to add more as needed, just make sure to follow the same list format. | qemu-kvm
**env.pkgs.bastion** | A list of packages that will be installed on the bastion during the setup_bastion playbook. Feel free to add more as needed, just make sure to follow the same list format. | haproxy

## 12 - OpenShift Settings
## 11 - OpenShift Settings
**Variable Name** | **Description** | **Example**
:--- | :--- | :---
**env.install_config.api_version** | Kubernetes API version for the cluster. These install_config variables will be passed to the OCP install_config file. This file is templated in the get_ocp role during the setup_bastion playbook. To make more fine-tuned adjustments to the install_config, you can find it at roles/get_ocp/templates/install-config.yaml.j2 | v1
Expand All @@ -171,14 +163,14 @@
**env.install_config.machine_network** | The IP address block for Nodes IP Pool. The default value is 192.168.122.0/24 For NAT Network Mode. In case of MacvTap it will be depend on Inteface IP assignment. An array with an IP address block in CIDR format. | 192.168.122.0/24
**env.install_config.fips** | True or False (boolean) for whether or not to use the United States' Federal Information Processing Standards (FIPS). Not yet certified on IBM zSystems. Enclosed in 'single quotes'. | 'false'

## 13 - (Optional) Proxy
## 12 - (Optional) Proxy
**Variable Name** | **Description** | **Example**
:--- | :--- | :---
**env.proxy.http** | (Optional) A proxy URL to use for creating HTTP connections outside the cluster. Will be used in the install-config and applied to other Ansible hosts unless set otherwise in no_proxy below. Must follow this pattern: http://username:pswd>@ip:port | http://ocp-admin:Pa$sw0rd@9.72.10.1:80
**env.proxy.https** | (Optional) A proxy URL to use for creating HTTPS connections outside the cluster. Will be used in the install-config and applied to other Ansible hosts unless set otherwise in no_proxy below. Must follow this pattern: https://username:pswd@ip:port | https://ocp-admin:Pa$sw0rd@9.72.10.1:80
**env.proxy.no** | (Optional) A comma-separated list (no spaces) of destination domain names, IP addresses, or other network CIDRs to exclude from proxying. When using a proxy, all necessary IPs and domains for your cluster will be added automatically. See roles/get_ocp/templates/install-config.yaml.j2 for more details on the template. Preface a domain with . to match subdomains only. For example, .y.com matches x.y.com, but not y.com. Use * to bypass the proxy for all listed destinations. | example.com,192.168.10.1

## 14 - (Optional) Misc
## 13 - (Optional) Misc
**Variable Name** | **Description** | **Example**
:--- | :--- | :---
**env.language** | What language would you like Red Hat Enterprise Linux to use? In UTF-8 language code. Available languages and their corresponding codes can be found [here](https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/5/html-single/international_language_support_guide/index), in the "Locale" column of Table 2.1. | en_US.UTF-8
Expand All @@ -196,7 +188,7 @@
**env.jumphost.pass** | (Optional) The password for user to login to the jumphost. | ch4ngeMe!
**env.jumphost.path_to_keypair** | (Optional) The absolute path to the public key file on the jumphost to be copied to the bastion. | /home/admin/.ssh/id_rsa.pub

## 15 - OCP and RHCOS (CoreOS)
## 14 - OCP and RHCOS (CoreOS)

**Variable Name** | **Description** | **Example**
:--- | :--- | :---
Expand All @@ -209,7 +201,7 @@
**rhcos_live_initrd** | CoreOS initramfs to be used for the bootstrap, control and compute nodes. | rhcos-4.12.3-s390x-live-initramfs.s390x.img
**rhcos_live_rootfs** | CoreOS rootfs to be used for the bootstrap, control and compute nodes. | rhcos-4.12.3-s390x-live-rootfs.s390x.img

## 16 - (Optional) Create compute node in a day-2 operation
## 15 - (Optional) Create compute node in a day-2 operation

**Variable Name** | **Description** | **Example**
:--- | :--- | :---
Expand All @@ -223,15 +215,27 @@
**day2_compute_node.host_user** | KVM host user which is used to create the VM | root
**day2_compute_node.host_arch** | KVM host architecture. | s390x

## 17 - (Optional) Agent Based Installer

## 16 - (Optional) Agent Based Installer
**Variable Name** | **Description** | **Example**
:--- | :--- | :---
**abi.flag** | This is the flag, Will be used to identify during execution. Few checks in the playbook will be depend on this (default value will be False) | True
**abi.ansible_workdir** | This will be work directory name, it will keep required data that need to be present during or after execution | ansible_workdir
**abi.ocp_installer_version** | Version will contain value of openshift-installer binary version user desired to be used | '4.15.0-rc.8'
**abi.ocp_installer_url** | This is the base url of openshift installer binary it will remain same as static value, User Do not need to give value until user wants to change the mirror | 'https://mirror.openshift.com/pub/openshift-v4/s390x/clients/ocp/'

## Packages (Optional)
* Packages are installed based on the executed playbooks based on the given requirements. This means that these variables have default values which can be overwritten in all.yaml file.
* The following table describe the current installed packages and their default values.
* In general is to say that the default values are all required. Feel free to add more if needed but it is required to specify the whole list (include default values).
* Within the all.yaml.template file you find an example of the parameter including the format.

**Variable Name** | **Description** | **Default values**
:--- | :--- | :---
**pkgs_galaxy** | A list of Ansible Galaxy collections that will be installed during the setup playbook. The collections listed are required. | [ ibm.ibm_zhmc, community.general, community.crypto, ansible.posix, community.libvirt ]
**pkgs_controller** | A list of packages that will be installed on the machine running Ansible during the setup playbook. | [ openssh, expect, sshuttle ]
**pkgs_kvm** | A list of packages that will be installed on the KVM Host during the setup_kvm_host playbook. | [ libguestfs, libvirt-client, libvirt-daemon-config-network, libvirt-daemon-kvm, cockpit-machines, libvirt-devel, virt-top, qemu-kvm, python3-lxml, cockpit, lvm2 ]
**pkgs_bastion** | A list of packages that will be installed on the bastion during the setup_bastion playbook. Feel free to add more as needed, just make sure to follow the same list format. | [ haproxy, httpd, bind, bind-utils, expect, firewalld, mod_ssl, python3-policycoreutils, rsync ]
**pkgs_zvm** | A list of packages that will be installed in case of HCP (zVM nodes) or LPAR installation. | [ git, python3-pip, python3-devel, openssl-devel, rust, cargo, libffi-devel, wget, tar, jq, gcc, make, x3270, python39 ]

## Disconnected cluster setup (Optional)
**Variable Name** | **Description** | **Example**
Expand Down
26 changes: 11 additions & 15 deletions inventories/default/group_vars/all.yaml.template
Original file line number Diff line number Diff line change
Expand Up @@ -187,15 +187,7 @@ env:
# All variables below this point do not need to be changed for a default installation #
#######################################################################################

# Section 11 - (Optional) Packages
pkgs:
galaxy: [ ibm.ibm_zhmc, community.general, community.crypto, ansible.posix, community.libvirt ]
controller: [ openssh, expect, sshuttle ]
kvm: [ libguestfs, libvirt-client, libvirt-daemon-config-network, libvirt-daemon-kvm, cockpit-machines, libvirt-devel, virt-top, qemu-kvm, python3-lxml, cockpit, lvm2 ]
bastion: [ haproxy, httpd, bind, bind-utils, expect, firewalld, mod_ssl, python3-policycoreutils, rsync ]
zvm: [ git, python3-pip, python3-devel, openssl-devel, rust, cargo, libffi-devel, wget, tar, jq, gcc, make, x3270, python39 ]

# Section 12 - OpenShift Settings
# Section 11 - OpenShift Settings
install_config:
api_version: v1
compute:
Expand All @@ -212,13 +204,13 @@ env:
machine_network: 192.168.122.0/24
fips: 'false'

# Section 13 - (Optional) Proxy
# Section 12 - (Optional) Proxy
# proxy:
# http:
# https:
# no:

# Section 14 - (Optional) Misc
# Section 13 - (Optional) Misc
language: en_US.UTF-8
timezone: America/New_York
keyboard: us
Expand All @@ -239,7 +231,7 @@ env:
pass:
path_to_keypair:

# Section 15 - OCP and RHCOS (CoreOS)
# Section 14 - OCP and RHCOS (CoreOS)

# ocp_download_url with '/' at the end !
ocp_download_url: "https://mirror.openshift.com/pub/openshift-v4/multi/clients/ocp/4.13.1/s390x/"
Expand All @@ -259,8 +251,7 @@ rhcos_live_initrd: "rhcos-4.12.3-s390x-live-initramfs.s390x.img"
rhcos_live_rootfs: "rhcos-4.12.3-s390x-live-rootfs.s390x.img"


# Section 16 - (Optional) Create additional compute node in a day-2 operation

# Section 15 - (Optional) Create additional compute node in a day-2 operation
day2_compute_node:
vm_name:
vm_hostname:
Expand All @@ -273,10 +264,15 @@ day2_compute_node:
host_arch:


# Section 17 - Agent Based Installer ( Optional )
# Section 16 - Agent Based Installer ( Optional )
abi:
flag: False
ansible_workdir: 'ansible_workdir'
ocp_installer_version: '4.15.0-rc.8'
ocp_installer_url: 'https://mirror.openshift.com/pub/openshift-v4/s390x/clients/ocp/'
boot_method: <pxe|iso>

# (Optional) Packages
# Format to overwrite the packages to be installed is:
# pkgs_controller: [ openssh, expect, sshuttle ]
# Overwrite exists for pkgs_galaxy, pkgs_controller, pkgs_kvm, pkgs_bastion, pkgs_zvm
8 changes: 2 additions & 6 deletions playbooks/0_setup.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
- "{{ inventory_dir }}/group_vars/disconnected.yaml"
roles:
- set_inventory
- install_galaxy

pre_tasks:
- name: Check disconnected variables if disconnected cluster will be installed.
Expand All @@ -18,11 +19,6 @@
when: disconnected.enabled

post_tasks:
- name: Ensure Ansible Galaxy collections have been installed with latest version.
tags: galaxy
command: ansible-galaxy collection install {{ item }} --upgrade
loop: "{{ env.pkgs.galaxy }}"

- name: Find ibm_zhmc collection install location, if automated LPAR creation is to be used.
tags: galaxy
shell: ansible-galaxy collection list ibm.ibm_zhmc | grep -i ansible | cut -c 3-
Expand Down Expand Up @@ -68,7 +64,7 @@
vars_files:
- "{{ inventory_dir }}/group_vars/all.yaml"
vars:
packages: "{{ env.pkgs.controller }}"
packages: "pkgs_controller"
ssh_target: [ "{{ env.file_server.ip }}", "{{ env.file_server.user }}", "{{ env.file_server.pass }}", "{{ path_to_key_pair }}" ]
roles:
- install_packages
Expand Down
2 changes: 1 addition & 1 deletion playbooks/3_setup_kvm_host.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
gather_facts: true
become: true
vars:
packages: "{{ env.pkgs.kvm }}"
packages: "pkgs_kvm"
roles:
- { role: attach_subscription, when: env.redhat.manage_subscription }
- install_packages
Expand Down
2 changes: 1 addition & 1 deletion playbooks/5_setup_bastion.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
tags: services, section_2
become: true
vars:
packages: "{{ env.pkgs.bastion }}"
packages: "pkgs_bastion"
control_node_count: "{{ env.cluster.nodes.control.ip | length }}"
vars_files:
- "{{ inventory_dir }}/group_vars/all.yaml"
Expand Down
2 changes: 2 additions & 0 deletions roles/install_galaxy/defaults/main.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Packages
pkgs_galaxy: [ ibm.ibm_zhmc, community.general, community.crypto, ansible.posix, community.libvirt ]
9 changes: 9 additions & 0 deletions roles/install_galaxy/tasks/main.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
- name: Print the list of Ansible Galaxy collection packages to be installed and updated.
tags: install_packages
debug: msg={{ pkgs_galaxy }}

- name: Ensure Ansible Galaxy collections have been installed with latest version.
tags: galaxy
command: ansible-galaxy collection install {{ item }} --upgrade
loop: "{{ pkgs_galaxy }}"
4 changes: 4 additions & 0 deletions roles/install_packages/defaults/main.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Packages
pkgs_controller: [ openssh, expect, sshuttle ]
pkgs_kvm: [ libguestfs, libvirt-client, libvirt-daemon-config-network, libvirt-daemon-kvm, cockpit-machines, libvirt-devel, virt-top, qemu-kvm, python3-lxml, cockpit, lvm2 ]
pkgs_bastion: [ haproxy, httpd, bind, bind-utils, expect, firewalld, mod_ssl, python3-policycoreutils, rsync ]
7 changes: 3 additions & 4 deletions roles/install_packages/tasks/main.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
---
- name: Print the list of packages to be installed and updated.
tags: install_packages
debug:
var: packages
debug: msg={{ vars[packages] }}

- name: Installing required packages for Linux machines.
tags: install_packages
Expand All @@ -11,7 +10,7 @@
name: "{{ item }}"
state: latest
update_cache: yes
loop: "{{ packages }}"
loop: "{{ vars[packages] }}"
when: ansible_os_family != 'Darwin'

- name: Installing required packages for Mac machines.
Expand All @@ -20,5 +19,5 @@
community.general.homebrew:
name: "{{ item }}"
state: latest
loop: "{{ packages }}"
loop: "{{ vars[packages] }}"
when: ansible_os_family == 'Darwin'
2 changes: 2 additions & 0 deletions roles/install_tessia_baselib/defaults/main.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Packages
pkgs_zvm: [ git, python3-pip, python3-devel, openssl-devel, rust, cargo, libffi-devel, wget, tar, jq, gcc, make, x3270, python39 ]
2 changes: 1 addition & 1 deletion roles/install_tessia_baselib/tasks/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
name:
- "{{ item }}"
state: present
loop: "{{ env.pkgs.zvm }}"
loop: "{{ pkgs_zvm }}"

- name: Install setuptools_rust using pip
pip:
Expand Down

0 comments on commit 5c56cfc

Please sign in to comment.