mirror of
https://github.com/kubernetes-sigs/kubespray.git
synced 2026-02-04 02:58:17 -03:30
Fix Ansible-lint error [E502] (#4743)
This commit is contained in:
committed by
Kubernetes Prow Robot
parent
13f225e6ae
commit
73c2ff17dd
@@ -7,7 +7,8 @@
|
||||
bin_dir: "/opt/bin"
|
||||
when: ansible_os_family in ["CoreOS", "Container Linux by CoreOS"]
|
||||
|
||||
- set_fact:
|
||||
- name: Force binaries directory for other hosts
|
||||
set_fact:
|
||||
bin_dir: "/usr/local/bin"
|
||||
when: not ansible_os_family in ["CoreOS", "Container Linux by CoreOS"]
|
||||
|
||||
@@ -16,7 +17,8 @@
|
||||
register: get_pods
|
||||
no_log: true
|
||||
|
||||
- debug: msg="{{ get_pods.stdout.split('\n') }}"
|
||||
- debug:
|
||||
msg: "{{ get_pods.stdout.split('\n') }}"
|
||||
|
||||
- name: Check that all pods are running and ready
|
||||
shell: "{{ bin_dir }}/kubectl get pods --all-namespaces --no-headers -o yaml"
|
||||
@@ -36,5 +38,6 @@
|
||||
register: get_pods
|
||||
no_log: true
|
||||
|
||||
- debug: msg="{{ get_pods.stdout.split('\n') }}"
|
||||
- debug:
|
||||
msg: "{{ get_pods.stdout.split('\n') }}"
|
||||
failed_when: not run_pods_log is success
|
||||
|
||||
@@ -10,7 +10,8 @@
|
||||
bin_dir: "/opt/bin"
|
||||
when: ansible_os_family in ["CoreOS", "Container Linux by CoreOS"]
|
||||
|
||||
- set_fact:
|
||||
- name: Force binaries directory for other hosts
|
||||
set_fact:
|
||||
bin_dir: "/usr/local/bin"
|
||||
when: not ansible_os_family in ["CoreOS", "Container Linux by CoreOS"]
|
||||
|
||||
@@ -38,7 +39,8 @@
|
||||
register: pods
|
||||
no_log: true
|
||||
|
||||
- debug: msg="{{ pods.stdout.split('\n') }}"
|
||||
- debug:
|
||||
msg: "{{ pods.stdout.split('\n') }}"
|
||||
failed_when: not run_pods_log is success
|
||||
|
||||
- name: Get hostnet pods
|
||||
@@ -58,9 +60,11 @@
|
||||
register: get_pods
|
||||
no_log: true
|
||||
|
||||
- debug: msg="{{ get_pods.stdout.split('\n') }}"
|
||||
- debug:
|
||||
msg: "{{ get_pods.stdout.split('\n') }}"
|
||||
|
||||
- set_fact:
|
||||
- name: Set networking facts
|
||||
set_fact:
|
||||
kube_pods_subnet: 10.233.64.0/18
|
||||
pod_names: "{{ (pods.stdout | from_json)['items'] | map(attribute = 'metadata.name') | list }}"
|
||||
pod_ips: "{{ (pods.stdout | from_json)['items'] | selectattr('status.podIP', 'defined') | map(attribute = 'status.podIP') | list }}"
|
||||
@@ -74,19 +78,25 @@
|
||||
- name: Check pods IP are in correct network
|
||||
assert:
|
||||
that: item | ipaddr(kube_pods_subnet)
|
||||
when: not item in pods_hostnet and item in pods_running
|
||||
when:
|
||||
- not item in pods_hostnet
|
||||
- item in pods_running
|
||||
with_items: "{{ pod_ips }}"
|
||||
|
||||
- name: Ping between pods is working
|
||||
shell: "{{ bin_dir }}/kubectl -n test exec {{ item[0] }} -- ping -c 4 {{ item[1] }}"
|
||||
when: not item[0] in pods_hostnet and not item[1] in pods_hostnet
|
||||
when:
|
||||
- not item[0] in pods_hostnet
|
||||
- not item[1] in pods_hostnet
|
||||
with_nested:
|
||||
- "{{ pod_names }}"
|
||||
- "{{ pod_ips }}"
|
||||
|
||||
- name: Ping between hostnet pods is working
|
||||
shell: "{{ bin_dir }}/kubectl -n test exec {{ item[0] }} -- ping -c 4 {{ item[1] }}"
|
||||
when: item[0] in pods_hostnet and item[1] in pods_hostnet
|
||||
when:
|
||||
- item[0] in pods_hostnet
|
||||
- item[1] in pods_hostnet
|
||||
with_nested:
|
||||
- "{{ pod_names }}"
|
||||
- "{{ pod_ips }}"
|
||||
|
||||
@@ -19,7 +19,8 @@
|
||||
bin_dir: "/opt/bin"
|
||||
when: ansible_os_family in ["CoreOS", "Container Linux by CoreOS"]
|
||||
|
||||
- set_fact:
|
||||
- name: Force binaries directory on other hosts
|
||||
set_fact:
|
||||
bin_dir: "/usr/local/bin"
|
||||
when: not ansible_os_family in ["CoreOS", "Container Linux by CoreOS"]
|
||||
|
||||
@@ -42,7 +43,8 @@
|
||||
delay: 10
|
||||
failed_when: false
|
||||
|
||||
- command: "{{ bin_dir }}/kubectl -n {{ netcheck_namespace }} describe pod -l app={{ item }}"
|
||||
- name: Get netchecker pods
|
||||
command: "{{ bin_dir }}/kubectl -n {{ netcheck_namespace }} describe pod -l app={{ item }}"
|
||||
run_once: true
|
||||
delegate_to: "{{ groups['kube-master'][0] }}"
|
||||
no_log: false
|
||||
@@ -51,12 +53,15 @@
|
||||
- netchecker-agent-hostnet
|
||||
when: not nca_pod is success
|
||||
|
||||
- debug: var=nca_pod.stdout_lines
|
||||
- debug:
|
||||
var: nca_pod.stdout_lines
|
||||
failed_when: not nca_pod is success
|
||||
run_once: true
|
||||
|
||||
- name: Get netchecker agents
|
||||
uri: url=http://{{ ansible_default_ipv4.address }}:{{ netchecker_port }}/api/v1/agents/ return_content=yes
|
||||
uri:
|
||||
url: "http://{{ ansible_default_ipv4.address }}:{{ netchecker_port }}/api/v1/agents/"
|
||||
return_content: yes
|
||||
run_once: true
|
||||
delegate_to: "{{ groups['kube-master'][0] }}"
|
||||
register: agents
|
||||
@@ -68,7 +73,8 @@
|
||||
failed_when: false
|
||||
no_log: true
|
||||
|
||||
- debug: var=agents.content|from_json
|
||||
- debug:
|
||||
var: agents.content | from_json
|
||||
failed_when: not agents is success and not agents.content=='{}'
|
||||
run_once: true
|
||||
when:
|
||||
@@ -77,7 +83,10 @@
|
||||
- agents.content[0] == '{'
|
||||
|
||||
- name: Check netchecker status
|
||||
uri: url=http://{{ ansible_default_ipv4.address }}:{{ netchecker_port }}/api/v1/connectivity_check status_code=200 return_content=yes
|
||||
uri:
|
||||
url: "http://{{ ansible_default_ipv4.address }}:{{ netchecker_port }}/api/v1/connectivity_check"
|
||||
status_code: 200
|
||||
return_content: yes
|
||||
delegate_to: "{{ groups['kube-master'][0] }}"
|
||||
run_once: true
|
||||
register: result
|
||||
@@ -90,17 +99,20 @@
|
||||
when:
|
||||
- agents.content != '{}'
|
||||
|
||||
- debug: var=ncs_pod
|
||||
- debug:
|
||||
var: ncs_pod
|
||||
run_once: true
|
||||
when: not result is success
|
||||
|
||||
- command: "{{ bin_dir }}/kubectl -n kube-system logs -l k8s-app=kube-proxy"
|
||||
- name: Get kube-proxy logs
|
||||
command: "{{ bin_dir }}/kubectl -n kube-system logs -l k8s-app=kube-proxy"
|
||||
run_once: true
|
||||
when: not result is success
|
||||
delegate_to: "{{ groups['kube-master'][0] }}"
|
||||
no_log: false
|
||||
|
||||
- command: "{{ bin_dir }}/kubectl -n kube-system logs -l k8s-app={{ item }} --all-containers"
|
||||
- name: Get logs from other apps
|
||||
command: "{{ bin_dir }}/kubectl -n kube-system logs -l k8s-app={{ item }} --all-containers"
|
||||
run_once: true
|
||||
when: not result is success
|
||||
delegate_to: "{{ groups['kube-master'][0] }}"
|
||||
@@ -115,7 +127,8 @@
|
||||
- calico-node
|
||||
- cilium
|
||||
|
||||
- debug: var=result.content|from_json
|
||||
- debug:
|
||||
var: result.content | from_json
|
||||
failed_when: not result is success
|
||||
run_once: true
|
||||
when:
|
||||
@@ -123,13 +136,15 @@
|
||||
- result.content
|
||||
- result.content[0] == '{'
|
||||
|
||||
- debug: var=result
|
||||
- debug:
|
||||
var: result
|
||||
failed_when: not result is success
|
||||
run_once: true
|
||||
when:
|
||||
- not agents.content == '{}'
|
||||
|
||||
- debug: msg="Cannot get reports from agents, consider as PASSING"
|
||||
- debug:
|
||||
msg: "Cannot get reports from agents, consider as PASSING"
|
||||
run_once: true
|
||||
when:
|
||||
- agents.content == '{}'
|
||||
|
||||
Reference in New Issue
Block a user