When do you use `skip_list`, `warn_list` and `# noqa`?
IntermediateProductionTesting, CI/CD and Quality
Answer
skip_list: a rule the team has agreed does not apply to this repo at all. Rare, and documented in the PR that added it.warn_list: a rule we intend to enforce but cannot yet; it reports without failing CI. Used during migrations.# noqa: <rule>: a single justified exception on one task, with the reason next to it.
- name: Read current kernel version
ansible.builtin.command: uname -r
register: kernel
changed_when: false
- name: Run vendor installer (no module exists)
ansible.builtin.shell: ./install.sh --silent # noqa: command-instead-of-shell vendor script needs shell env
args:
chdir: /opt/vendor
creates: /opt/vendor/.installed
Always name the rule in noqa. A bare # noqa hides future problems on that line too.
More on Testing, CI/CD and Quality
What does a testing pyramid look like for Ansible code?BeginnerHow do you roll out `ansible-lint` profiles across a team without blocking everyone?IntermediateHow do you set up pre-commit hooks for an Ansible repo?BeginnerHow is a Molecule scenario laid out, and what does `molecule test` actually run?IntermediateDocker, Podman or real VMs as the Molecule driver: how do you choose?AdvancedHow do you test roles that manage systemd services inside Molecule containers?Advanced