From 124c8ae0ad99b137048607380ba0320287270ef5 Mon Sep 17 00:00:00 2001 From: Guido Grazioli Date: Tue, 15 Feb 2022 13:14:36 +0100 Subject: [PATCH] Fix linter errors --- .ansible-lint | 24 ++++++++++++------- .github/workflows/ci.yml | 2 +- molecule/default/molecule.yml | 3 ++- roles/keycloak/tasks/fastpackages/check.yml | 2 +- roles/keycloak/tasks/fastpackages/install.yml | 3 ++- roles/keycloak/tasks/install.yml | 2 +- roles/keycloak/tasks/main.yml | 1 + roles/keycloak/tasks/systemd.yml | 3 ++- 8 files changed, 25 insertions(+), 15 deletions(-) diff --git a/.ansible-lint b/.ansible-lint index 5c3a479..4271927 100644 --- a/.ansible-lint +++ b/.ansible-lint @@ -1,19 +1,25 @@ - rulesdir: - - ../../rules/ +# .ansible-lint +exclude_paths: + - .cache/ + - .github/ + - molecule/ + +rulesdir: + - ../../ansible-lint-custom-rules/rules/ enable_list: - fqcn-builtins # opt-in - no-log-password # opt-in warn_list: - - role_vars_start_with_role_name # All role parameters must be named ^_.* - - vars_in_vars_files_have_valid_names # Variable in vars files must have valid name - - vars_should_not_be_used # vars should not be used - - experimental # all rules tagged as experimental - - ignore-errors # Use failed_when and specify error conditions instead of using ignore_errors - - no-handler # Tasks that run when changed should likely be handlers + - role_vars_start_with_role_name + - vars_in_vars_files_have_valid_names + - vars_should_not_be_used + - experimental + - ignore-errors + - no-handler - fqcn-builtins - no-log-password use_default_rules: true -offline: false +offline: true diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5f866e7..9a72e5c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -33,7 +33,7 @@ jobs: uses: actions/checkout@v2 with: repository: ansible-middleware/ansible-lint-custom-rules - path: ansible_collections/rules/ + path: ansible_collections/ansible-lint-custom-rules/ - name: Create default collection path run: | diff --git a/molecule/default/molecule.yml b/molecule/default/molecule.yml index eb0452d..6052316 100644 --- a/molecule/default/molecule.yml +++ b/molecule/default/molecule.yml @@ -5,7 +5,8 @@ dependency: driver: name: docker lint: | - ansible-lint roles/* + ansible-lint --version + ansible-lint -vv platforms: - name: instance image: registry.access.redhat.com/ubi8/ubi-init:latest diff --git a/roles/keycloak/tasks/fastpackages/check.yml b/roles/keycloak/tasks/fastpackages/check.yml index a31d28b..4b88e72 100644 --- a/roles/keycloak/tasks/fastpackages/check.yml +++ b/roles/keycloak/tasks/fastpackages/check.yml @@ -8,7 +8,7 @@ changed_when: rpm_info.failed rescue: - - name: "If package {{ package_name }} is missing, add it to the yum install list." + - name: "Add {{ package_name }} to the yum install list if missing" set_fact: packages_to_install: "{{ packages_to_install + [ package_name ] }}" when: rpm_info.failed \ No newline at end of file diff --git a/roles/keycloak/tasks/fastpackages/install.yml b/roles/keycloak/tasks/fastpackages/install.yml index 0f71965..7d36432 100644 --- a/roles/keycloak/tasks/fastpackages/install.yml +++ b/roles/keycloak/tasks/fastpackages/install.yml @@ -1,5 +1,6 @@ --- -- set_fact: +- name: Set facts + set_fact: update_cache: true packages_to_install: [] diff --git a/roles/keycloak/tasks/install.yml b/roles/keycloak/tasks/install.yml index 2ca47f3..145d0a2 100644 --- a/roles/keycloak/tasks/install.yml +++ b/roles/keycloak/tasks/install.yml @@ -81,7 +81,7 @@ - not keycloak_rhsso_enable - not keycloak_offline_install -- name: Performing download from RHN +- name: Perform download from RHN redhat_csp_download: url: "{{ keycloak_rhsso_download_url }}" dest: "{{ local_path.stat.path }}/{{ keycloak.bundle }}" diff --git a/roles/keycloak/tasks/main.yml b/roles/keycloak/tasks/main.yml index 6ee9041..de74447 100644 --- a/roles/keycloak/tasks/main.yml +++ b/roles/keycloak/tasks/main.yml @@ -38,6 +38,7 @@ - "-rmaster" - "-u{{ keycloak_admin_user }}" - "-p{{ keycloak_admin_password }}" + changed_when: yes become: yes - name: "Restart {{ keycloak.service_name }}" include_tasks: tasks/restart_keycloak.yml diff --git a/roles/keycloak/tasks/systemd.yml b/roles/keycloak/tasks/systemd.yml index ca63491..69a23ab 100644 --- a/roles/keycloak/tasks/systemd.yml +++ b/roles/keycloak/tasks/systemd.yml @@ -56,7 +56,8 @@ - keycloak_service_status is defined - keycloak_service_status.stdout is defined -- meta: flush_handlers +- name: Flush handlers + meta: flush_handlers - name: "Wait until Keycloak becomes active {{ keycloak.health_url }}" uri: