From bc43b3b994394e8749fac3312952cbb57ee431e9 Mon Sep 17 00:00:00 2001 From: Sandwich Date: Thu, 12 Feb 2026 23:47:41 +0100 Subject: [PATCH] refactor(standardize): remove redundant variables, deduplicate conditionals --- roles/configuration/templates/network.j2 | 2 -- roles/environment/tasks/main.yml | 16 +++------------- roles/global_defaults/tasks/system.yml | 1 - 3 files changed, 3 insertions(+), 16 deletions(-) diff --git a/roles/configuration/templates/network.j2 b/roles/configuration/templates/network.j2 index fd8ebd9..203f1bc 100644 --- a/roles/configuration/templates/network.j2 +++ b/roles/configuration/templates/network.j2 @@ -16,8 +16,6 @@ method=auto {% endif %} {% if idx | int == 0 and dns_list %} dns={{ dns_list | join(';') }} -{% endif %} -{% if idx | int == 0 and dns_list %} ignore-auto-dns=true {% endif %} {% if idx | int == 0 and search_list %} diff --git a/roles/environment/tasks/main.yml b/roles/environment/tasks/main.yml index 8205260..e464df8 100644 --- a/roles/environment/tasks/main.yml +++ b/roles/environment/tasks/main.yml @@ -208,11 +208,6 @@ - name: Configure RHEL Repos for installation when: is_rhel | bool block: - - name: Select repository template - ansible.builtin.set_fact: - environment_repo_template: "{{ os | lower }}" - changed_when: false - - name: Create directories for repository files and RPM GPG keys ansible.builtin.file: path: /etc/yum.repos.d @@ -221,8 +216,8 @@ - name: Create RHEL repository file ansible.builtin.template: - src: "{{ environment_repo_template }}.repo.j2" - dest: /etc/yum.repos.d/{{ environment_repo_template }}.repo + src: "{{ os }}.repo.j2" + dest: /etc/yum.repos.d/{{ os }}.repo mode: "0644" - name: Check for third-party preparation tasks @@ -252,9 +247,4 @@ when: - thirdparty_preparation_tasks_path | length > 0 - environment_thirdparty_tasks_stat.stat.exists - ansible.builtin.include_tasks: >- - {{ - thirdparty_preparation_tasks_path - if thirdparty_preparation_tasks_path | regex_search('^/') - else playbook_dir + '/' + thirdparty_preparation_tasks_path - }} + ansible.builtin.include_tasks: "{{ environment_thirdparty_tasks_path }}" diff --git a/roles/global_defaults/tasks/system.yml b/roles/global_defaults/tasks/system.yml index 84145fa..87a38ac 100644 --- a/roles/global_defaults/tasks/system.yml +++ b/roles/global_defaults/tasks/system.yml @@ -3,7 +3,6 @@ ansible.builtin.set_fact: system: "{{ system | default({}) }}" - - name: Validate system input types ansible.builtin.assert: that: