Skip to content

Commit

Permalink
make sure nmstate is installed before generating ISO
Browse files Browse the repository at this point in the history
Add nmstate as a dependency before a deployment.
Also include a fail message in the generate ISO
step if nmstatectl command is missing.
  • Loading branch information
manurodriguez authored and nocturnalastro committed Jul 26, 2023
1 parent e0ae7c3 commit 35bebe4
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 7 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,14 @@ Requires the following to be installed on the deployment host:
- [kubectl + oc](https://docs.openshift.com/container-platform/4.10/cli_reference/openshift_cli/getting-started-cli.html)
- [pyghmi](https://pypi.org/project/pyghmi/) #For PXE deployment
- [ipmitool](https://github.com/ipmitool/ipmitool) #For PXE deployment
- [nmstate](https://github.com/nmstate) # For baremetal deployment


**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.12/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.


```bash
dnf -y install ansible python3-netaddr skopeo podman openshift-clients ipmitool python3-pyghmi python3-jmespath
dnf -y install ansible python3-netaddr skopeo podman openshift-clients ipmitool python3-pyghmi python3-jmespath nmstate
```

There's also some required Ansible modules that can be installed with the following command:
Expand Down
22 changes: 16 additions & 6 deletions roles/generate_agent_iso/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,22 @@
mode: 0755
recurse: true

- name: Generate ISO
ansible.builtin.shell:
cmd: "{{ agent_based_installer_path }} --log-level=debug agent create image"
chdir: "{{ manifests_dir }}"
environment:
XDG_RUNTIME_DIR: "{{ config_file_path }}"
- name: Generate an ISO and print message if there is a failure
block:
- name: Generate ISO
ansible.builtin.shell:
cmd: "{{ agent_based_installer_path }} --log-level=debug agent create image"
chdir: "{{ manifests_dir }}"
environment:
XDG_RUNTIME_DIR: "{{ config_file_path }}"
register: gen_iso
rescue:
- name: Print message about nmstate package missing
fail:
msg: "nmstate package missing in the bastion. See Dependencies section in README.md for more details."
when:
- gen_iso.stderr is defined
- gen_iso.stderr | regex_search("nmstatectl(.*) executable file not found")

- name: Put discovery iso in http store
delegate_to: http_store
Expand Down

0 comments on commit 35bebe4

Please sign in to comment.