name: Ansible Lint

on: [push, pull_request]

# Declare default permissions as read only.
permissions: read-all

jobs:
  ansible-lint:

    runs-on: ubuntu-latest

    steps:
    # Important: This sets up your GITHUB_WORKSPACE environment variable
    - name: checkout
      uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # v3.1.0

    - name: Lint Ansible Playbook
      # replace "master" with any valid ref
      uses: ansible/ansible-lint-action@27c37f9001153675ee6abcadcd722bcbdafaba08 # v6.8.2
      with:
        # [required]
        # Paths to ansible files (i.e., playbooks, tasks, handlers etc..)
        # or valid Ansible directories according to the Ansible role
        # directory structure.
        # If you want to lint multiple ansible files, use the following syntax
        # targets: |
        #   playbook_1.yml
        #   playbook_2.yml
        targets: "*.yml inventory/group_vars/*.yml"
        # [optional]
        # Arguments to override a package and its version to be set explicitly.
        # Must follow the example syntax.
        # stick to older version of rich, as the new one is not compatible (yet) with ansible-lint
        override-deps: |
          rich>=9.5.1,<11.0.0
        #  ansible==2.9
        #  ansible-lint==4.2.0
        # [optional]
        # Arguments to be passed to the ansible-lint

        # Options:
        #   -q                    quieter, although not silent output
        #   -p                    parseable output in the format of pep8
        #   --parseable-severity  parseable output including severity of rule
        #   -r RULESDIR           specify one or more rules directories using one or
        #                         more -r arguments. Any -r flags override the default
        #                         rules in ansiblelint/rules, unless -R is also used.
        #   -R                    Use default rules in ansiblelint/rules in addition to
        #                         any extra
        #                         rules directories specified with -r. There is no need
        #                         to specify this if no -r flags are used
        #   -t TAGS               only check rules whose id/tags match these values
        #   -x SKIP_LIST          only check rules whose id/tags do not match these
        #                         values
        #   --nocolor             disable colored output
        #   --exclude=EXCLUDE_PATHS
        #                         path to directories or files to skip. This option is
        #                         repeatable.
        #   -c C                  Specify configuration file to use. Defaults to ".ansible-lint"
        args: ""