Fix failures of ansible-lint (#8401)
This fixes the following types of failures: - empty-string-compare - literal-compare - risky-file-permissions - risky-shell-pipe - var-spacing In addition, this changes .gitlab-ci/lint.yml to block the same issue by using the same method at Kubespray CI.
This commit is contained in:
parent
642725efe7
commit
73c889eb10
8 changed files with 20 additions and 17 deletions
|
@ -23,9 +23,8 @@ ansible-lint:
|
||||||
extends: .job
|
extends: .job
|
||||||
stage: unit-tests
|
stage: unit-tests
|
||||||
tags: [light]
|
tags: [light]
|
||||||
# lint every yml/yaml file that looks like it contains Ansible plays
|
script:
|
||||||
script: |-
|
- ansible-lint -v
|
||||||
grep -Rl '^- hosts: \|^ hosts: ' --include \*.yml --include \*.yaml . | xargs -P 4 -n 25 ansible-lint -v
|
|
||||||
except: ['triggers', 'master']
|
except: ['triggers', 'master']
|
||||||
|
|
||||||
syntax-check:
|
syntax-check:
|
||||||
|
|
|
@ -178,6 +178,7 @@
|
||||||
template:
|
template:
|
||||||
src: unqualified.conf.j2
|
src: unqualified.conf.j2
|
||||||
dest: "/etc/containers/registries.conf.d/01-unqualified.conf"
|
dest: "/etc/containers/registries.conf.d/01-unqualified.conf"
|
||||||
|
mode: 0644
|
||||||
notify: restart crio
|
notify: restart crio
|
||||||
|
|
||||||
- name: Write cri-o proxy drop-in
|
- name: Write cri-o proxy drop-in
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
- name: install
|
- name: install
|
||||||
file: argocd-install.yml
|
file: argocd-install.yml
|
||||||
namespace: "{{ argocd_namespace }}"
|
namespace: "{{ argocd_namespace }}"
|
||||||
url: "https://raw.githubusercontent.com/argoproj/argo-cd/{{argocd_version}}/manifests/install.yaml"
|
url: "https://raw.githubusercontent.com/argoproj/argo-cd/{{ argocd_version }}/manifests/install.yaml"
|
||||||
when:
|
when:
|
||||||
- "inventory_hostname == groups['kube_control_plane'][0]"
|
- "inventory_hostname == groups['kube_control_plane'][0]"
|
||||||
|
|
||||||
|
@ -33,7 +33,7 @@
|
||||||
- name: Kubernetes Apps | Set ArgoCD namespace for remote manifests
|
- name: Kubernetes Apps | Set ArgoCD namespace for remote manifests
|
||||||
become: yes
|
become: yes
|
||||||
command: |
|
command: |
|
||||||
{{ bin_dir }}/yq eval-all -i '.metadata.namespace="{{argocd_namespace}}"' {{ kube_config_dir }}/{{ item.file }}
|
{{ bin_dir }}/yq eval-all -i '.metadata.namespace="{{ argocd_namespace }}"' {{ kube_config_dir }}/{{ item.file }}
|
||||||
with_items: "{{ argocd_templates | selectattr('url', 'defined') | list }}"
|
with_items: "{{ argocd_templates | selectattr('url', 'defined') | list }}"
|
||||||
loop_control:
|
loop_control:
|
||||||
label: "{{ item.file }}"
|
label: "{{ item.file }}"
|
||||||
|
@ -67,10 +67,10 @@
|
||||||
- name: Kubernetes Apps | Set ArgoCD custom admin password
|
- name: Kubernetes Apps | Set ArgoCD custom admin password
|
||||||
become: yes
|
become: yes
|
||||||
shell: |
|
shell: |
|
||||||
{{ bin_dir }}/kubectl --kubeconfig /etc/kubernetes/admin.conf -n {{argocd_namespace}} patch secret argocd-secret -p \
|
{{ bin_dir }}/kubectl --kubeconfig /etc/kubernetes/admin.conf -n {{ argocd_namespace }} patch secret argocd-secret -p \
|
||||||
'{
|
'{
|
||||||
"stringData": {
|
"stringData": {
|
||||||
"admin.password": "{{argocd_admin_password|password_hash('bcrypt')}}",
|
"admin.password": "{{ argocd_admin_password | password_hash('bcrypt') }}",
|
||||||
"admin.passwordMtime": "'$(date +%FT%T%Z)'"
|
"admin.passwordMtime": "'$(date +%FT%T%Z)'"
|
||||||
}
|
}
|
||||||
}'
|
}'
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
---
|
---
|
||||||
- name: gVisor | Create addon dir
|
- name: gVisor | Create addon dir
|
||||||
file:
|
file:
|
||||||
path: "{{ kube_config_dir}}/addons/gvisor"
|
path: "{{ kube_config_dir }}/addons/gvisor"
|
||||||
owner: root
|
owner: root
|
||||||
group: root
|
group: root
|
||||||
mode: 0755
|
mode: 0755
|
||||||
|
@ -15,7 +15,7 @@
|
||||||
- name: gVisort | Create manifests
|
- name: gVisort | Create manifests
|
||||||
template:
|
template:
|
||||||
src: "{{ item.file }}.j2"
|
src: "{{ item.file }}.j2"
|
||||||
dest: "{{ kube_config_dir}}/addons/gvisor/{{ item.file }}"
|
dest: "{{ kube_config_dir }}/addons/gvisor/{{ item.file }}"
|
||||||
mode: 0644
|
mode: 0644
|
||||||
with_items: "{{ gvisor_templates }}"
|
with_items: "{{ gvisor_templates }}"
|
||||||
register: gvisor_manifests
|
register: gvisor_manifests
|
||||||
|
@ -25,7 +25,7 @@
|
||||||
- name: gVisor | Apply manifests
|
- name: gVisor | Apply manifests
|
||||||
kube:
|
kube:
|
||||||
name: "{{ item.item.name }}"
|
name: "{{ item.item.name }}"
|
||||||
kubectl: "{{ bin_dir}}/kubectl"
|
kubectl: "{{ bin_dir }}/kubectl"
|
||||||
resource: "{{ item.item.type }}"
|
resource: "{{ item.item.type }}"
|
||||||
filename: "{{ kube_config_dir }}/addons/gvisor/{{ item.item.file }}"
|
filename: "{{ kube_config_dir }}/addons/gvisor/{{ item.item.file }}"
|
||||||
state: "latest"
|
state: "latest"
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
- name: RBD Provisioner | Remove legacy namespace
|
- name: RBD Provisioner | Remove legacy namespace
|
||||||
command: >
|
command: >
|
||||||
{{ kubectl }} delete namespace {{ rbd_provisioner_namespace }}
|
{{ kubectl }} delete namespace {{ rbd_provisioner_namespace }}
|
||||||
ignore_errors: true # noqa ignore-errrors
|
ignore_errors: true # noqa ignore-errors
|
||||||
when:
|
when:
|
||||||
- inventory_hostname == groups['kube_control_plane'][0]
|
- inventory_hostname == groups['kube_control_plane'][0]
|
||||||
tags:
|
tags:
|
||||||
|
@ -21,7 +21,7 @@
|
||||||
- name: RBD Provisioner | Remove legacy storageclass
|
- name: RBD Provisioner | Remove legacy storageclass
|
||||||
command: >
|
command: >
|
||||||
{{ kubectl }} delete storageclass {{ rbd_provisioner_storage_class }}
|
{{ kubectl }} delete storageclass {{ rbd_provisioner_storage_class }}
|
||||||
ignore_errors: true # noqa ignore-errrors
|
ignore_errors: true # noqa ignore-errors
|
||||||
when:
|
when:
|
||||||
- inventory_hostname == groups['kube_control_plane'][0]
|
- inventory_hostname == groups['kube_control_plane'][0]
|
||||||
tags:
|
tags:
|
||||||
|
|
|
@ -8,21 +8,21 @@
|
||||||
fail:
|
fail:
|
||||||
msg: "registry_service_cluster_ip support only compatible with ClusterIP."
|
msg: "registry_service_cluster_ip support only compatible with ClusterIP."
|
||||||
when:
|
when:
|
||||||
- registry_service_cluster_ip is defined and registry_service_cluster_ip != ""
|
- registry_service_cluster_ip is defined and registry_service_cluster_ip|length > 0
|
||||||
- registry_service_type != "ClusterIP"
|
- registry_service_type != "ClusterIP"
|
||||||
|
|
||||||
- name: Registry | Stop if registry_service_loadbalancer_ip is defined when registry_service_type is not 'LoadBalancer'
|
- name: Registry | Stop if registry_service_loadbalancer_ip is defined when registry_service_type is not 'LoadBalancer'
|
||||||
fail:
|
fail:
|
||||||
msg: "registry_service_loadbalancer_ip support only compatible with LoadBalancer."
|
msg: "registry_service_loadbalancer_ip support only compatible with LoadBalancer."
|
||||||
when:
|
when:
|
||||||
- registry_service_loadbalancer_ip is defined and registry_service_loadbalancer_ip != ""
|
- registry_service_loadbalancer_ip is defined and registry_service_loadbalancer_ip|length > 0
|
||||||
- registry_service_type != "LoadBalancer"
|
- registry_service_type != "LoadBalancer"
|
||||||
|
|
||||||
- name: Registry | Stop if registry_service_nodeport is defined when registry_service_type is not 'NodePort'
|
- name: Registry | Stop if registry_service_nodeport is defined when registry_service_type is not 'NodePort'
|
||||||
fail:
|
fail:
|
||||||
msg: "registry_service_nodeport support only compatible with NodePort."
|
msg: "registry_service_nodeport support only compatible with NodePort."
|
||||||
when:
|
when:
|
||||||
- registry_service_nodeport is defined and registry_service_nodeport != ""
|
- registry_service_nodeport is defined and registry_service_nodeport|length > 0
|
||||||
- registry_service_type != "NodePort"
|
- registry_service_type != "NodePort"
|
||||||
|
|
||||||
- name: Registry | Create addon dir
|
- name: Registry | Create addon dir
|
||||||
|
@ -59,7 +59,7 @@
|
||||||
registry_templates: "{{ registry_templates + [item] }}"
|
registry_templates: "{{ registry_templates + [item] }}"
|
||||||
with_items:
|
with_items:
|
||||||
- [{ name: registry-ing, file: registry-ing.yml, type: ing }]
|
- [{ name: registry-ing, file: registry-ing.yml, type: ing }]
|
||||||
when: ingress_nginx_enabled == true or ingress_alb_enabled == true
|
when: ingress_nginx_enabled or ingress_alb_enabled
|
||||||
|
|
||||||
- name: Registry | Create manifests
|
- name: Registry | Create manifests
|
||||||
template:
|
template:
|
||||||
|
|
|
@ -12,5 +12,7 @@
|
||||||
when: dummy0.stat.exists
|
when: dummy0.stat.exists
|
||||||
|
|
||||||
- name: reset | get and remove remaining routes set by bird
|
- name: reset | get and remove remaining routes set by bird
|
||||||
shell: ip route show proto bird | xargs -i bash -c "ip route del {} proto bird "
|
shell: set -o pipefail && ip route show proto bird | xargs -i bash -c "ip route del {} proto bird "
|
||||||
|
args:
|
||||||
|
executable: /bin/bash
|
||||||
changed_when: false
|
changed_when: false
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
template:
|
template:
|
||||||
src: "{{ item.file }}.j2"
|
src: "{{ item.file }}.j2"
|
||||||
dest: "{{ kube_config_dir }}/{{ item.file }}"
|
dest: "{{ kube_config_dir }}/{{ item.file }}"
|
||||||
|
mode: 0644
|
||||||
with_items:
|
with_items:
|
||||||
- {name: ovn-daemonset, file: ovn-daemonset.yml}
|
- {name: ovn-daemonset, file: ovn-daemonset.yml}
|
||||||
- {name: ovn4nfv-k8s-plugin, file: ovn4nfv-k8s-plugin.yml}
|
- {name: ovn4nfv-k8s-plugin, file: ovn4nfv-k8s-plugin.yml}
|
||||||
|
|
Loading…
Reference in a new issue