Skip to content

Commit c9f0748

Browse files
committed
update to galaxy lint standards bump:patch
1 parent e63a43f commit c9f0748

File tree

10 files changed

+51
-49
lines changed

10 files changed

+51
-49
lines changed

.ansible-lint

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,6 @@ exclude_paths:
66
- .github/
77
- molecule/*/tests/
88

9-
skip_list:
10-
- yaml[line-length]
11-
- fqcn[action-core] # todo this one is probably worth fixing
12-
- package-latest
13-
149
offline: false
1510

1611
supported_ansible_also:

.yamllint

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ ignore: |
1111
1212
rules:
1313
line-length:
14-
max: 120
14+
max: 160
1515
level: warning
1616

1717
indentation:

Makefile

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,9 @@ test_workflow: act-download ## Run GitHub workflows, but locally
7373

7474
test: molecule
7575

76+
molecule-destroy:
77+
$(molecule) destroy
78+
7679
clean: molecule-destroy ## Clean up molecule instances and temporary files
7780
@echo "Cleaning up..."
7881
find . -name "*.pyc" -delete
@@ -82,4 +85,5 @@ clean: molecule-destroy ## Clean up molecule instances and temporary files
8285

8386
distclean: clean
8487
@echo "Dist cleaning..."
85-
rm -rf $(shell pwd)/.act
88+
find . -name "*.log" -exec rm {} + 2> /dev/null || true
89+
find . -name ".act" -exec rm -rf {} + 2> /dev/null || true

meta/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ galaxy_info:
33
author: "ANXS crew"
44
company: "ANXS"
55
description: "Installs python, pip, virtualenv, and uv"
6-
min_ansible_version: "2.9"
6+
min_ansible_version: "2.13"
77
license: "MIT"
88
namespace: "anxs"
99
role_name: "python"

molecule/default/converge.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@
33
hosts: all
44
tasks:
55
- name: "Include ANXS Role"
6-
include_role:
6+
ansible.builtin.include_role:
77
name: "{{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }}"

tasks/main.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
- name: "Get the distribution specific variables"
3-
include_vars: "{{ lookup('ansible.builtin.first_found', params) }}"
3+
ansible.builtin.include_vars: "{{ lookup('ansible.builtin.first_found', params) }}"
44
vars:
55
params:
66
files:
@@ -10,11 +10,11 @@
1010
- "{{ role_path }}/vars"
1111

1212
- name: "Install python and accesory packages"
13-
include_tasks: "package.yml"
13+
ansible.builtin.include_tasks: "package.yml"
1414

1515
- name: "Ensure pip is properly installed"
16-
include_tasks: "pip.yml"
16+
ansible.builtin.include_tasks: "pip.yml"
1717

1818
- name: "Ensure uv is available if desired"
19-
include_tasks: "uv.yml"
19+
ansible.builtin.include_tasks: "uv.yml"
2020
when: python_uv_install

tasks/package.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,40 @@
11
---
22
- name: "Make sure PPA is enabled"
3-
apt_repository:
3+
ansible.builtin.apt_repository:
44
repo: "ppa:deadsnakes/ppa"
55
mode: "0644"
66
when: python_versions|length > 0
77

88
- name: "Make sure the packages are installed"
9-
apt:
9+
ansible.builtin.apt:
1010
pkg: "{{ python_packages_add }}"
11-
state: "latest"
11+
state: "present"
1212
update_cache: true
1313
when: python_packages_add|default([])|length > 0
1414

1515
- name: "Make sure old packages are removed"
16-
apt:
16+
ansible.builtin.apt:
1717
pkg: "{{ python_packages_remove }}"
1818
state: "absent"
1919
when: python_packages_remove|default([])|length > 0
2020

2121
- name: "Install additional (legacy) python versions, if requested"
22-
apt:
22+
ansible.builtin.apt:
2323
pkg:
2424
- "python{{ item }}"
2525
- "python{{ item }}-distutils"
2626
- "python{{ item }}-dev"
2727
- "python{{ item }}-venv"
28-
state: "latest"
28+
state: "present"
2929
with_items: "{{ python_versions }}"
3030
when: item|float < 3.12
3131

3232
- name: "Install additional python versions, if requested"
33-
apt:
33+
ansible.builtin.apt:
3434
pkg:
3535
- "python{{ item }}"
3636
- "python{{ item }}-dev"
3737
- "python{{ item }}-venv"
38-
state: "latest"
38+
state: "present"
3939
with_items: "{{ python_versions }}"
4040
when: item|float >= 3.12

tasks/pip.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
- name: "Install pip the new way"
3-
apt:
3+
ansible.builtin.apt:
44
pkg: "python3-pip"
5-
state: "latest"
5+
state: "present"
66
when: ansible_lsb.id == "Ubuntu"

tests/prepare.yml

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,32 +6,35 @@
66
tasks:
77

88
- name: Update apt cache
9-
apt:
9+
ansible.builtin.apt:
1010
update_cache: true
1111
cache_valid_time: 86400
1212
when: ansible_os_family == "Debian"
1313

1414
- name: Install essential packages
15-
apt:
15+
ansible.builtin.apt:
1616
name:
1717
- curl
1818
- ca-certificates
1919
- gnupg
20-
- "{{ 'software-properties-common' if (ansible_distribution != 'Debian' or (ansible_distribution == 'Debian' and (ansible_distribution_major_version | int) < 13)) else omit }}"
20+
- |
21+
{{ 'software-properties-common' if (ansible_distribution != 'Debian'
22+
or (ansible_distribution == 'Debian'
23+
and (ansible_distribution_major_version | int) < 13)) else omit }}
2124
- "lsb-release"
2225
state: present
2326
update_cache: yes
2427
when: ansible_os_family == "Debian"
2528

2629
- name: Create test user for permission tests
27-
user:
30+
ansible.builtin.user:
2831
name: testuser
2932
shell: /bin/bash
3033
create_home: true
3134
state: present
3235

3336
- name: Ensure target directories exist
34-
file:
37+
ansible.builtin.file:
3538
path: "{{ item }}"
3639
state: directory
3740
mode: "0755"
@@ -41,5 +44,5 @@
4144
- /tmp/test-downloads
4245

4346
- name: Set up mock network conditions (for testing error handling)
44-
debug:
47+
ansible.builtin.debug:
4548
msg: "Environment prepared for anxs-python role testing"

tests/verify.yml

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@
1010
tasks:
1111
# Python Installation Verification
1212
- name: Check Python is installed
13-
command: python3 --version
13+
ansible.builtin.command: python3 --version
1414
register: python_version
1515
changed_when: false
1616

1717
- name: Verify Python version output
18-
assert:
18+
ansible.builtin.assert:
1919
that:
2020
- python_version.rc == 0
2121
- "'Python 3.' in python_version.stdout"
@@ -24,12 +24,12 @@
2424

2525
# Pip Installation Verification
2626
- name: Check pip is installed
27-
command: pip3 --version
27+
ansible.builtin.command: pip3 --version
2828
register: pip_version
2929
changed_when: false
3030

3131
- name: Verify pip version output
32-
assert:
32+
ansible.builtin.assert:
3333
that:
3434
- pip_version.rc == 0
3535
- "'pip' in pip_version.stdout"
@@ -38,17 +38,17 @@
3838

3939
# UV Installation Verification (when enabled)
4040
- name: Check if uv should be installed
41-
set_fact:
41+
ansible.builtin.set_fact:
4242
uv_should_be_installed: "{{ python_uv_install | default(false) }}"
4343

4444
- name: Check uv binary exists
45-
stat:
45+
ansible.builtin.stat:
4646
path: "{{ python_prefix_dir | default('/usr/local') }}/bin/uv"
4747
register: uv_binary
4848
when: uv_should_be_installed
4949

5050
- name: Verify uv binary is executable
51-
assert:
51+
ansible.builtin.assert:
5252
that:
5353
- uv_binary.stat.exists
5454
- uv_binary.stat.executable
@@ -58,13 +58,13 @@
5858
when: uv_should_be_installed
5959

6060
- name: Check uvx binary exists
61-
stat:
61+
ansible.builtin.stat:
6262
path: "{{ python_prefix_dir | default('/usr/local') }}/bin/uvx"
6363
register: uvx_binary
6464
when: uv_should_be_installed
6565

6666
- name: Verify uvx binary is executable
67-
assert:
67+
ansible.builtin.assert:
6868
that:
6969
- uvx_binary.stat.exists
7070
- uvx_binary.stat.executable
@@ -74,13 +74,13 @@
7474
when: uv_should_be_installed
7575

7676
- name: Test uv command execution
77-
command: "{{ python_prefix_dir | default('/usr/local') }}/bin/uv --version"
77+
ansible.builtin.command: "{{ python_prefix_dir | default('/usr/local') }}/bin/uv --version"
7878
register: uv_version_check
7979
changed_when: false
8080
when: uv_should_be_installed
8181

8282
- name: Verify uv version output
83-
assert:
83+
ansible.builtin.assert:
8484
that:
8585
- uv_version_check.rc == 0
8686
- "'uv' in uv_version_check.stdout"
@@ -90,13 +90,13 @@
9090
when: uv_should_be_installed
9191

9292
- name: Test uvx command execution
93-
command: "{{ python_prefix_dir | default('/usr/local') }}/bin/uvx --version"
93+
ansible.builtin.command: "{{ python_prefix_dir | default('/usr/local') }}/bin/uvx --version"
9494
register: uvx_version_check
9595
changed_when: false
9696
when: uv_should_be_installed
9797

9898
- name: Verify uvx version output
99-
assert:
99+
ansible.builtin.assert:
100100
that:
101101
- uvx_version_check.rc == 0
102102
- "'uvx' in uvx_version_check.stdout"
@@ -106,24 +106,24 @@
106106

107107
# Architecture Detection Verification
108108
- name: Get system architecture
109-
command: uname -m
109+
ansible.builtin.command: uname -m
110110
register: system_arch
111111
changed_when: false
112112

113113
- name: Verify architecture was detected correctly
114-
debug:
114+
ansible.builtin.debug:
115115
msg: "System architecture detected as: {{ system_arch.stdout }}"
116116

117117
# Permissions Verification
118118
- name: Check file permissions in install directory
119-
find:
119+
ansible.builtin.find:
120120
paths: "{{ python_prefix_dir | default('/usr/local') }}/bin"
121121
patterns: "uv*"
122122
register: uv_files
123123
when: uv_should_be_installed
124124

125125
- name: Verify all uv files have correct permissions
126-
assert:
126+
ansible.builtin.assert:
127127
that:
128128
- "item.mode is defined and (item.mode | string) | regex_search('755$')"
129129
fail_msg: "UV file {{ item.path }} has incorrect permissions: {{ item.mode }}"
@@ -133,22 +133,22 @@
133133

134134
# Idempotency Test Setup (verify no temp files left behind)
135135
- name: Check for leftover temporary files
136-
find:
136+
ansible.builtin.find:
137137
paths: /tmp
138138
patterns: "*uv*"
139139
file_type: any
140140
register: temp_uv_files
141141

142142
- name: Verify no temporary UV files left behind
143-
assert:
143+
ansible.builtin.assert:
144144
that:
145145
- temp_uv_files.files | length == 0
146146
fail_msg: "Temporary UV files found: {{ temp_uv_files.files | map(attribute='path') | list }}"
147147
success_msg: "No temporary UV files left behind - good cleanup"
148148

149149
# Final Success Summary
150150
- name: Display verification summary
151-
debug:
151+
ansible.builtin.debug:
152152
msg: |
153153
✅ anxs-python Role Verification Complete!
154154

0 commit comments

Comments
 (0)