From aa1049617937190f9413e31d17dbb07ed003e0cc Mon Sep 17 00:00:00 2001 From: Bo-Chun Louis Chen Date: Tue, 5 Apr 2022 00:31:37 -0500 Subject: [PATCH 1/6] Use ansible community action --- .github/workflows/ansible-lint.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ansible-lint.yml b/.github/workflows/ansible-lint.yml index 7ac4222d..0c08637f 100644 --- a/.github/workflows/ansible-lint.yml +++ b/.github/workflows/ansible-lint.yml @@ -30,7 +30,7 @@ jobs: - name: Lint Ansible Playbook # replace "master" with any valid ref - uses: iranzo/ansible-lint-action@master + uses: ansible-community/ansible-lint-action@v6 with: # [required] # Paths to ansible files (i.e., playbooks, tasks, handlers etc..) From 86a716ae8940fe70d7cc887140ec5ea61920d290 Mon Sep 17 00:00:00 2001 From: Bo-Chun Louis Chen Date: Tue, 5 Apr 2022 00:35:40 -0500 Subject: [PATCH 2/6] Remove invalid input --- .github/workflows/ansible-lint.yml | 42 +++--------------------------- 1 file changed, 3 insertions(+), 39 deletions(-) diff --git a/.github/workflows/ansible-lint.yml b/.github/workflows/ansible-lint.yml index 0c08637f..f9b576f4 100644 --- a/.github/workflows/ansible-lint.yml +++ b/.github/workflows/ansible-lint.yml @@ -31,42 +31,6 @@ jobs: - name: Lint Ansible Playbook # replace "master" with any valid ref uses: ansible-community/ansible-lint-action@v6 - 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: "${{ steps.get_file_changes.outputs.files }}" - # [optional] - # Arguments to override a package and its version to be set explicitly. - # Must follow the example syntax. - override-deps: | - 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: "--exclude .github" + # optional: + # with: + # path: "playbooks/" # <-- only one value is allowed From f1c4993460121d577c83eb9d4fc48b37f7da18c6 Mon Sep 17 00:00:00 2001 From: Bo-Chun Louis Chen Date: Mon, 22 Aug 2022 23:29:18 -0500 Subject: [PATCH 3/6] Remove change files Since the newer ansible-lint does not take filenames as input --- .github/workflows/ansible-lint.yml | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/.github/workflows/ansible-lint.yml b/.github/workflows/ansible-lint.yml index f9b576f4..df1b2924 100644 --- a/.github/workflows/ansible-lint.yml +++ b/.github/workflows/ansible-lint.yml @@ -18,16 +18,6 @@ jobs: # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - uses: actions/checkout@v2 - - name: Get file changes - id: get_file_changes - uses: trilom/file-changes-action@v1.2.4 - with: - output: ' ' - - - name: Echo file changes - run: | - echo Changed files: ${{ steps.get_file_changes.outputs.files }} - - name: Lint Ansible Playbook # replace "master" with any valid ref uses: ansible-community/ansible-lint-action@v6 From dda2eb9aa0edcc3f72186e95bcc1d502fa2ee97c Mon Sep 17 00:00:00 2001 From: Bo-Chun Louis Chen Date: Mon, 22 Aug 2022 23:27:43 -0500 Subject: [PATCH 4/6] Add default .ansible-lint file Provided by ansible-lint documentation https://ansible-lint.readthedocs.io/en/latest/configuring/#configuration-file --- .ansible-lint | 96 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 96 insertions(+) create mode 100644 .ansible-lint diff --git a/.ansible-lint b/.ansible-lint new file mode 100644 index 00000000..bbed8855 --- /dev/null +++ b/.ansible-lint @@ -0,0 +1,96 @@ +--- +# .ansible-lint +# exclude_paths included in this file are parsed relative to this file's location +# and not relative to the CWD of execution. CLI arguments passed to the --exclude +# option will be parsed relative to the CWD of execution. +exclude_paths: + - .cache/ # implicit unless exclude_paths is defined in config + - .github/ + - test/fixtures/formatting-before/ + - test/fixtures/formatting-prettier/ +# parseable: true +# quiet: true +# verbosity: 1 + +# Mock modules or roles in order to pass ansible-playbook --syntax-check +mock_modules: + - zuul_return + # note the foo.bar is invalid as being neither a module or a collection + - fake_namespace.fake_collection.fake_module + - fake_namespace.fake_collection.fake_module.fake_submodule +mock_roles: + - mocked_role + - author.role_name # old standalone galaxy role + - fake_namespace.fake_collection.fake_role # role within a collection + +# Enable checking of loop variable prefixes in roles +loop_var_prefix: "{role}_" + +# Enforce variable names to follow pattern below, in addition to Ansible own +# requirements, like avoiding python identifiers. To disable add `var-naming` +# to skip_list. +# var_naming_pattern: "^[a-z_][a-z0-9_]*$" + +use_default_rules: true +# Load custom rules from this specific folder +# rulesdir: +# - ./rule/directory/ + +# This makes linter to fully ignore rules/tags listed below +skip_list: + - skip_this_tag + - git-latest + +# Any rule that has the 'opt-in' tag will not be loaded unless its 'id' is +# mentioned in the enable_list: +enable_list: + - empty-string-compare # opt-in + - no-log-password # opt-in + - no-same-owner # opt-in + # add yaml here if you want to avoid ignoring yaml checks when yamllint + # library is missing. Normally its absence just skips using that rule. + - yaml +# Report only a subset of tags and fully ignore any others +# tags: +# - jinja[spacing] + +# This makes the linter display but not fail for rules/tags listed below: +warn_list: + - skip_this_tag + - git-latest + - experimental # experimental is included in the implicit list + # - role-name + # - yaml[document-start] # you can also use sub-rule matches + +# Some rules can transform files to fix (or make it easier to fix) identified +# errors. `ansible-lint --write` will reformat YAML files and run these transforms. +# By default it will run all transforms (effectively `write_list: ["all"]`). +# You can disable running transforms by setting `write_list: ["none"]`. +# Or only enable a subset of rule transforms by listing rules/tags here. +# write_list: +# - all + +# Offline mode disables installation of requirements.yml +offline: false + +# Define required Ansible's variables to satisfy syntax check +extra_vars: + foo: bar + multiline_string_variable: | + line1 + line2 + complex_variable: ":{;\t$()" + +# Uncomment to enforce action validation with tasks, usually is not +# needed as Ansible syntax check also covers it. +# skip_action_validation: false + +# List of additional kind:pattern to be added at the top of the default +# match list, first match determines the file kind. +kinds: + # - playbook: "**/examples/*.{yml,yaml}" + # - galaxy: "**/folder/galaxy.yml" + # - tasks: "**/tasks/*.yml" + # - vars: "**/vars/*.yml" + # - meta: "**/meta/main.yml" + - yaml: "**/*.yaml-too" From 829175171c759c3d6d56980d092ccef6b7035817 Mon Sep 17 00:00:00 2001 From: Bo-Chun Louis Chen Date: Tue, 23 Aug 2022 00:12:16 -0500 Subject: [PATCH 5/6] Ignore roles from upstream --- .ansible-lint | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/.ansible-lint b/.ansible-lint index bbed8855..084d5c1a 100644 --- a/.ansible-lint +++ b/.ansible-lint @@ -6,8 +6,17 @@ exclude_paths: - .cache/ # implicit unless exclude_paths is defined in config - .github/ - - test/fixtures/formatting-before/ - - test/fixtures/formatting-prettier/ + - roles/compute_build_nodes + - roles/compute_build_vnfs + - roles/gpu_build_nodes + - roles/gpu_build_vnfs + - roles/login_build_nodes + - roles/login_build_vnfs + - roles/nodes_vivify + - roles/ohpc_config + - roles/ohpc_install + - roles/pre_ohpc + - roles/viz_build_nodes # parseable: true # quiet: true # verbosity: 1 From a0470c99f10097b264eef9ed3a4dfcea31304e7e Mon Sep 17 00:00:00 2001 From: Bo-Chun Louis Chen Date: Tue, 23 Aug 2022 16:55:39 -0500 Subject: [PATCH 6/6] Disable some default ansible-lint settings --- .ansible-lint | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/.ansible-lint b/.ansible-lint index 084d5c1a..2b977948 100644 --- a/.ansible-lint +++ b/.ansible-lint @@ -22,18 +22,18 @@ exclude_paths: # verbosity: 1 # Mock modules or roles in order to pass ansible-playbook --syntax-check -mock_modules: - - zuul_return - # note the foo.bar is invalid as being neither a module or a collection - - fake_namespace.fake_collection.fake_module - - fake_namespace.fake_collection.fake_module.fake_submodule -mock_roles: - - mocked_role - - author.role_name # old standalone galaxy role - - fake_namespace.fake_collection.fake_role # role within a collection +#mock_modules: +# - zuul_return +# # note the foo.bar is invalid as being neither a module or a collection +# - fake_namespace.fake_collection.fake_module +# - fake_namespace.fake_collection.fake_module.fake_submodule +#mock_roles: +# - mocked_role +# - author.role_name # old standalone galaxy role +# - fake_namespace.fake_collection.fake_role # role within a collection # Enable checking of loop variable prefixes in roles -loop_var_prefix: "{role}_" +#loop_var_prefix: "{role}_" # Enforce variable names to follow pattern below, in addition to Ansible own # requirements, like avoiding python identifiers. To disable add `var-naming` @@ -83,12 +83,12 @@ warn_list: offline: false # Define required Ansible's variables to satisfy syntax check -extra_vars: - foo: bar - multiline_string_variable: | - line1 - line2 - complex_variable: ":{;\t$()" +#extra_vars: +# foo: bar +# multiline_string_variable: | +# line1 +# line2 +# complex_variable: ":{;\t$()" # Uncomment to enforce action validation with tasks, usually is not # needed as Ansible syntax check also covers it.