From 26c4617e89b9e57d7b8f0ce8557885b4a479cbac Mon Sep 17 00:00:00 2001 From: Andrea Tosatto Date: Wed, 25 Sep 2019 21:06:58 +0200 Subject: [PATCH] Pass ansible-lint check --- .yamllint | 17 ++++++++++------- meta/main.yml | 2 -- tasks/docker_engine.yml | 2 +- tasks/docker_group.yml | 4 ++-- tasks/swarm_cluster.yml | 2 +- tasks/swarm_labels.yml | 2 +- 6 files changed, 15 insertions(+), 14 deletions(-) diff --git a/.yamllint b/.yamllint index 3a2255e..6803f0c 100644 --- a/.yamllint +++ b/.yamllint @@ -1,13 +1,16 @@ extends: default rules: + + # Disable line-length and truthy values reporting + line-length: disable + truthy: disable + + # Max 1 space to separate the elements in brakets braces: max-spaces-inside: 1 - level: error + + # Max 1 space in empty brackets brackets: - max-spaces-inside: 1 - level: error - line-length: disable - # NOTE(retr0h): Templates no longer fail this lint rule. - # Uncomment if running old Molecule templates. - # truthy: disable + min-spaces-inside-empty: 0 + max-spaces-inside-empty: 1 diff --git a/meta/main.yml b/meta/main.yml index 76c8487..5e6901a 100644 --- a/meta/main.yml +++ b/meta/main.yml @@ -25,7 +25,5 @@ galaxy_info: galaxy_tags: - docker - swarm - - docker-swarm - - docker-cluster dependencies: [] diff --git a/tasks/docker_engine.yml b/tasks/docker_engine.yml index c10e689..c5e0f6d 100644 --- a/tasks/docker_engine.yml +++ b/tasks/docker_engine.yml @@ -17,7 +17,7 @@ _docker_package_version: "-{{ docker_package_version }}" when: ansible_os_family == 'Debian' - when: docker_package_version != '' + when: docker_package_version | length > 0 - name: Install Docker. package: diff --git a/tasks/docker_group.yml b/tasks/docker_group.yml index 355e396..b0c538c 100644 --- a/tasks/docker_group.yml +++ b/tasks/docker_group.yml @@ -24,8 +24,8 @@ - name: Reset ansible connection after group changes (Ansible >= 2.3.0). include: reset_connection.yml static: false # we need to force dynamic inclusion here to avoid 'reset_connection' to be - # always executed even if the when condition evaluates to false on Ansible 2.4.x - # or to generate syntax errors on Ansible < 2.3 + # always executed even if the when condition evaluates to false on Ansible 2.4.x + # or to generate syntax errors on Ansible < 2.3 when: ansible_version is defined and (ansible_version.full is version_compare('2.3.0.0', '>=')) diff --git a/tasks/swarm_cluster.yml b/tasks/swarm_cluster.yml index ff10269..35b98b9 100644 --- a/tasks/swarm_cluster.yml +++ b/tasks/swarm_cluster.yml @@ -56,7 +56,7 @@ - name: Distribute the fact containing address of the first Swarm manager. set_fact: - docker_manager_address: "{{hostvars[groups['docker_swarm_manager'][0]]['docker_manager_address'] }}" + docker_manager_address: "{{ hostvars[groups['docker_swarm_manager'][0]]['docker_manager_address'] }}" when: "inventory_hostname != groups['docker_swarm_manager'][0]" - name: Join the pending Swarm worker nodes. diff --git a/tasks/swarm_labels.yml b/tasks/swarm_labels.yml index 0e3d2cb..881b925 100644 --- a/tasks/swarm_labels.yml +++ b/tasks/swarm_labels.yml @@ -3,7 +3,7 @@ - name: Get list of labels. command: >- docker inspect - --format {% raw %}'{{range $key, $value := .Spec.Labels}}{{printf "%s\n" $key}}{{end}}'{% endraw %} + --format {% raw %}'{{ range $key, $value := .Spec.Labels }}{{ printf "%s\n" $key }}{{ end }}'{% endraw %} {{ ansible_hostname }} register: docker_swarm_labels changed_when: false