Fix ansible lint errors

The gate is now using the last ansible-lint version (4.0.1) which have new
ids/tags and new rules. The old tags (ANSIBLE*) should remains backwardly
compatible but this patch is using the new ones.

This patch fixes all the lint issues.

Change-Id: Ic151f3e969b8e3729394fd477bb8341d1cb75fd7
Signed-off-by: Gael Chamoulaud <gchamoul@redhat.com>
This commit is contained in:
Gael Chamoulaud 2019-01-07 14:02:04 +01:00
parent 8c33fc69e0
commit c08460c707
11 changed files with 24 additions and 23 deletions

View File

@ -1,10 +1,11 @@
#!/bin/bash
# ANSIBLE0006: Using command rather than module
# 204: Lines should be no longer than 120 chars
# 303: Using command rather than module
# we have a few use cases where we need to use curl and rsync
# ANSIBLE0016: Tasks that run when changed should likely be handlers
# 503: Tasks that run when changed should likely be handlers
# this requires refactoring roles, skipping for now
SKIPLIST="ANSIBLE0006,ANSIBLE0016"
SKIPLIST="204,303,503"
pushd validations
for playbook in `find . -type f -regex '.*\.y[a]?ml'`; do

View File

@ -29,7 +29,7 @@
- name: End play if telemetry is not enabled
meta: end_play
when: enable_telemetry.value|bool != True
when: not enable_telemetry.value|bool
- name: Get event ttl from panko configuration file
become: true

View File

@ -23,11 +23,11 @@
fail: msg="No image with the name '{{ item.name }}' found - make sure you have uploaded boot images."
failed_when: item.id | length < 1
with_items:
- { name: '{{deploy_kernel_name}}', id: '{{deploy_kernel_id}}' }
- { name: '{{deploy_ramdisk_name}}', id: '{{deploy_ramdisk_id}}' }
- { name: '{{ deploy_kernel_name }}', id: '{{ deploy_kernel_id }}' }
- { name: '{{ deploy_ramdisk_name }}', id: '{{ deploy_ramdisk_id }}' }
- name: Fail if there is more than one image
fail: msg="Please make sure there is only one image named '{{ item.name }}' in glance."
failed_when: item.id | length > 1
with_items:
- { name: '{{deploy_kernel_name}}', id: '{{deploy_kernel_id}}' }
- { name: '{{deploy_ramdisk_name}}', id: '{{deploy_ramdisk_id}}' }
- { name: '{{ deploy_kernel_name }}', id: '{{ deploy_kernel_id }}' }
- { name: '{{ deploy_ramdisk_name }}', id: '{{ deploy_ramdisk_id }}' }

View File

@ -18,7 +18,7 @@
become: true
haproxy_conf: path="{{ config_file }}"
- name: Verify global maxconn
fail: msg="The 'global maxconn' value '{{ haproxy_conf.global.maxconn}}' must be greater than {{ global_maxconn_min }}"
fail: msg="The 'global maxconn' value '{{ haproxy_conf.global.maxconn }}' must be greater than {{ global_maxconn_min }}"
failed_when: haproxy_conf.global.maxconn|int < global_maxconn_min
- name: Verify defaults maxconn
fail: msg="The 'defaults maxconn' value '{{ haproxy_conf.defaults.maxconn }}' must be greater than {{ defaults_maxconn_min }}"

View File

@ -29,7 +29,7 @@
tasks:
- name: Run neutron-sanity-check
command: "docker exec -u root neutron_ovs_agent /bin/bash -c 'neutron-sanity-check --config-file {{item}}'"
command: "docker exec -u root neutron_ovs_agent /bin/bash -c 'neutron-sanity-check --config-file {{ item }}'"
with_items: "{{ configs }}"
become: true
register: nsc_return
@ -41,14 +41,14 @@
has_errors: "{{ nsc_return.results
| sum(attribute='stderr_lines', start=[])
| select('search', '(ERROR)')
| list | length | int > 0}}"
| list | length | int > 0 }}"
- name: Detect warnings
set_fact:
has_warnings: "{{ nsc_return.results
| sum(attribute='stderr_lines', start=[])
| select('search', '(WARNING)')
| list | length | int > 0}}"
| list | length | int > 0 }}"
- name: Create output
set_fact:

View File

@ -37,7 +37,7 @@
- name: Check Nova configuration values
fail: msg="Value of {{ item.item }} is set to {{ item.value or 'None' }}."
when:
- "(item.item == vif_plugging_fatal_check and (item.value|bool == False or None)) or
- "(item.item == vif_plugging_fatal_check and (not item.value|bool or None)) or
(item.item == vif_plugging_timeout_check and (item.value|int <= vif_plugging_timeout_value_min|int
or None))"
with_items: "{{ nova_config_result.results }}"
@ -72,7 +72,7 @@
- name: Check Notify Nova settings values
fail: msg="Value of {{ item.item }} is set to {{ item.value|bool }}."
when: item.value|bool != True or item.value == None
when: not item.value|bool or item.value == None
with_items: "{{ neutron_notify_nova_result.results }}"
- name: Get Tenant Name setting value from neutron.conf

View File

@ -38,7 +38,7 @@
uri:
url: "{{ overcloud_keystone_url
| urlsplit('scheme') }}://{{ overcloud_keystone_url
| urlsplit('netloc')}}/v3/auth/tokens"
| urlsplit('netloc') }}/v3/auth/tokens"
method: POST
body_format: json
body:

View File

@ -28,7 +28,7 @@
uri:
url: "{{ overcloud_keystone_url
| urlsplit('scheme') }}://{{ overcloud_keystone_url
| urlsplit('netloc')}}/v3/auth/tokens"
| urlsplit('netloc') }}/v3/auth/tokens"
method: POST
body_format: json
body:

View File

@ -20,7 +20,7 @@
- name: Fail if the HorizonPublic endpoint is not defined
fail: msg="The `HorizonPublic` endpoint is not defined in the `EndpointMap` of the deployed stack. This means Horizon may not have been deployed correctly."
when:
- overcloud_horizon_url|default('') == ''
- overcloud_horizon_url|default('') | length == 0
- overcloud_deployed|bool
# Check connectivity to horizon
@ -32,13 +32,13 @@
- name: Fail if KeystoneURL output is not available
fail: msg="The `KeystoneURL` output is not available in the deployed stack."
when:
- overcloud_keystone_url|default('') == ''
- overcloud_keystone_url|default('') | length == 0
- overcloud_deployed|bool
# Check that we can obtain an auth token from horizon
- name: Check Keystone
uri:
url: "{{ overcloud_keystone_url | urlsplit('scheme') }}://{{ overcloud_keystone_url | urlsplit('netloc')}}/v3/auth/tokens"
url: "{{ overcloud_keystone_url | urlsplit('scheme') }}://{{ overcloud_keystone_url | urlsplit('netloc') }}/v3/auth/tokens"
method: POST
body_format: json
body:

View File

@ -5,7 +5,7 @@
- name: compare running containers to list
set_fact:
container_difference: "{{ running_containers | difference(docker.containers_filtered | map(attribute='name') | list)}}"
container_difference: "{{ running_containers | difference(docker.containers_filtered | map(attribute='name') | list) }}"
- block:
- name: check appropriate running containers against list - if FAILED, check next task

View File

@ -29,7 +29,7 @@
tasks:
- name: Run neutron-sanity-check
command: "docker exec -u root neutron_ovs_agent /bin/bash -c 'neutron-sanity-check --config-file {{item}}'"
command: "docker exec -u root neutron_ovs_agent /bin/bash -c 'neutron-sanity-check --config-file {{ item }}'"
with_items: "{{ configs }}"
become: true
register: nsc_return
@ -41,14 +41,14 @@
has_errors: "{{ nsc_return.results
| sum(attribute='stderr_lines', start=[])
| select('search', '(ERROR)')
| list | length | int > 0}}"
| list | length | int > 0 }}"
- name: Detect warnings
set_fact:
has_warnings: "{{ nsc_return.results
| sum(attribute='stderr_lines', start=[])
| select('search', '(WARNING)')
| list | length | int > 0}}"
| list | length | int > 0 }}"
- name: Create output
set_fact: