diff --git a/roles/tpa_single_node/tasks/main.yml b/roles/tpa_single_node/tasks/main.yml index d43b843a..30842ca7 100644 --- a/roles/tpa_single_node/tasks/main.yml +++ b/roles/tpa_single_node/tasks/main.yml @@ -1,12 +1,30 @@ --- +- name: Set a variable if is a Rhel as expected + ansible.builtin.set_fact: + isRhel: true + 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 + 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 diff --git a/roles/tpa_single_node/tasks/podman.yml b/roles/tpa_single_node/tasks/podman.yml index e258e781..f935a3ba 100644 --- a/roles/tpa_single_node/tasks/podman.yml +++ b/roles/tpa_single_node/tasks/podman.yml @@ -6,14 +6,12 @@ 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 }}" @@ -21,20 +19,16 @@ 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 }}"