ansible-lint: Fix name[template] warnings

Jinja templates should only be at the end of 'name'. This helps with
the identification of tasks inside the source code when they fail.

Signed-off-by: Wen Liang <liangwen12year@gmail.com>
This commit is contained in:
Wen Liang 2023-02-28 17:00:06 -05:00 committed by Fernando Fernández Mancera
parent e8fef16995
commit 4bac670e65
15 changed files with 33 additions and 31 deletions

View file

@ -1,6 +1,6 @@
# SPDX-License-Identifier: BSD-3-Clause
---
- name: Set {{ profile }} down
- name: Set down {{ profile }}
hosts: all
vars:
network_connections:

View file

@ -85,7 +85,7 @@
args:
chdir: "{{ _rundir.path }}"
- name: "Create {{ _rundir.path }}/ansible"
- name: "Create subdirectory './ansible' under '{{ _rundir.path }}'"
file:
state: directory
path: "{{ _rundir.path }}/ansible"

View file

@ -94,16 +94,16 @@
persistent_state: absent
state: down
- name: Get the port1 profile "{{ port1_profile }}" from the active
connection
- name: From the active connection, get the port1 profile
"{{ port1_profile }}"
command: nmcli c show --active {{ port1_profile }}
register: active_port1_profile
ignore_errors: true
changed_when: false
when: network_provider == "nm"
- name: Get the port2 profile "{{ port2_profile }}" from the active
connection
- name: From the active connection, get the port2 profile
"{{ port2_profile }}"
command: nmcli c show --active {{ port2_profile }}
register: active_port2_profile
ignore_errors: true
@ -192,8 +192,8 @@
persistent_state: absent
state: down
- name: Get the controller profile "{{ controller_profile }}" from the
active connection
- name: From the active connection, get the controller profile
"{{ controller_profile }}"
command: nmcli c show --active {{ controller_profile }}
register: active_controller_profile
ignore_errors: true

View file

@ -10,7 +10,7 @@
tasks:
- name: "set type={{ type }} and interface={{ interface }}"
- name: "set type={{ type }} and interface={{ interface }}" # noqa name
set_fact:
type: "{{ type }}"
interface: "{{ interface }}"

View file

@ -16,7 +16,7 @@
interface: lsr27
tasks:
- name: "set type={{ type }} and interface={{ interface }}"
- name: "set type={{ type }} and interface={{ interface }}" # noqa name
set_fact:
type: "{{ type }}"
interface: "{{ interface }}"

View file

@ -9,7 +9,7 @@
interface: ethtest0
tasks:
- name: "set type={{ type }} and interface={{ interface }}"
- name: "set type={{ type }} and interface={{ interface }}" # noqa name
set_fact:
type: "{{ type }}"
interface: "{{ interface }}"

View file

@ -11,7 +11,7 @@
tasks:
- name: "set type={{ type }} and interface={{ interface0 }}"
- name: "set type={{ type }} and interface={{ interface0 }}" # noqa name
set_fact:
type: "{{ type }}"
interface: "{{ interface0 }}"
@ -20,7 +20,7 @@
vars:
state: present
- include_tasks: tasks/assert_device_present.yml
- name: "set type={{ type }} and interface={{ interface1 }}"
- name: "set type={{ type }} and interface={{ interface1 }}" # noqa name
set_fact:
type: "{{ type }}"
interface: "{{ interface1 }}"

View file

@ -10,7 +10,7 @@
tasks:
- name: "set type={{ type }} and interface={{ interface }}"
- name: "set type={{ type }} and interface={{ interface }}" # noqa name
set_fact:
type: "{{ type }}"
interface: "{{ interface }}"

View file

@ -9,7 +9,7 @@
interface: ethtest0
tasks:
- name: "set type={{ type }} and interface={{ interface }}"
- name: "set type={{ type }} and interface={{ interface }}" # noqa name
set_fact:
type: "{{ type }}"
interface: "{{ interface }}"
@ -199,8 +199,8 @@
specified rule"
when: ansible_distribution_major_version != "7"
- name: Assert that the IPv4 routing rule in the connection
"{{ interface }}" matches the specified rule
- name: Assert that the specified IPv4 routing rule was configured in the
connection "{{ interface }}"
assert:
that:
- connection_route_rule.stdout is search("priority 30200 from
@ -221,11 +221,11 @@
0.0.0.0/0 oif oiftest table 30400")
- connection_route_rule.stdout is search("priority 200 from
198.51.100.56/26 table 200")
msg: "the IPv4 routing rule in the connection '{{ interface }}' does
not match the specified rule"
msg: "the specified IPv4 routing rule was not configured in the
connection '{{ interface }}'"
- name: Assert that the IPv6 routing rule in the connection
"{{ interface }}" matches the specified rule
- name: Assert that the specified IPv6 routing rule was configured in the
connection "{{ interface }}"
assert:
that:
- connection_route_rule6.stdout is search("priority 30600 to
@ -234,8 +234,8 @@
::/0 dport 128-256 table 30600") or
connection_route_rule6.stdout is search("not priority 30601 from
::/0 dport 128-256 table 30600")
msg: "the IPv6 routing rule in the connection '{{ interface }}' does
not match the specified rule"
msg: "the specified IPv6 routing rule was not configured in the
connection '{{ interface }}'"
- name: Remove the dedicated test file in `/etc/iproute2/rt_tables.d/`
file:

View file

@ -11,7 +11,8 @@
interface: LST-TST-br34
tags:
- always
- name: "Create test bridge {{ interface }} via initscripts provider"
- name: "Through the initscripts provider, create test bridge
{{ interface }}"
include_role:
name: linux-system-roles.network
vars:
@ -33,7 +34,7 @@
network_provider: nm
tags:
- always
- name: "Create test bridge {{ interface }} via nm provider"
- name: "Through the nm provider, create test bridge {{ interface }}"
include_role:
name: linux-system-roles.network
vars:

View file

@ -1,7 +1,7 @@
# SPDX-License-Identifier: BSD-3-Clause
---
- include_tasks: get_interface_stat.yml
- name: "assert that interface {{ interface }} is absent"
- name: "assert that the interface is absent - '{{ interface }}'"
assert:
that: not interface_stat.stat.exists
msg: "{{ interface }} exists"

View file

@ -1,7 +1,7 @@
# SPDX-License-Identifier: BSD-3-Clause
---
- include_tasks: get_interface_stat.yml
- name: "assert that interface {{ interface }} is present"
- name: "assert that the interface is present - '{{ interface }}'"
assert:
that: interface_stat.stat.exists
msg: "{{ interface }} does not exist"

View file

@ -1,7 +1,7 @@
# SPDX-License-Identifier: BSD-3-Clause
---
- include_tasks: get_profile_stat.yml
- name: "assert that profile '{{ profile }}' is absent"
- name: "assert that the profile is absent - '{{ profile }}'"
assert:
that: not lsr_net_profile_exists
msg: "profile {{ profile }} does exist"

View file

@ -1,12 +1,12 @@
# SPDX-License-Identifier: BSD-3-Clause
---
- include_tasks: get_profile_stat.yml
- name: "assert that profile '{{ profile }}' is present"
- name: "assert that the profile is present - '{{ profile }}'"
assert:
that: lsr_net_profile_exists
msg: "profile {{ profile }} does not exist"
- name: "assert that ansible managed comment in '{{ profile }}' is present"
- name: "assert that the ansible managed comment is present in '{{ profile }}'"
assert:
that: lsr_net_profile_ansible_managed
msg: "profile {{ profile }} does not have the ansible managed comment"

View file

@ -62,7 +62,8 @@
args:
chdir: "{{ _rundir.path }}"
- name: Create {{ _rundir.path }}/ansible/module_utils
- name: Create subdirectory '/ansible/module_utils' under
'{{ _rundir.path }}'
file:
state: directory
path: "{{ item }}"