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
Running ansible-lint role/tasks/somefile.yml --profile production shows no issues. Appending --write still modifies the file.
Issue Type
Bug Report
OS / ENVIRONMENT
ansible-lint 6.17.3.dev6 using ansible-core:2.15.1 ansible-compat:4.1.2 ruamel-yaml:0.17.32 ruamel-yaml-clib:0.2.7You are using a pre-release version of ansible-lint.
ansible installation method: pip without version constraints.
ansible-lint installation method: pip using github main branch
STEPS TO REPRODUCE
Create a tasks-file
---
- name: Get service factsansible.builtin.service_facts:
- name: Disable ufw serviceansible.builtin.service:
name: ufwenabled: falsestate: stoppedwhen: '"ufw" in services'
$ ansible-lint roles/base/tasks/disable_firewall.yml --profile production
WARNING Skipped installing old role dependencies due to running in offline mode.
WARNING Skipped installing collection dependencies due to running in offline mode.
Passed: 0 failure(s), 0 warning(s) on 1 files. Profile 'production' was required, but only 'production' profile passed.
You are using a pre-release version of ansible-lint.
$ ansible-lint roles/base/tasks/disable_firewall.yml --profile production --write
WARNING Skipped installing old role dependencies due to running in offline mode.
WARNING Skipped installing collection dependencies due to running in offline mode.
Modified 1 files.
Passed: 0 failure(s), 0 warning(s) on 1 files. Profile 'production' was required, but only 'production' profile passed.
You are using a pre-release version of ansible-lint.
Desired Behavior
Ansible-lint should not modify any files if there are no warnings or errors explaining that change.
the output of running ansible-lint including the command line used
if you're getting a stack trace, also the output of ansible-playbook --syntax-check playbook
$ ansible-lint roles/base/tasks/disable_firewall.yml --profile production --write -vvvvv
DEBUG Logging initialized to level 10
INFO Identified /workspaces/someproject/ansible as project root due config file /workspaces/someproject/ansible/.ansible-lint.
DEBUG Options: Options(cache_dir=PosixPath('/home/vscode/.cache/ansible-compat/0cb87f'), colored=True, configured=True, cwd=PosixPath('/workspaces/someproject/ansible'), display_relative_path=True, exclude_paths=['.cache', '.git', '.hg', '.svn', '.tox'], format=None, lintables=['roles/base/tasks/disable_firewall.yml'], list_rules=False, list_tags=False, write_list=['all'], parseable=False, quiet=False, rulesdirs=[PosixPath('/home/linuxbrew/.linuxbrew/opt/[email protected]/lib/python3.11/site-packages/ansiblelint/rules')], skip_list=[], tags=[], verbosity=5, warn_list=['experimental', 'jinja', 'fqcn'], mock_filters=[], mock_modules=[], mock_roles=[], loop_var_prefix=None, only_builtins_allow_collections=[], only_builtins_allow_modules=[], var_naming_pattern=None, offline=False, project_dir='.', extra_vars=None, enable_list=[], skip_action_validation=True, strict=False, rules={}, profile='production', task_name_prefix='{stem} | ', sarif_file=None, config_file='/workspaces/someproject/ansible/.ansible-lint', generate_ignore=False, rulesdir=[], use_default_rules=False, version=False, list_profiles=False, ignore_file=None, max_tasks=100)
DEBUG CWD: /workspaces/someproject/ansible
INFO Running ansible-galaxy role install -vr requirements.yml --roles-path /home/vscode/.cache/ansible-compat/0cb87f/roles
INFO Running ansible-galaxy collection install -v -r requirements.yml
INFO Set ANSIBLE_LIBRARY=/home/vscode/.cache/ansible-compat/0cb87f/modules:/home/vscode/.ansible/plugins/modules:/usr/share/ansible/plugins/modules
INFO Set ANSIBLE_COLLECTIONS_PATH=/home/vscode/.cache/ansible-compat/0cb87f/collections:/home/vscode/.cache/ansible-compat/0cb87f/collections:/home/vscode/.ansible/collections:/usr/share/ansible/collections
INFO Set ANSIBLE_ROLES_PATH=/home/vscode/.cache/ansible-compat/0cb87f/roles:roles:/workspaces/someproject/ansible/roles
DEBUG Effective yamllint rules used: {'anchors': {'level': 'error', 'forbid-undeclared-aliases': True, 'forbid-duplicated-anchors': False, 'forbid-unused-anchors': False}, 'braces': {'level': 'error', 'forbid': False, 'min-spaces-inside': 0, 'max-spaces-inside': 1, 'min-spaces-inside-empty': -1, 'max-spaces-inside-empty': -1}, 'brackets': {'level': 'error', 'forbid': False, 'min-spaces-inside': 0, 'max-spaces-inside': 0, 'min-spaces-inside-empty': -1, 'max-spaces-inside-empty': -1}, 'colons': {'level': 'error', 'max-spaces-before': 0, 'max-spaces-after': 1}, 'commas': {'level': 'error', 'max-spaces-before': 0, 'min-spaces-after': 1, 'max-spaces-after': 1}, 'comments': {'level': 'warning', 'require-starting-space': True, 'ignore-shebangs': True, 'min-spaces-from-content': 1}, 'comments-indentation': False, 'document-end': False, 'document-start': False, 'empty-lines': {'level': 'error', 'max': 2, 'max-start': 0, 'max-end': 0}, 'empty-values': False, 'float-values': False, 'hyphens': {'level': 'error', 'max-spaces-after': 1}, 'indentation': {'level': 'error', 'spaces': 'consistent', 'indent-sequences': True, 'check-multi-line-strings': False}, 'key-duplicates': {'level': 'error'}, 'key-ordering': False, 'line-length': {'level': 'error', 'max': 160, 'allow-non-breakable-words': True, 'allow-non-breakable-inline-mappings': False}, 'new-line-at-end-of-file': {'level': 'error'}, 'new-lines': {'level': 'error', 'type': 'unix'}, 'octal-values': {'forbid-implicit-octal': True, 'forbid-explicit-octal': True, 'level': 'error'}, 'quoted-strings': False, 'trailing-spaces': {'level': 'error'}, 'truthy': {'level': 'warning', 'allowed-values': ['true', 'false'], 'check-keys': True}}
DEBUG Activating rule `avoid-dot-notation` due to profile `production`
DEBUG Activating rule `sanity` due to profile `production`
DEBUG Activating rule `fqcn` due to profile `production`
DEBUG Activating rule `import-task-no-when` due to profile `production`
DEBUG Activating rule `meta-no-dependencies` due to profile `production`
DEBUG Activating rule `single-entry-point` due to profile `production`
DEBUG Activating rule `use-loop` due to profile `production`
DEBUG Activating rule `galaxy` due to profile `shared`
DEBUG Activating rule `ignore-errors` due to profile `shared`
DEBUG Activating rule `layout` due to profile `shared`
DEBUG Activating rule `meta-incorrect` due to profile `shared`
DEBUG Activating rule `meta-no-tags` due to profile `shared`
DEBUG Activating rule `meta-video-links` due to profile `shared`
DEBUG Activating rule `meta-version` due to profile `shared`
DEBUG Activating rule `meta-runtime` due to profile `shared`
DEBUG Activating rule `no-changed-when` due to profile `shared`
DEBUG Activating rule `no-changelog` due to profile `shared`
DEBUG Activating rule `no-handler` due to profile `shared`
DEBUG Activating rule `no-relative-paths` due to profile `shared`
DEBUG Activating rule `max-block-depth` due to profile `shared`
DEBUG Activating rule `max-tasks` due to profile `shared`
DEBUG Activating rule `unsafe-loop` due to profile `shared`
DEBUG Activating rule `avoid-implicit` due to profile `safety`
DEBUG Activating rule `latest` due to profile `safety`
DEBUG Activating rule `package-latest` due to profile `safety`
DEBUG Activating rule `risky-file-permissions` due to profile `safety`
DEBUG Activating rule `risky-octal` due to profile `safety`
DEBUG Activating rule `risky-shell-pipe` due to profile `safety`
DEBUG Activating rule `name` due to profile `moderate`
DEBUG Activating rule `name` due to profile `moderate`
DEBUG Activating rule `name` due to profile `moderate`
DEBUG Activating rule `spell-var-name` due to profile `moderate`
DEBUG Activating rule `command-instead-of-module` due to profile `basic`
DEBUG Activating rule `command-instead-of-shell` due to profile `basic`
DEBUG Activating rule `deprecated-bare-vars` due to profile `basic`
DEBUG Activating rule `deprecated-local-action` due to profile `basic`
DEBUG Activating rule `deprecated-module` due to profile `basic`
DEBUG Activating rule `inline-env-var` due to profile `basic`
DEBUG Activating rule `key-order` due to profile `basic`
DEBUG Activating rule `literal-compare` due to profile `basic`
DEBUG Activating rule `jinja` due to profile `basic`
DEBUG Activating rule `no-free-form` due to profile `basic`
DEBUG Activating rule `no-jinja-when` due to profile `basic`
DEBUG Activating rule `no-tabs` due to profile `basic`
DEBUG Activating rule `partial-become` due to profile `basic`
DEBUG Activating rule `playbook-extension` due to profile `basic`
DEBUG Activating rule `role-name` due to profile `basic`
DEBUG Activating rule `schema` due to profile `basic`
DEBUG Activating rule `name` due to profile `basic`
DEBUG Activating rule `var-naming` due to profile `basic`
DEBUG Activating rule `yaml` due to profile `basic`
DEBUG Activating rule `internal-error` due to profile `min`
DEBUG Activating rule `load-failure` due to profile `min`
DEBUG Activating rule `parser-error` due to profile `min`
DEBUG Activating rule `syntax-check` due to profile `min`
DEBUG Unloading warning rule due to not being part of production profile.
DEBUG Unloading args rule due to not being part of production profile.
DEBUG Unloading complexity rule due to not being part of production profile.
DEBUG Unloading empty-string-compare rule due to not being part of production profile.
DEBUG Unloading loop-var-prefix rule due to not being part of production profile.
DEBUG Unloading no-log-password rule due to not being part of production profile.
DEBUG Unloading no-prompting rule due to not being part of production profile.
DEBUG Unloading no-same-owner rule due to not being part of production profile.
DEBUG Unloading only-builtins rule due to not being part of production profile.
DEBUG Unloading run-once rule due to not being part of production profile.
DEBUG 40/50 rules included in the profile
WARNING Skipped installing old role dependencies due to running in offline mode.
WARNING Skipped installing collection dependencies due to running in offline mode.
INFO Set ANSIBLE_LIBRARY=/home/vscode/.cache/ansible-compat/0cb87f/modules:/home/vscode/.ansible/plugins/modules:/usr/share/ansible/plugins/modules
INFO Set ANSIBLE_COLLECTIONS_PATH=/home/vscode/.cache/ansible-compat/0cb87f/collections:/home/vscode/.ansible/collections:/usr/share/ansible/collections
INFO Set ANSIBLE_ROLES_PATH=/home/vscode/.cache/ansible-compat/0cb87f/roles:roles:/workspaces/someproject/ansible/roles
DEBUG Examining roles/base/tasks/disable_firewall.yml of type tasks
DEBUG Determined rule-profile order: {'internal-error': (0, 'min'), 'load-failure': (1, 'min'), 'parser-error': (2, 'min'), 'syntax-check': (3, 'min'), 'command-instead-of-module': (4, 'basic'), 'command-instead-of-shell': (5, 'basic'), 'deprecated-bare-vars': (6, 'basic'), 'deprecated-local-action': (7, 'basic'), 'deprecated-module': (8, 'basic'), 'inline-env-var': (9, 'basic'), 'key-order': (10, 'basic'), 'literal-compare': (11, 'basic'), 'jinja': (12, 'basic'), 'no-free-form': (13, 'basic'), 'no-jinja-when': (14, 'basic'), 'no-tabs': (15, 'basic'), 'partial-become': (16, 'basic'), 'playbook-extension': (17, 'basic'), 'role-name': (18, 'basic'), 'schema': (19, 'basic'), 'name': (20, 'basic'), 'var-naming': (21, 'basic'), 'yaml': (22, 'basic'), 'name': (23, 'moderate'), 'name': (24, 'moderate'), 'name': (25, 'moderate'), 'spell-var-name': (26, 'moderate'), 'avoid-implicit': (27, 'safety'), 'latest': (28, 'safety'), 'package-latest': (29, 'safety'), 'risky-file-permissions': (30, 'safety'), 'risky-octal': (31, 'safety'), 'risky-shell-pipe': (32, 'safety'), 'galaxy': (33, 'shared'), 'ignore-errors': (34, 'shared'), 'layout': (35, 'shared'), 'meta-incorrect': (36, 'shared'), 'meta-no-tags': (37, 'shared'), 'meta-video-links': (38, 'shared'), 'meta-version': (39, 'shared'), 'meta-runtime': (40, 'shared'), 'no-changed-when': (41, 'shared'), 'no-changelog': (42, 'shared'), 'no-handler': (43, 'shared'), 'no-relative-paths': (44, 'shared'), 'max-block-depth': (45, 'shared'), 'max-tasks': (46, 'shared'), 'unsafe-loop': (47, 'shared'), 'avoid-dot-notation': (48, 'production'), 'sanity': (49, 'production'), 'fqcn': (50, 'production'), 'import-task-no-when': (51, 'production'), 'meta-no-dependencies': (52, 'production'), 'single-entry-point': (53, 'production'), 'use-loop': (54, 'production')}
Modified 1 files.
Passed: 0 failure(s), 0 warning(s) on 1 files. Profile 'production' was required, but only 'production' profile passed.
You are using a pre-release version of ansible-lint.
The source file lost the empty new line between the two tasks.
The text was updated successfully, but these errors were encountered:
Summary
Running
ansible-lint role/tasks/somefile.yml --profile production
shows no issues. Appending--write
still modifies the file.Issue Type
OS / ENVIRONMENT
STEPS TO REPRODUCE
Desired Behavior
Ansible-lint should not modify any files if there are no warnings or errors explaining that change.
Actual Behavior
Please give some details of what is happening.
Include a minimum complete verifiable example with:
ansible-playbook --syntax-check playbook
The source file lost the empty new line between the two tasks.
The text was updated successfully, but these errors were encountered: