ANSIBLE-LINT(1)
π ansible-lint(1) π
User Commands section, and it is giving main character energy π
β¨ NAME β¨
ansible-lint is the lint tool for Ansible playbooks π§ It checks your playbooks for problems so you don't have to find them the hard way π
π DESCRIPTION π
Okay so here's the usage line, bestie π«Ά
usage: ansible-lint [-h] [-P | -L | -T]
[-f {brief,full,md,json,codeclimate,quiet,pep8,sarif}]
[--sarif-file SARIF_FILE] [-q] [--profile
{min,basic,moderate,safety,shared,production}] [-p]
[--project-dir PROJECT_DIR] [-r RULESDIR] [-R] [-s] [--write
[WRITE_LIST]] [--show-relpath] [-t TAGS] [-v] [-x SKIP_LIST]
[--generate-ignore] [-w WARN_LIST] [--enable-list ENABLE_LIST]
[--nocolor] [--force-color] [--exclude EXCLUDE_PATHS
[EXCLUDE_PATHS ...]] [-c CONFIG_FILE] [-i IGNORE_FILE]
[--offline] [--version] [lintables ...]
πΈ positional arguments πΈ
lintablesβ one or more files or paths π If you leave it out, ansible-lint switches to auto-detection mode, so it does the looking for you β¨
π options π
-h,--helpβ shows this help message and exits π-P,--list-profilesβ lists all the profiles π¦ There are no formatting options for this one.-L,--list-rulesβ lists all the rules π For this, the only-fformats that work are{brief, full, md}, andbriefis the default.-T,--list-tagsβ lists all the tags and which rules they cover π·οΈ Bump up the verbosity with-vif you want theopt-intag and its rules to show up too π-f {brief,full,md,json,codeclimate,quiet,pep8,sarif},--format {brief,full,md,json,codeclimate,quiet,pep8,sarif}β picks the stdout formatting πjsonis just an alias forcodeclimate. (default: None)--sarif-file SARIF_FILEβ the SARIF output file π-qβ quieter, with less verbosity π€« You can use it twice if you really want it hushed π«Ά--profile {min,basic,moderate,safety,shared,production}β choose which rules profile you want to use π-p,--parseableβ parseable output, same vibe as-f pep8β¨--project-dir PROJECT_DIRβ where your project or repository lives π It gets autodetected based on where the configuration file is.-r RULESDIR,--rules-dir RULESDIRβ point it at custom rule directories π₯ Add-Rif you want to keep using the embedded rules from/usr/lib/python3/dist-packages/ansiblelint/rulestoo.-Rβ keeps the default rules when you're using-rπ-s,--strictβ returns a non-zero exit code for warnings as well as errors π₯Ί Strict and serious π--write [WRITE_LIST]β lets ansible-lint reformat YAML files and run rule transforms β¨ Reformatting standardizes spacing, quotes, and so on, and a rule transform can fix or simplify the issue that rule found π§ You can limit which transforms run (that's thewrite_list) by passing the keywordsallornone, or a comma-separated list of rule ids or rule tags. YAML reformatting happens whenever--writeor--write=is used π--writeand--write=allare the same thing, and they let every transform run π The effective list comes fromwrite_listin the config file first, then whatever--writeargs you pass on the commandline gets applied after π--write=noneresets the transform list so you get YAML reformatting without any transforms running. For example,--write=none,rule-idwill ignorewrite_listin the config file and only run therule-idtransform π
Heads up, bestie: the --write flag is what lets ansible-lint actually rewrite your files. Use it with care π
--show-relpathβ displays paths relative to the current working directory π¦-t TAGS,--tags TAGSβ only checks rules whose id or tags match these values π―-vβ ups the verbosity level, and-vvgoes even higher π’-x SKIP_LIST,--skip-list SKIP_LISTβ only checks rules whose id or tags do not match these values π For example:--skip-list=name,run-once--generate-ignoreβ generates a text file called.ansible-lint-ignorethat ignores every violation it finds π« Each line holds a filename and a rule id, separated by a space π-w WARN_LIST,--warn-list WARN_LISTβ only warns about these rules, unless the config file overrides it π¨ The current default value is:experimental, jinja[spacing], fqcn[deep]--enable-list ENABLE_LISTβ turns on optional rules by their tag name β¨--nocolorβ turns off colored output, same asNO_COLOR=1π€--force-colorβ forces colored output, same asFORCE_COLOR=1π--exclude EXCLUDE_PATHS [EXCLUDE_PATHS ...]β paths to directories or files you want to skip π« You can repeat this option as many times as you need π«Ά-c CONFIG_FILE,--config-file CONFIG_FILEβ picks the configuration file to use π By default it looks for.ansible-lint,.config/ansible-lint.yml, or.config/ansible-lint.yamlπ-i IGNORE_FILE,--ignore-file IGNORE_FILEβ picks the ignore file to use π§Ή By default it looks for.ansible-lint-ignoreor.config/ansible-lintignore.txtπ--offlineβ disables installingrequirements.ymland refreshing the schema π΄--versionβ the version flag π’ The page doesn't give any more detail than that, so that's the tea β
Okay that's the whole manual, bestie π Source: ansible-lint, dated June 2023 π¦ Stay linted, stay iconic πΈβ¨
π¦ where this page comes from
- debian trixie: ansible-lint 25.6.1+really25.2.1-1 Β· MIT AND GPL-3.0-only
- ubuntu noble: ansible-lint 6.17.2-1 Β· MIT AND GPL-3.0-only
- ubuntu questing: ansible-lint 25.6.1+really25.2.1-1
- ubuntu resolute: ansible-lint 26.1.1-2 Β· MIT AND GPL-3.0-only
- π girlified by claude-haiku-5-5 on : a language model's rewrite of the original, under its terms