From 37eac010c8979ca786a32ffa800f74ceb4f2a5ae Mon Sep 17 00:00:00 2001 From: Maxime Guyot Date: Wed, 17 Apr 2019 17:42:03 +0200 Subject: [PATCH] =?UTF-8?q?ansible-lint:=20Don=E2=80=99t=20compare=20to=20?= =?UTF-8?q?literal=20True/False=20(#4499)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .ansible-lint | 1 - roles/download/defaults/main.yml | 2 +- roles/kubernetes-apps/ansible/tasks/main.yml | 2 +- roles/kubernetes-apps/ansible/tasks/nodelocaldns.yml | 2 +- .../cloud_controller/oci/tasks/credentials-check.yml | 10 +++++----- .../network_plugin/cilium/tasks/main.yml | 2 +- .../network_plugin/kube-router/tasks/main.yml | 2 +- roles/kubernetes/node/tasks/main.yml | 10 ++++++++-- roles/kubernetes/node/templates/kubelet.kubeadm.env.j2 | 2 +- .../preinstall/tasks/0080-system-configurations.yml | 2 +- .../image-builder/roles/kubevirt-images/tasks/main.yml | 4 ++-- 11 files changed, 22 insertions(+), 17 deletions(-) diff --git a/.ansible-lint b/.ansible-lint index ec299eabe..547441059 100644 --- a/.ansible-lint +++ b/.ansible-lint @@ -19,6 +19,5 @@ skip_list: - '502' - '503' - '504' - - '601' - '602' - '701' diff --git a/roles/download/defaults/main.yml b/roles/download/defaults/main.yml index 6d2eb86ed..e0aba8834 100644 --- a/roles/download/defaults/main.yml +++ b/roles/download/defaults/main.yml @@ -528,7 +528,7 @@ downloads: - kube-node nodelocaldns: - enabled: "{{ enable_nodelocaldns == True }}" + enabled: "{{ enable_nodelocaldns }}" container: true repo: "{{ nodelocaldns_image_repo }}" tag: "{{ nodelocaldns_image_tag }}" diff --git a/roles/kubernetes-apps/ansible/tasks/main.yml b/roles/kubernetes-apps/ansible/tasks/main.yml index 7233af099..166b4ec4c 100644 --- a/roles/kubernetes-apps/ansible/tasks/main.yml +++ b/roles/kubernetes-apps/ansible/tasks/main.yml @@ -31,7 +31,7 @@ - name: Kubernetes Apps | nodelocalDNS import_tasks: "tasks/nodelocaldns.yml" when: - - enable_nodelocaldns == True + - enable_nodelocaldns - inventory_hostname == groups['kube-master'] | first tags: - nodelocaldns diff --git a/roles/kubernetes-apps/ansible/tasks/nodelocaldns.yml b/roles/kubernetes-apps/ansible/tasks/nodelocaldns.yml index 2f217f315..afd1e258b 100644 --- a/roles/kubernetes-apps/ansible/tasks/nodelocaldns.yml +++ b/roles/kubernetes-apps/ansible/tasks/nodelocaldns.yml @@ -32,7 +32,7 @@ /etc/resolv.conf {%- endif -%} when: - - enable_nodelocaldns == True + - enable_nodelocaldns - inventory_hostname == groups['kube-master'] | first tags: - nodelocaldns diff --git a/roles/kubernetes-apps/cloud_controller/oci/tasks/credentials-check.yml b/roles/kubernetes-apps/cloud_controller/oci/tasks/credentials-check.yml index e621b6c44..57f87973c 100644 --- a/roles/kubernetes-apps/cloud_controller/oci/tasks/credentials-check.yml +++ b/roles/kubernetes-apps/cloud_controller/oci/tasks/credentials-check.yml @@ -3,31 +3,31 @@ - name: "OCI Cloud Controller | Credentials Check | oci_private_key" fail: msg: "oci_private_key is missing" - when: (oci_use_instance_principals == false) and + when: (not oci_use_instance_principals) and (oci_private_key is not defined or oci_private_key == "") - name: "OCI Cloud Controller | Credentials Check | oci_region_id" fail: msg: "oci_region_id is missing" - when: (oci_use_instance_principals == false) and + when: (not oci_use_instance_principals) and (oci_region_id is not defined or oci_region_id == "") - name: "OCI Cloud Controller | Credentials Check | oci_tenancy_id" fail: msg: "oci_tenancy_id is missing" - when: (oci_use_instance_principals == false) and + when: (not oci_use_instance_principals) and (oci_tenancy_id is not defined or oci_tenancy_id == "") - name: "OCI Cloud Controller | Credentials Check | oci_user_id" fail: msg: "oci_user_id is missing" - when: (oci_use_instance_principals == false) and + when: (not oci_use_instance_principals) and (oci_user_id is not defined or oci_user_id == "") - name: "OCI Cloud Controller | Credentials Check | oci_user_fingerprint" fail: msg: "oci_user_fingerprint is missing" - when: (oci_use_instance_principals == false) and + when: (not oci_use_instance_principals) and (oci_user_fingerprint is not defined or oci_user_fingerprint == "") - name: "OCI Cloud Controller | Credentials Check | oci_compartment_id" diff --git a/roles/kubernetes-apps/network_plugin/cilium/tasks/main.yml b/roles/kubernetes-apps/network_plugin/cilium/tasks/main.yml index 503da1a2a..363f795a4 100755 --- a/roles/kubernetes-apps/network_plugin/cilium/tasks/main.yml +++ b/roles/kubernetes-apps/network_plugin/cilium/tasks/main.yml @@ -11,7 +11,7 @@ when: inventory_hostname == groups['kube-master'][0] and not item is skipped - name: Cilium | Wait for pods to run - command: "{{bin_dir}}/kubectl -n kube-system get pods -l k8s-app=cilium -o jsonpath='{.items[?(@.status.containerStatuses[0].ready==false)].metadata.name}'" + command: "{{bin_dir}}/kubectl -n kube-system get pods -l k8s-app=cilium -o jsonpath='{.items[?(@.status.containerStatuses[0].ready==false)].metadata.name}'" # noqa 601 register: pods_not_ready until: pods_not_ready.stdout.find("cilium")==-1 retries: 30 diff --git a/roles/kubernetes-apps/network_plugin/kube-router/tasks/main.yml b/roles/kubernetes-apps/network_plugin/kube-router/tasks/main.yml index 77f5b8bae..3f6242a7d 100644 --- a/roles/kubernetes-apps/network_plugin/kube-router/tasks/main.yml +++ b/roles/kubernetes-apps/network_plugin/kube-router/tasks/main.yml @@ -12,7 +12,7 @@ - inventory_hostname == groups['kube-master'][0] - name: kube-router | Wait for kube-router pods to be ready - command: "{{bin_dir}}/kubectl -n kube-system get pods -l k8s-app=kube-router -o jsonpath='{.items[?(@.status.containerStatuses[0].ready==false)].metadata.name}'" + command: "{{bin_dir}}/kubectl -n kube-system get pods -l k8s-app=kube-router -o jsonpath='{.items[?(@.status.containerStatuses[0].ready==false)].metadata.name}'" # noqa 601 register: pods_not_ready until: pods_not_ready.stdout.find("kube-router")==-1 retries: 30 diff --git a/roles/kubernetes/node/tasks/main.yml b/roles/kubernetes/node/tasks/main.yml index ef0be57ba..8d9d9d2a4 100644 --- a/roles/kubernetes/node/tasks/main.yml +++ b/roles/kubernetes/node/tasks/main.yml @@ -18,12 +18,18 @@ - kubelet - import_tasks: nginx-proxy.yml - when: is_kube_master == false and loadbalancer_apiserver_localhost and loadbalancer_apiserver_type == 'nginx' + when: + - not is_kube_master + - loadbalancer_apiserver_localhost + - loadbalancer_apiserver_type == 'nginx' tags: - nginx - import_tasks: haproxy.yml - when: is_kube_master == false and loadbalancer_apiserver_localhost and loadbalancer_apiserver_type == 'haproxy' + when: + - not is_kube_master + - loadbalancer_apiserver_localhost + - loadbalancer_apiserver_type == 'haproxy' tags: - haproxy diff --git a/roles/kubernetes/node/templates/kubelet.kubeadm.env.j2 b/roles/kubernetes/node/templates/kubelet.kubeadm.env.j2 index d7ad6bfc4..3923df35d 100644 --- a/roles/kubernetes/node/templates/kubelet.kubeadm.env.j2 +++ b/roles/kubernetes/node/templates/kubelet.kubeadm.env.j2 @@ -77,7 +77,7 @@ KUBELET_HOSTNAME="--hostname-override={{ kube_override_hostname }}" {% else %} {% set kubelet_args_cluster_dns %}{% endset %} {% endif %} -{% if enable_nodelocaldns == True %} +{% if enable_nodelocaldns %} {% set kubelet_args_cluster_dns %}--cluster-dns={{ nodelocaldns_ip }}{% endset %} {% endif %} {% set kubelet_args_dns %}{{ kubelet_args_cluster_dns }} --cluster-domain={{ dns_domain }} --resolv-conf={{ kube_resolv_conf }}{% endset %} diff --git a/roles/kubernetes/preinstall/tasks/0080-system-configurations.yml b/roles/kubernetes/preinstall/tasks/0080-system-configurations.yml index b355b6d30..eb87b14f4 100644 --- a/roles/kubernetes/preinstall/tasks/0080-system-configurations.yml +++ b/roles/kubernetes/preinstall/tasks/0080-system-configurations.yml @@ -12,7 +12,7 @@ state: "{{ preinstall_selinux_state }}" when: - ansible_os_family == "RedHat" - - slc.stat.exists == True + - slc.stat.exists changed_when: False tags: - bootstrap-os diff --git a/test-infra/image-builder/roles/kubevirt-images/tasks/main.yml b/test-infra/image-builder/roles/kubevirt-images/tasks/main.yml index aa0ff3410..c9a90d940 100644 --- a/test-infra/image-builder/roles/kubevirt-images/tasks/main.yml +++ b/test-infra/image-builder/roles/kubevirt-images/tasks/main.yml @@ -18,7 +18,7 @@ with_dict: - "{{ images }}" when: - - item.value.converted|bool != true + - not (item.value.converted|bool) register: converted - name: Make sure all images are ending with qcow2 @@ -26,7 +26,7 @@ with_dict: - "{{ images }}" when: - - item.value.converted|bool == true + - item.value.converted|bool - name: Resize images command: qemu-img resize {{ images_dir }}/{{ item.key }}.qcow2 +8G