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 6bc371f commit 8f4dcdb
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 13 deletions.
18 changes: 18 additions & 0 deletions roles/tpa_single_node/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,30 @@
---
- name: Set a variable if is a Rhel as expected
ansible.builtin.set_fact:
isRhel: true

Check failure on line 4 in roles/tpa_single_node/tasks/main.yml

View workflow job for this annotation

GitHub Actions / ansible-lint

var-naming[pattern]

Variables names should match ^\[a-z_]\[a-z0-9_]*$ regex. (isRhel) (set_fact: isRhel)
when:
- ansible_facts['distribution'] == 'RedHat'
- ansible_facts['distribution_major_version'] == '9'
- ansible_facts['distribution_major_version'] == '2'

- name: Set a variable if is not a Rhel as expected
ansible.builtin.set_fact:
isRhel: false

Check failure on line 12 in roles/tpa_single_node/tasks/main.yml

View workflow job for this annotation

GitHub Actions / ansible-lint

var-naming[pattern]

Variables names should match ^\[a-z_]\[a-z0-9_]*$ regex. (isRhel) (set_fact: isRhel)
when:
- ansible_facts['distribution'] != 'RedHat'
- ansible_facts['distribution_major_version'] != '9'
- ansible_facts['distribution_major_version'] != '2'

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

- name: Execute Podman Actions
ansible.builtin.include_tasks: podman.yml
when: isRhel
args:
apply:
become: true
Expand Down
20 changes: 7 additions & 13 deletions roles/tpa_single_node/tasks/podman.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,35 +6,29 @@
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: isRhel
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'

- name: Create Manifests/Configs Directory
- name: "Create Manifests/Configs Directory"
ansible.builtin.file:
state: directory
dest: "{{ item }}"
mode: "0700"
loop:
- "{{ tpa_single_node_kube_manifest_dir }}"

- name: Create RHTPA network
- name: "Create RHTPA network"
containers.podman.podman_network:
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'
- name: "Pull trustification image from registry.redhat.io"
when: isRhel
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'
- name: "Pull Guac image from registry.redhat.io"
when: isRhel
containers.podman.podman_image:
name: "{{ tpa_single_node_guac_image }}"

0 comments on commit 8f4dcdb

Please sign in to comment.