Skip to content

Commit

Permalink
Enforce distribution name, major and minor version
Browse files Browse the repository at this point in the history
Signed-off-by: desmax74 <[email protected]>
  • Loading branch information
desmax74 committed Sep 25, 2024
1 parent b6addc3 commit 74d5ed7
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 11 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Utilize the steps below to understand how to setup and execute the provisioning.

## Prerequisites

A RHEL 9.2+ server should be used to run the Trustification components.
A RHEL 9.3+ server should be used to run the Trustification components.

Ansible must be installed and configured on a control node that will be used to perform the automation.

Expand All @@ -49,7 +49,7 @@ An installation of RH SSO/Keycloak/AWS Cognito must be provided to allow for int

#### https://docs.ansible.com/ansible/2.9/scenario_guides/guide_vagrant.html

In order to deploy Trustification on a RHEL 9.2+ VM:
In order to deploy Trustification on a RHEL 9.3+ VM:

1. Create an `inventory.ini` file in the project with a single VM in the `trustification` group:

Expand Down
14 changes: 14 additions & 0 deletions roles/tpa_single_node/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,26 @@
---
- name: Set a variable about Rhel
ansible.builtin.set_fact:
rhel: false

- name: Set a variable if is a Rhel as expected
ansible.builtin.set_fact:
rhel: true
when:
- ansible_facts['distribution'] == 'RedHat'
- ansible_facts['distribution_major_version'] == '9'
- ansible_facts['distribution_version'] == '9.3'

- name: Install Operating System Components
ansible.builtin.include_tasks: os.yml
when: rhel
args:
apply:
become: true

- name: Execute Podman Actions
ansible.builtin.include_tasks: podman.yml
when: rhel
args:
apply:
become: true
Expand Down
12 changes: 3 additions & 9 deletions roles/tpa_single_node/tasks/podman.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@
fail_msg: "tpa_single_node_registry_username is not exists, export the registry username and password"

- name: Podman login to registry.redhat.io
when:
- ansible_facts['distribution'] == 'RedHat'
- ansible_facts['distribution_major_version'] == '9'
when: rhel
ansible.builtin.command: podman login registry.redhat.io -u {{ tpa_single_node_registry_username }} -p {{ tpa_single_node_registry_password }}
register: podman_login_result
changed_when: '"Already logged in" not in podman_login_result'
Expand All @@ -27,15 +25,11 @@
name: "{{ tpa_single_node_podman_network }}"

- name: Pull trustification image from registry.redhat.io
when:
- ansible_facts['distribution'] == 'RedHat'
- ansible_facts['distribution_major_version'] == '9'
when: rhel
containers.podman.podman_image:
name: "{{ tpa_single_node_trustification_image }}"

- name: Pull Guac image from registry.redhat.io
when:
- ansible_facts['distribution'] == 'RedHat'
- ansible_facts['distribution_major_version'] == '9'
when: rhel
containers.podman.podman_image:
name: "{{ tpa_single_node_guac_image }}"

0 comments on commit 74d5ed7

Please sign in to comment.