Skip to content

Commit f12c64e

Browse files
authored
Merge pull request #116 from marcelmamula/issue101
sap_hypervisor_node_preconfigure: Fix ansible-lint errors from issue 101
2 parents 58b61a3 + 1e25072 commit f12c64e

18 files changed

Lines changed: 77 additions & 69 deletions

.ansible-lint

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,10 @@ exclude_paths:
55
- .ansible/
66
- .cache/
77
- .github/
8-
#- docs/
8+
- docs/
99
- changelogs/ # Changelog files are missing '---' required in normal yml files.
1010
- roles/sap_vm_preconfigure # Role is WIP
11-
# TODO: Remove when ansible-lint issues are resolved (Issue #101).
12-
- roles/sap_hypervisor_node_preconfigure
11+
- roles/sap_vm_verify # Role is WIP
1312

1413
enable_list:
1514
- yaml
@@ -25,10 +24,15 @@ skip_list:
2524
- schema
2625
# Allow templating inside name because it creates more detailed output:
2726
- name[template]
28-
- yaml[comments]
29-
- yaml[line-length]
27+
# Allow command tasks without defining changed_when
3028
- no-changed-when
31-
- no-tabs
29+
# Allow tasks that could be replaced by handlers
3230
- no-handler
31+
# Disable jinja formatting check
3332
- jinja[spacing]
34-
- var-naming[no-jinja]
33+
34+
# Disabled skips, because they are not not required now.
35+
# - yaml[comments]
36+
# - yaml[line-length]
37+
# - no-tabs
38+
# - var-naming[no-jinja]

roles/sap_hypervisor_node_preconfigure/.ansible-lint

Lines changed: 0 additions & 16 deletions
This file was deleted.
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
---
22

3-
# ibmpower_phyp, redhat_ocp_virt, redhat_rhel_kvm, vmware_vsphere
4-
sap_hypervisor_node_preconfigure_platform:
3+
# Define which hypervisor platform to use (String).
4+
# Available options: redhat_ocp_virt, redhat_rhel_kvm
5+
sap_hypervisor_node_preconfigure_platform: ''
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
---
22
- name: Hypervisor node preconfigure - Include Handler Tasks for {{ sap_hypervisor_node_preconfigure_platform }}
3-
ansible.builtin.import_tasks: "platform/{{ sap_hypervisor_node_preconfigure_platform }}/main.yml"
3+
ansible.builtin.include_tasks:
4+
file: "platform/{{ sap_hypervisor_node_preconfigure_platform }}/main.yml"
5+
when: (role_path ~ '/handlers/platform/' ~ sap_hypervisor_node_preconfigure_platform ~ '/main.yml') is file
Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,21 @@
11
---
2+
- name: Assert that the variable 'sap_hypervisor_node_preconfigure_platform' is defined and valid
3+
ansible.builtin.assert:
4+
that:
5+
- sap_hypervisor_node_preconfigure_platform is defined
6+
- sap_hypervisor_node_preconfigure_platform is string
7+
- sap_hypervisor_node_preconfigure_platform | trim | length > 0
8+
- sap_hypervisor_node_preconfigure_platform in ['redhat_ocp_virt', 'redhat_rhel_kvm']
9+
fail_msg: |
10+
The variable 'sap_hypervisor_node_preconfigure_platform' is undefined or invalid.
11+
Available options: redhat_ocp_virt, redhat_rhel_kvm
12+
213
- name: SAP certified hypervisor node preconfigure - Include Vars for {{ sap_hypervisor_node_preconfigure_platform }}
3-
ansible.builtin.include_vars: "platform_defaults_{{ sap_hypervisor_node_preconfigure_platform }}.yml"
14+
ansible.builtin.include_vars:
15+
file: "platform_defaults_{{ sap_hypervisor_node_preconfigure_platform }}.yml"
16+
when: (role_path ~ '/vars/platform_defaults_' ~ sap_hypervisor_node_preconfigure_platform ~ '.yml') is file
417

518
- name: SAP certified hypervisor node preconfigure - Include Tasks for {{ sap_hypervisor_node_preconfigure_platform }}
6-
ansible.builtin.include_tasks: "platform/{{ sap_hypervisor_node_preconfigure_platform }}/main.yml"
19+
ansible.builtin.include_tasks:
20+
file: "platform/{{ sap_hypervisor_node_preconfigure_platform }}/main.yml"
21+
when: (role_path ~ '/tasks/platform/' ~ sap_hypervisor_node_preconfigure_platform ~ '/main.yml') is file

roles/sap_hypervisor_node_preconfigure/tasks/platform/redhat_ocp_virt/cluster/wait-mcp-finished-updating.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
- name: Wait for worker MachineConfigPool to start updating
2+
- name: Wait for worker MachineConfigPool to start updating # noqa: ignore-errors
33
kubernetes.core.k8s_info:
44
api_version: machineconfiguration.openshift.io/v1
55
kind: MachineConfigPool

roles/sap_hypervisor_node_preconfigure/tasks/platform/redhat_ocp_virt/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
__sap_hypervisor_node_preconfigure_register_worker_memory_gib:
4646
"{{ (__sap_hypervisor_node_preconfigure_register_nodes[0]['status']['capacity']['memory'] | replace('Ki', '') | int / 1048576) }}"
4747

48-
- name: Check if host has minimal amount of memory (96GiB)
48+
- name: Check if host has minimal amount of memory (96GiB) # noqa: ignore-errors
4949
ansible.builtin.assert:
5050
that: __sap_hypervisor_node_preconfigure_register_worker_memory_gib | int >= 96
5151
fail_msg: "Not enough memory on node {{ __sap_hypervisor_node_preconfigure_register_worker_name }}"

roles/sap_hypervisor_node_preconfigure/tasks/platform/redhat_ocp_virt/operators/install-cnv-operator.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
vars:
5757
install_plan_name: "{{ __sap_hypervisor_node_preconfigure_register_cnv_subscription_install_plan_name.stdout }}"
5858
block:
59-
- name: Get Install Plan details
59+
- name: Get Install Plan details # noqa: ignore-errors
6060
kubernetes.core.k8s_info:
6161
api_version: operators.coreos.com/v1alpha1
6262
kind: InstallPlan
@@ -73,7 +73,7 @@
7373
msg: "Install Plan is not Complete after the specified wait period."
7474
when: __sap_hypervisor_node_preconfigure_register_wait_for_installplan.resources[0].status.phase != "Complete"
7575

76-
- name: Wait and check for pod with label name hyperconverged-cluster-webhook under "{{ sap_hypervisor_node_preconfigure_ocpv_namespace }}" namespace
76+
- name: Wait and check for pod with label name hyperconverged-cluster-webhook under the namespace "{{ sap_hypervisor_node_preconfigure_ocpv_namespace }}"
7777
kubernetes.core.k8s_info:
7878
kind: Pod
7979
namespace: "{{ sap_hypervisor_node_preconfigure_ocpv_namespace }}"
@@ -84,7 +84,7 @@
8484
delay: 60
8585
until: hco_webhook_pod.resources | selectattr('status.phase', 'equalto', 'Running') | list | length == hco_webhook_pod.resources | length
8686

87-
- name: Wait and check for pod with name hco-webhook under "{{ sap_hypervisor_node_preconfigure_ocpv_namespace }}" namespace
87+
- name: Wait and check for pod with name hco-webhook under the namespace "{{ sap_hypervisor_node_preconfigure_ocpv_namespace }}"
8888
kubernetes.core.k8s_info:
8989
kind: Pod
9090
namespace: "{{ sap_hypervisor_node_preconfigure_ocpv_namespace }}"
@@ -95,7 +95,7 @@
9595
delay: 60
9696
until: __sap_hypervisor_node_preconfigure_register_hco_webhook_pod.resources | selectattr('status.phase', 'equalto', 'Running') | list | length == __sap_hypervisor_node_preconfigure_register_hco_webhook_pod.resources | length
9797

98-
- name: Wait and check if hco-webhook-service exists in "{{ sap_hypervisor_node_preconfigure_ocpv_namespace }}" namespace
98+
- name: Wait and check if hco-webhook-service exists in the namespace "{{ sap_hypervisor_node_preconfigure_ocpv_namespace }}"
9999
kubernetes.core.k8s_info:
100100
kind: Service
101101
namespace: "{{ sap_hypervisor_node_preconfigure_ocpv_namespace }}"

roles/sap_hypervisor_node_preconfigure/tasks/platform/redhat_ocp_virt/operators/install-nmstate-operator.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@
100100
delay: 10
101101
until: nmstate_status.resources | length > 0
102102

103-
- name: Wait and check for pod with label name nmstate-webhook under "{{ sap_hypervisor_node_preconfigure_nmstate_namespace }}" namespace
103+
- name: Wait and check for pod with label name nmstate-webhook under the namespace "{{ sap_hypervisor_node_preconfigure_nmstate_namespace }}"
104104
kubernetes.core.k8s_info:
105105
kind: Pod
106106
namespace: "{{ sap_hypervisor_node_preconfigure_nmstate_namespace }}"

roles/sap_hypervisor_node_preconfigure/tasks/platform/redhat_ocp_virt/operators/install-sriov-operator.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
delay: 10
4848
until: subscription_status.resources[0].status.installplan.name is defined
4949

50-
- name: Wait for InstallPlan to complete for SR-IOV
50+
- name: Wait for InstallPlan to complete for SR-IOV # noqa: ignore-errors
5151
kubernetes.core.k8s_info:
5252
api_version: operators.coreos.com/v1alpha1
5353
kind: InstallPlan
@@ -56,7 +56,7 @@
5656
register: installplan_status
5757
retries: 30
5858
delay: 10
59-
ignore_errors: yes
59+
ignore_errors: true
6060
until: installplan_status.resources[0].status.phase == "Complete"
6161

6262
- name: Verify SR-IOV Operator is running
@@ -70,14 +70,14 @@
7070
delay: 10
7171
until: operatorgroup_status.resources
7272

73-
- name: Check if SriovOperatorConfig exists
73+
- name: Check if SriovOperatorConfig exists # noqa: ignore-errors
7474
kubernetes.core.k8s_info:
7575
api_version: sriovnetwork.openshift.io/v1
7676
kind: SriovOperatorConfig
7777
name: default
7878
namespace: openshift-sriov-network-operator
7979
register: sriov_operator_config_status
80-
ignore_errors: yes
80+
ignore_errors: true
8181

8282
- name: Enable unsupported NICs for SR-IOV usage if the resource exists
8383
kubernetes.core.k8s:

0 commit comments

Comments
 (0)