Skip to content

Commit

Permalink
ci: support ansible-lint and ansible-test 2.16
Browse files Browse the repository at this point in the history
Fix yamllint issue with markdownlint config

Add cleanup for tests_include_vars_from_parent.yml

Use correct shebang for shell scripts

Ignore sanity[cannot-ignore] for ansible-lint due to python2 ipaddress
library requirement for `unicode_literals`

Signed-off-by: Rich Megginson <[email protected]>
  • Loading branch information
richm committed Jan 5, 2024
1 parent f838e58 commit 4cbd8b8
Show file tree
Hide file tree
Showing 13 changed files with 19 additions and 11 deletions.
1 change: 1 addition & 0 deletions .ansible-lint
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ kinds:
skip_list:
- fqcn-builtins
- var-naming[no-role-prefix]
- sanity[cannot-ignore]

Check warning on line 18 in .ansible-lint

View workflow job for this annotation

GitHub Actions / Detect non-inclusive language

`sanity` may be insensitive, use `confidence`, `quick check`, `coherence check` instead
exclude_paths:
- tests/roles/
- .github/
Expand Down
1 change: 1 addition & 0 deletions .markdownlint.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
# Default state for all rules
default: true

Expand Down
1 change: 0 additions & 1 deletion .sanity-ansible-ignore-2.10.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
plugins/filter/vpn_ipaddr.py no-unicode-literals!skip
tests/vpn/unit/test_vpn_ipaddr.py no-unicode-literals!skip
lsr_role2coll_extra_script-vpn shebang!skip
1 change: 0 additions & 1 deletion .sanity-ansible-ignore-2.11.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
plugins/filter/vpn_ipaddr.py no-unicode-literals!skip
tests/vpn/unit/test_vpn_ipaddr.py no-unicode-literals!skip
lsr_role2coll_extra_script-vpn shebang!skip
1 change: 0 additions & 1 deletion .sanity-ansible-ignore-2.12.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
plugins/filter/vpn_ipaddr.py no-unicode-literals!skip
tests/vpn/unit/test_vpn_ipaddr.py no-unicode-literals!skip
lsr_role2coll_extra_script-vpn shebang!skip
1 change: 0 additions & 1 deletion .sanity-ansible-ignore-2.13.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
plugins/filter/vpn_ipaddr.py no-unicode-literals!skip
tests/vpn/unit/test_vpn_ipaddr.py no-unicode-literals!skip
lsr_role2coll_extra_script-vpn shebang!skip
1 change: 0 additions & 1 deletion .sanity-ansible-ignore-2.14.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
plugins/filter/vpn_ipaddr.py no-unicode-literals!skip
tests/vpn/unit/test_vpn_ipaddr.py no-unicode-literals!skip
lsr_role2coll_extra_script-vpn shebang!skip
1 change: 0 additions & 1 deletion .sanity-ansible-ignore-2.15.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
plugins/filter/vpn_ipaddr.py no-unicode-literals!skip
tests/vpn/unit/test_vpn_ipaddr.py no-unicode-literals!skip
lsr_role2coll_extra_script-vpn shebang!skip
2 changes: 2 additions & 0 deletions .sanity-ansible-ignore-2.16.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
plugins/filter/vpn_ipaddr.py no-unicode-literals!skip
tests/vpn/unit/test_vpn_ipaddr.py no-unicode-literals!skip
1 change: 0 additions & 1 deletion .sanity-ansible-ignore-2.9.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
plugins/filter/vpn_ipaddr.py no-unicode-literals!skip
tests/vpn/unit/test_vpn_ipaddr.py no-unicode-literals!skip
lsr_role2coll_extra_script-vpn shebang!skip
2 changes: 1 addition & 1 deletion lsr_role2coll_extra_script
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

set -euo pipefail
if [ -n "${LSR_DEBUG:-}" ]; then
Expand Down
6 changes: 4 additions & 2 deletions tests/roles/caller/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
---
# tasks file for caller

- include_role:
- name: Include role
include_role:
name: "{{ roletoinclude }}"

- assert:
- name: Test variable override
assert:
that: not __caller_override
11 changes: 10 additions & 1 deletion tests/tests_include_vars_from_parent.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
- name: Test role variable override
- name: Test role include variable override
hosts: all
gather_facts: true
tasks:
Expand Down Expand Up @@ -38,9 +38,18 @@
varfiles: "{{ [facts['distribution']] | product(separators) |
map('join') | product(versions) | map('join') | list +
[facts['distribution'], facts['os_family']] }}"
register: __varfiles_created

- name: Import role
import_role:
name: caller
vars:
roletoinclude: linux-system-roles.vpn

- name: Cleanup
file:
path: "{{ item.dest }}"
state: absent
loop: "{{ __varfiles_created.results }}"
delegate_to: localhost
when: inventory_hostname == ansible_play_hosts_all[0]

0 comments on commit 4cbd8b8

Please sign in to comment.