ansible-lint: add spaces around variables [E206] (#4699)

This commit is contained in:
MarkusTeufelberger
2019-05-02 23:24:21 +02:00
committed by Kubernetes Prow Robot
parent 560f50d3cd
commit e67f848abc
88 changed files with 363 additions and 353 deletions

View File

@@ -10,8 +10,8 @@
aws_access_key: "{{ aws.access_key }}"
aws_secret_key: "{{ aws.secret_key }}"
region: "{{ aws.region }}"
group_id: "{{ aws.group}}"
instance_type: "{{ aws.instance_type}}"
group_id: "{{ aws.group }}"
instance_type: "{{ aws.instance_type }}"
image: "{{ aws.ami_id }}"
wait: true
count: "{{ aws.count }}"
@@ -30,4 +30,4 @@
timeout: 300
state: started
delegate_to: localhost
with_items: "{{ec2.instances}}"
with_items: "{{ ec2.instances }}"

View File

@@ -52,20 +52,20 @@
tasks:
- name: replace_test_id
set_fact:
test_name: "{{test_id |regex_replace('\\.', '-')}}"
test_name: "{{ test_id |regex_replace('\\.', '-') }}"
- name: show vars
debug: msg="{{cloud_region}}, {{cloud_image}}"
debug: msg="{{ cloud_region }}, {{ cloud_image }}"
- set_fact:
instance_names: >-
{%- if mode in ['separate', 'ha'] -%}
["k8s-{{test_name}}-1", "k8s-{{test_name}}-2", "k8s-{{test_name}}-3"]
["k8s-{{ test_name }}-1", "k8s-{{ test_name }}-2", "k8s-{{ test_name }}-3"]
{%- else -%}
["k8s-{{test_name}}-1", "k8s-{{test_name}}-2"]
["k8s-{{ test_name }}-1", "k8s-{{ test_name }}-2"]
{%- endif -%}
- name: Manage DO instances | {{state}}
- name: Manage DO instances | {{ state }}
digital_ocean:
unique_name: yes
api_token: "{{ lookup('env','DO_API_TOKEN') }}"
@@ -73,16 +73,16 @@
image_id: "{{ cloud_image }}"
name: "{{ item }}"
private_networking: no
region_id: "{{cloud_region}}"
size_id: "{{cloud_machine_type}}"
ssh_key_ids: "{{ssh_key_id}}"
state: "{{state}}"
region_id: "{{ cloud_region }}"
size_id: "{{ cloud_machine_type }}"
ssh_key_ids: "{{ ssh_key_id }}"
state: "{{ state }}"
wait: yes
register: droplets
with_items: "{{instance_names}}"
with_items: "{{ instance_names }}"
- debug:
msg: "{{droplets}}, {{inventory_path}}"
msg: "{{ droplets }}, {{ inventory_path }}"
when: state == 'present'
- name: Template the inventory
@@ -92,6 +92,6 @@
when: state == 'present'
- name: Wait for SSH to come up
wait_for: host={{item.droplet.ip_address}} port=22 delay=10 timeout=180 state=started
with_items: "{{droplets.results}}"
wait_for: host={{ item.droplet.ip_address }} port=22 delay=10 timeout=180 state=started
with_items: "{{ droplets.results }}"
when: state == 'present'

View File

@@ -14,39 +14,39 @@
- name: replace_test_id
set_fact:
test_name: "{{test_id |regex_replace('\\.', '-')}}"
test_name: "{{ test_id |regex_replace('\\.', '-') }}"
- set_fact:
instance_names: >-
{%- if mode in ['separate', 'separate-scale', 'ha', 'ha-scale'] -%}
k8s-{{test_name}}-1,k8s-{{test_name}}-2,k8s-{{test_name}}-3
k8s-{{ test_name }}-1,k8s-{{ test_name }}-2,k8s-{{ test_name }}-3
{%- elif mode == 'aio' -%}
k8s-{{test_name}}-1
k8s-{{ test_name }}-1
{%- else -%}
k8s-{{test_name}}-1,k8s-{{test_name}}-2
k8s-{{ test_name }}-1,k8s-{{ test_name }}-2
{%- endif -%}
- name: Create gce instances
gce:
instance_names: "{{instance_names}}"
instance_names: "{{ instance_names }}"
machine_type: "{{ cloud_machine_type }}"
image: "{{ cloud_image | default(omit) }}"
image_family: "{{ cloud_image_family | default(omit) }}"
preemptible: "{{ preemptible }}"
service_account_email: "{{ gce_service_account_email }}"
pem_file: "{{ gce_pem_file | default(omit)}}"
credentials_file: "{{gce_credentials_file | default(omit)}}"
pem_file: "{{ gce_pem_file | default(omit) }}"
credentials_file: "{{ gce_credentials_file | default(omit) }}"
project_id: "{{ gce_project_id }}"
zone: "{{cloud_region}}"
metadata: '{"test_id": "{{test_id}}", "network": "{{kube_network_plugin}}", "startup-script": "{{startup_script|default("")}}"}'
tags: "build-{{test_name}},{{kube_network_plugin}}"
zone: "{{ cloud_region }}"
metadata: '{"test_id": "{{ test_id }}", "network": "{{ kube_network_plugin }}", "startup-script": "{{ startup_script|default("") }}"}'
tags: "build-{{ test_name }},{{ kube_network_plugin }}"
ip_forward: yes
service_account_permissions: ['compute-rw']
register: gce
- name: Add instances to host group
add_host: hostname={{item.public_ip}} groupname="waitfor_hosts"
with_items: '{{gce.instance_data}}'
add_host: hostname={{ item.public_ip }} groupname="waitfor_hosts"
with_items: '{{ gce.instance_data }}'
- name: Template the inventory
template:

View File

@@ -8,25 +8,25 @@
tasks:
- name: replace_test_id
set_fact:
test_name: "{{test_id |regex_replace('\\.', '-')}}"
test_name: "{{ test_id |regex_replace('\\.', '-') }}"
- set_fact:
instance_names: >-
{%- if mode in ['separate', 'ha'] -%}
k8s-{{test_name}}-1,k8s-{{test_name}}-2,k8s-{{test_name}}-3
k8s-{{ test_name }}-1,k8s-{{ test_name }}-2,k8s-{{ test_name }}-3
{%- else -%}
k8s-{{test_name}}-1,k8s-{{test_name}}-2
k8s-{{ test_name }}-1,k8s-{{ test_name }}-2
{%- endif -%}
- name: stop gce instances
gce:
instance_names: "{{instance_names}}"
instance_names: "{{ instance_names }}"
image: "{{ cloud_image | default(omit) }}"
service_account_email: "{{ gce_service_account_email }}"
pem_file: "{{ gce_pem_file | default(omit)}}"
credentials_file: "{{gce_credentials_file | default(omit)}}"
pem_file: "{{ gce_pem_file | default(omit) }}"
credentials_file: "{{ gce_credentials_file | default(omit) }}"
project_id: "{{ gce_project_id }}"
zone: "{{cloud_region | default('europe-west1-b')}}"
zone: "{{ cloud_region | default('europe-west1-b') }}"
state: 'stopped'
async: 120
poll: 3
@@ -35,13 +35,13 @@
- name: delete gce instances
gce:
instance_names: "{{instance_names}}"
instance_names: "{{ instance_names }}"
image: "{{ cloud_image | default(omit) }}"
service_account_email: "{{ gce_service_account_email }}"
pem_file: "{{ gce_pem_file | default(omit)}}"
credentials_file: "{{gce_credentials_file | default(omit)}}"
pem_file: "{{ gce_pem_file | default(omit) }}"
credentials_file: "{{ gce_credentials_file | default(omit) }}"
project_id: "{{ gce_project_id }}"
zone: "{{cloud_region | default('europe-west1-b')}}"
zone: "{{ cloud_region | default('europe-west1-b') }}"
state: 'absent'
async: 120
poll: 3

View File

@@ -16,7 +16,7 @@
test_name: "kargo-ci-{{ out.stdout_lines[0] }}"
- set_fact:
file_name: "{{ostype}}-{{kube_network_plugin}}-{{commit}}-logs.tar.gz"
file_name: "{{ ostype }}-{{ kube_network_plugin }}-{{ commit }}-logs.tar.gz"
- name: Create a bucket
gc_storage:
@@ -30,31 +30,31 @@
- name: Create a lifecycle template for the bucket
template:
src: gcs_life.json.j2
dest: "{{dir}}/gcs_life.json"
dest: "{{ dir }}/gcs_life.json"
- name: Create a boto config to access GCS
template:
src: boto.j2
dest: "{{dir}}/.boto"
dest: "{{ dir }}/.boto"
no_log: True
- name: Download gsutil cp installer
get_url:
url: https://dl.google.com/dl/cloudsdk/channels/rapid/install_google_cloud_sdk.bash
dest: "{{dir}}/gcp-installer.sh"
dest: "{{ dir }}/gcp-installer.sh"
- name: Get gsutil tool
script: "{{dir}}/gcp-installer.sh"
script: "{{ dir }}/gcp-installer.sh"
environment:
CLOUDSDK_CORE_DISABLE_PROMPTS: 1
CLOUDSDK_INSTALL_DIR: "{{dir}}"
CLOUDSDK_INSTALL_DIR: "{{ dir }}"
no_log: True
failed_when: false
- name: Apply the lifecycle rules
command: "{{dir}}/google-cloud-sdk/bin/gsutil lifecycle set {{dir}}/gcs_life.json gs://{{test_name}}"
command: "{{ dir }}/google-cloud-sdk/bin/gsutil lifecycle set {{ dir }}/gcs_life.json gs://{{ test_name }}"
environment:
BOTO_CONFIG: "{{dir}}/.boto"
BOTO_CONFIG: "{{ dir }}/.boto"
no_log: True
- name: Upload collected diagnostic info
@@ -63,13 +63,13 @@
mode: put
permission: public-read
object: "{{ file_name }}"
src: "{{dir}}/logs.tar.gz"
src: "{{ dir }}/logs.tar.gz"
headers: '{"Content-Encoding": "x-gzip"}'
gs_access_key: "{{ gs_key }}"
gs_secret_key: "{{ gs_skey }}"
expiration: "{{expire_days * 36000|int}}"
expiration: "{{ expire_days * 36000|int }}"
failed_when: false
no_log: True
- debug:
msg: "A public url https://storage.googleapis.com/{{test_name}}/{{file_name}}"
msg: "A public url https://storage.googleapis.com/{{ test_name }}/{{ file_name }}"

View File

@@ -12,14 +12,14 @@
when: not ansible_os_family in ["CoreOS", "Container Linux by CoreOS"]
- name: Check kubectl output
shell: "{{bin_dir}}/kubectl get pods --all-namespaces -owide"
shell: "{{ bin_dir }}/kubectl get pods --all-namespaces -owide"
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"
shell: "{{ bin_dir }}/kubectl get pods --all-namespaces --no-headers -o yaml"
register: run_pods_log
until:
# Check that all pods are running
@@ -32,9 +32,9 @@
no_log: true
- name: Check kubectl output
shell: "{{bin_dir}}/kubectl get pods --all-namespaces -owide"
shell: "{{ bin_dir }}/kubectl get pods --all-namespaces -owide"
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

View File

@@ -15,13 +15,13 @@
when: not ansible_os_family in ["CoreOS", "Container Linux by CoreOS"]
- name: Create test namespace
shell: "{{bin_dir}}/kubectl create namespace test"
shell: "{{ bin_dir }}/kubectl create namespace test"
- name: Run a replica controller composed of 2 pods in test ns
shell: "{{bin_dir}}/kubectl run test --image={{test_image_repo}}:{{test_image_tag}} --namespace test --replicas=2 --command -- tail -f /dev/null"
shell: "{{ bin_dir }}/kubectl run test --image={{ test_image_repo }}:{{ test_image_tag }} --namespace test --replicas=2 --command -- tail -f /dev/null"
- name: Check that all pods are running and ready
shell: "{{bin_dir}}/kubectl get pods --namespace test --no-headers -o yaml"
shell: "{{ bin_dir }}/kubectl get pods --namespace test --no-headers -o yaml"
register: run_pods_log
until:
# Check that all pods are running
@@ -34,31 +34,31 @@
no_log: true
- name: Get pod names
shell: "{{bin_dir}}/kubectl get pods -n test -o json"
shell: "{{ bin_dir }}/kubectl get pods -n test -o json"
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
command: "{{bin_dir}}/kubectl get pods -n test -o
command: "{{ bin_dir }}/kubectl get pods -n test -o
jsonpath='{range .items[?(.spec.hostNetwork)]}{.metadata.name} {.status.podIP} {.status.containerStatuses} {end}'"
register: hostnet_pods
no_log: true
- name: Get running pods
command: "{{bin_dir}}/kubectl get pods -n test -o
command: "{{ bin_dir }}/kubectl get pods -n test -o
jsonpath='{range .items[?(.status.phase==\"Running\")]}{.metadata.name} {.status.podIP} {.status.containerStatuses} {end}'"
register: running_pods
no_log: true
- name: Check kubectl output
shell: "{{bin_dir}}/kubectl get pods --all-namespaces -owide"
shell: "{{ bin_dir }}/kubectl get pods --all-namespaces -owide"
register: get_pods
no_log: true
- debug: msg="{{get_pods.stdout.split('\n')}}"
- debug: msg="{{ get_pods.stdout.split('\n') }}"
- set_fact:
kube_pods_subnet: 10.233.64.0/18
@@ -66,30 +66,30 @@
pod_ips: "{{ (pods.stdout | from_json)['items'] | selectattr('status.podIP', 'defined') | map(attribute = 'status.podIP') | list }}"
pods_hostnet: |
{% set list = hostnet_pods.stdout.split(" ") %}
{{list}}
{{ list }}
pods_running: |
{% set list = running_pods.stdout.split(" ") %}
{{list}}
{{ list }}
- 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
with_items: "{{pod_ips}}"
with_items: "{{ pod_ips }}"
- name: Ping between pods is working
shell: "{{bin_dir}}/kubectl -n test exec {{item[0]}} -- ping -c 4 {{ item[1] }}"
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
with_nested:
- "{{pod_names}}"
- "{{pod_ips}}"
- "{{ 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] }}"
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
with_nested:
- "{{pod_names}}"
- "{{pod_ips}}"
- "{{ pod_names }}"
- "{{ pod_ips }}"
- name: Delete test namespace
shell: "{{bin_dir}}/kubectl delete namespace test"
shell: "{{ bin_dir }}/kubectl delete namespace test"

View File

@@ -24,8 +24,8 @@
when: not ansible_os_family in ["CoreOS", "Container Linux by CoreOS"]
- name: Wait for netchecker server
shell: "{{ bin_dir }}/kubectl get pods -o wide --namespace {{netcheck_namespace}} | grep ^netchecker-server"
delegate_to: "{{groups['kube-master'][0]}}"
shell: "{{ bin_dir }}/kubectl get pods -o wide --namespace {{ netcheck_namespace }} | grep ^netchecker-server"
delegate_to: "{{ groups['kube-master'][0] }}"
run_once: true
register: ncs_pod
until: ncs_pod.stdout.find('Running') != -1
@@ -33,18 +33,18 @@
delay: 10
- name: Wait for netchecker agents
shell: "{{ bin_dir }}/kubectl get pods -o wide --namespace {{netcheck_namespace}} | grep '^netchecker-agent-.*Running'"
shell: "{{ bin_dir }}/kubectl get pods -o wide --namespace {{ netcheck_namespace }} | grep '^netchecker-agent-.*Running'"
run_once: true
delegate_to: "{{groups['kube-master'][0]}}"
delegate_to: "{{ groups['kube-master'][0] }}"
register: nca_pod
until: nca_pod.stdout_lines|length >= groups['k8s-cluster']|intersect(ansible_play_hosts)|length * 2
retries: 3
delay: 10
failed_when: false
- command: "{{ bin_dir }}/kubectl -n {{netcheck_namespace}} describe pod -l app={{ item }}"
- command: "{{ bin_dir }}/kubectl -n {{ netcheck_namespace }} describe pod -l app={{ item }}"
run_once: true
delegate_to: "{{groups['kube-master'][0]}}"
delegate_to: "{{ groups['kube-master'][0] }}"
no_log: false
with_items:
- netchecker-agent
@@ -56,9 +56,9 @@
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]}}"
delegate_to: "{{ groups['kube-master'][0] }}"
register: agents
retries: 18
delay: "{{ agent_report_interval }}"
@@ -77,8 +77,8 @@
- 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
delegate_to: "{{groups['kube-master'][0]}}"
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
retries: 3
@@ -97,13 +97,13 @@
- 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]}}"
delegate_to: "{{ groups['kube-master'][0] }}"
no_log: false
- command: "{{ bin_dir }}/kubectl -n kube-system logs -l k8s-app={{item}} --all-containers"
- 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]}}"
delegate_to: "{{ groups['kube-master'][0] }}"
no_log: false
with_items:
- kube-router