You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
No issue should be raised, as all variables follow the role_prefix rule
Actual Behavior
The following issues are raised:
roles/myrole/tasks/main.yml:XX: var-naming[no-role-prefix]: Variables names from within roles should use role_name_ as a prefix. (vars: __file__)roles/myrole/tasks/main.yml:XX: var-naming[no-role-prefix]: Variables names from within roles should use role_name_ as a prefix. (vars: __line__)
The text was updated successfully, but these errors were encountered:
This is not specific to the include_task module, I am getting this issue/false positive on a task that uses the command module:
var-naming[no-role-prefix]: Variables names from within roles should use role_name_ as a prefix. (vars: __file__)
roles/tt_rss/tasks/tt-rss.yml:120 Task/Handler: load/upgrade tt-rss database schema
var-naming[no-role-prefix]: Variables names from within roles should use role_name_ as a prefix. (vars: __line__)
roles/tt_rss/tasks/tt-rss.yml:120 Task/Handler: load/upgrade tt-rss database schema
- name: load/upgrade tt-rss database schemabecome: yesbecome_user: tt-rsscommand:
cmd: /usr/bin/php {{ tt_rss_install_dir }}/update.php --update-schema=force-yesregister: tt_rss_db_upgradechanged_when: "'Database schema is already at latest version.' not in tt_rss_db_upgrade.stdout"ignore_errors: "{{ ansible_check_mode }}"vars:
ansible_remote_tmp: /tmp
This is related to the "vars:" syntax, which I also encountered today. Here's my example:
- name: Get all parent directories of mysql_data_dir_base
ansible.builtin.set_fact:
mysql_data_dir_base_parents: "{{ mysql_data_dir_base | regex_replace('[^/]+/?$', '') | regex_replace('(/[^/]+)/*$', '\\1') | regex_findall('[^/]+') }}"
vars:
dir: "{{ mysql_data_dir_base }}"
This bug is not serious and does not affect me, as it can correctly locate the position. Moreover, I eventually found out that this parameter is not needed, reminding me that I should delete it. Haha.
Summary
On 'ansible.builtin.include_tasks', two infrigements to the var-naming[no-role-prefix] rule are systematically infriged, for vars:
These variables are not defined in my playbook, I guess they are internal include_tasks variables;
Issue Type
OS / ENVIRONMENT
ansible-lint 6.16.1 using ansible-core:2.14.5 ruamel-yaml:None ruamel-yaml-clib:None
STEPS TO REPRODUCE
Run ansible-lint on a playbook with an include_tasks, either in free-form or with file: filename.yaml, usings vars:
Desired Behavior
No issue should be raised, as all variables follow the role_prefix rule
Actual Behavior
The following issues are raised:
The text was updated successfully, but these errors were encountered: