Skip to content

Commit

Permalink
WIP: Should now work for both
Browse files Browse the repository at this point in the history
  • Loading branch information
nocturnalastro committed Nov 22, 2023
1 parent 5317508 commit 73b8d86
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 16 deletions.
15 changes: 10 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ Requires the following to be installed on the deployment host:
- [nmstate](https://github.com/nmstate) # For baremetal deployment


### TESTING NOTES DO NOT PUBLISH
<!-- ### TESTING NOTES DO NOT PUBLISH
> [crucible@jumphost crucible]# sudo dnf history userinstalled
> Updating Subscription Management repositories.
> Packages installed by user
Expand All @@ -96,7 +96,7 @@ Requires the following to be installed on the deployment host:
> sshpass-1.09-4.el9.x86_64
> tmux-3.2a-5.el9.x86_64
> virt-install-4.1.0-4.el9.noarch
> virt-manager-4.1.0-4.el9.noarch
> virt-manager-4.1.0-4.el9.noarch -->


**Important Note** The `openshift-clients` package is part of the [Red Hat OpenShift Container Platform Subscription](https://access.redhat.com/downloads/content/290/). The repo [must be activated on the bastion host](https://docs.openshift.com/container-platform/4.14/cli_reference/openshift_cli/getting-started-cli.html#cli-installing-cli-rpm_cli-developer-commands) before the dependency installation. It is used for the post-installation cluster validation steps.
Expand All @@ -106,17 +106,22 @@ Requires the following to be installed on the deployment host:
dnf -y install ansible python3-netaddr skopeo podman openshift-clients ipmitool python3-pyghmi python3-jmespath nmstate
```

If you are using RHEL 9 then you will need to enable the codeready builders repo.
```bash
subscription-manager repos --enable codeready-builder-for-rhel-9-$(arch)-rpms
```

There's also some required Ansible Galaxy Collections that are required.

- ansible.posix
<!-- - ansible.posix
- ansible.utils
- containers.podman
- community.crypto
- name: community.general
version: '<5.0.0'
- community.libvirt
- community.libvirt -->

These colelctions can be installed with the following command:
These collections can be installed with the following command:

```bash
ansible-galaxy collection install -r requirements.yml
Expand Down
2 changes: 2 additions & 0 deletions roles/create_vms/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,5 @@ virt_packages:
- python3-libvirt

images_dir: /var/lib/libvirt/images/

is_on_rhel9: "{{ (ansible_distribution_major_version == '9' and ansible_distribution == 'RedHat') | bool }}"
4 changes: 3 additions & 1 deletion roles/create_vms/templates/create_vm.sh.j2
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,13 @@ virt-install \
--graphics vnc \
--noautoconsole \
--wait=-1 \
{% if not is_on_rhel9 %}
--boot uefi \
{% endif %}
--events on_reboot=restart \
--autostart \
--print-xml > /tmp/{{item.name}}.xml

virsh define --file /tmp/{{item.name}}.xml

virsh detach-device {{ item.name }} /tmp/{{ cluster_name }}_rng_device.xml --config

17 changes: 10 additions & 7 deletions roles/setup_sushy_tools/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,18 @@ sushy_auth_dir: "{{ sushy_dir }}/auth"
sushy_cert_dir: "{{ sushy_dir }}/cert"
sushy_auth_file: "{{ sushy_auth_dir }}/htpasswd"
sushy_data_dir: "{{ sushy_dir }}/data"
sushy_packages:
sushy_packages_rhel9:
- python3-devel
- python3-pip
- gcc
- libvirt-devel
# - libvirt
# - virt-install
# - libvirt-client
# - qemu-kvm
# - qemu-img
# - libguestfs-tools

sushy_packages_rhel8:
- python3-pip
- python3-virtualenv
- gcc
- libvirt-devel

sushy_pip_packages:
- sushy-tools
- libvirt-python
Expand All @@ -24,3 +25,5 @@ file_group: "{{ file_owner }}"

secure_sushy_tools: "{{ secure | default(true) }}"
sushy_fqdn: "{{ ansible_fqdn }}"

is_on_rhel9: "{{ (ansible_distribution_major_version == '9' and ansible_distribution == 'RedHat') | bool }}"
8 changes: 5 additions & 3 deletions roles/setup_sushy_tools/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@
become: true
block:
- name: Install required packages
package:
name: "{{ sushy_packages }}"
package: # noqa: jinja[spacing]
name: "{{ sushy_packages | default(
(is_on_rhel9 | bool) | tenery(sushy_packages_rhel9, sushy_packages_rhel8)
) }}"
state: present

- name: "Create sushy-tools directory {{ item }}"
Expand All @@ -21,7 +23,7 @@
- name: Install sushy-tools via pip in a virtual environment
pip:
name: "{{ sushy_pip_packages }}"
virtualenv_command: python3 -m venv
virtualenv_command: "{{ (is_on_rhel9 | bool) | tenery('python3 -m venv', omit) }}"
virtualenv: "{{ sushy_dir }}"

- name: Install httpd-tools for htpasswd
Expand Down

0 comments on commit 73b8d86

Please sign in to comment.