Skip to content

fix(ansible): declare ansible.posix as a collection dependency - #7298

Merged
xmfcx merged 1 commit into
mainfrom
fix/ansible-posix-dependency
Sep 1, 2026
Merged

fix(ansible): declare ansible.posix as a collection dependency#7298
xmfcx merged 1 commit into
mainfrom
fix/ansible-posix-dependency

Conversation

@xmfcx

@xmfcx xmfcx commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

Description

The autoware.dev_env collection uses two modules from the ansible.posix collection. The agnocast role uses ansible.posix.sysctl, and the qt5ct_setup role uses ansible.posix.synchronize. The galaxy.yml file declared no dependencies. This PR adds ansible.posix: ">=1.0.0" to dependencies.

The install paths of Autoware do not show the problem. ansible/scripts/install-ansible.sh, the Dockerfiles, and the CI workflows install ansible==10.*. That package bundles ansible.posix 1.6.2, so the modules resolve. A host with only ansible-core has no ansible.posix. On such a host, ansible-playbook autoware.dev_env.install_dev_env stops at parse time with couldn't resolve module/action 'ansible.posix.sysctl'. The --tags option does not help, because Ansible resolves every task of every role before it filters by tag. install_image_deps stops the same way on ansible.posix.synchronize.

With the dependency in galaxy.yml, ansible-galaxy collection install -f -r ansible-galaxy-requirements.yaml resolves it. If ansible.posix is already installed, for example from the ansible bundle, the resolver uses that copy and downloads nothing. If it is absent, the resolver downloads it from Galaxy.

The dependency goes in galaxy.yml and not in ansible-galaxy-requirements.yaml. An entry in the requirements file is an explicit request, and -f reinstalls an explicit request on every run. That adds a Galaxy download to every Docker build and every CI job. A dependency in galaxy.yml is only resolved when it is missing.

The lower bound is >=1.0.0 because both modules exist in ansible.posix since 1.0.0. On a host without the bundle, the resolver picks the newest release on Galaxy, 2.2.2 today.

How to verify

  1. Install ansible-core without the ansible bundle, for example with pipx install ansible-core.
  2. Run ansible-galaxy collection install -f -r ansible-galaxy-requirements.yaml. The output must list ansible.posix.
  3. Run ansible-playbook --syntax-check autoware.dev_env.install_dev_env. The exit code must be 0.

AI usage

AI usage: written with Claude Code. Fatih made the one-line change in galaxy.yml. Claude Code traced the two module usages, tested the install paths, and wrote this description.

Self-review: Simple PR, fixed the problem for me. And doesn't regress existing behavior.

Verification: With ansible-core only, the collection install now pulls ansible.posix 2.2.2 and all five playbooks pass --syntax-check. With the ansible==10.* bundle that Docker and CI use, the install output is unchanged and ansible-lint passes, but no Docker image was built.

Collection install with ansible-core 2.21.3

Two copies of ansible/, one with the galaxy.yml from main and one with this change. Each install ran with ANSIBLE_COLLECTIONS_PATH set to an empty directory.

  • Before: autoware.dev_env:0.1.0 was installed successfully, nothing else
  • After: the same line, then Downloading https://galaxy.ansible.com/.../ansible-posix-2.2.2.tar.gz and ansible.posix:2.2.2 was installed successfully

Playbook syntax check with ansible-core 2.21.3

ansible-playbook --syntax-check autoware.dev_env.<playbook> against each copy.

  • Before: install_dev_env exit 4 with couldn't resolve module/action 'ansible.posix.sysctl'. install_image_deps exit 4 with couldn't resolve module/action 'ansible.posix.synchronize'. install_docker, install_nvidia, install_rmw exit 0
  • Before: install_dev_env --tags artifacts --list-tasks also exits 4 with the sysctl error, so --tags is not a workaround
  • After: all five playbooks exit 0
  • Not run: the playbooks themselves, with sudo. The check stops at module resolution, which is the error that this PR corrects

Collection install with the ansible==10.* bundle

A venv with ansible 10.7.0 (ansible-core 2.17.14), the version that install-ansible.sh, the Dockerfiles, and the CI workflows install. ansible-galaxy collection list ansible.posix shows ansible.posix 1.6.2 in site-packages.

  • Before and after: the output is the same two lines, Installing 'autoware.dev_env:0.1.0' and autoware.dev_env:0.1.0 was installed successfully. No Downloading line, no ansible.posix line
  • Alternative design, ansible.posix as a second entry in the requirements file: Downloading .../ansible-posix-2.2.2.tar.gz on every run, also with the bundle. This is why the dependency sits in galaxy.yml
  • Not run: a Docker image build. The ansible-galaxy command and the ansible version are the same as in docker/*.Dockerfile

ansible-lint

The pre-commit-ansible hook pins language_version: python3.14, which this machine does not have. A venv with ansible-lint==26.6.0 and ansible 14.3.1 (ansible.posix 2.2.2 bundled) reproduced the hook. The CI install step ran first, against an empty collections path.

  • ansible-lint -v ansible/ logged Provisioning collection ansible.posix:>=1.0.0 from galaxy.yml, then Passed: 0 failure(s), 0 warning(s) in 89 files processed of 164 encountered
  • The same run with ANSIBLE_GALAXY_SERVER=http://127.0.0.1:9 and a fresh cache also passed, so the job does not depend on Galaxy
  • The local ansible-lint 26.8.0 with ansible-core 2.21.3 also passed with the same counts
  • Not run: the pre-commit-ansible workflow itself, on Python 3.14

Module history

  • gh api repos/ansible-collections/ansible.posix/contents/plugins/modules?ref=1.0.0 lists sysctl.py and synchronize.py
  • ansible-doc -l ansible.posix on 2.2.2 lists both modules

The agnocast role uses ansible.posix.sysctl and the qt5ct_setup role uses
ansible.posix.synchronize, but galaxy.yml declared no dependencies. On a
host with only ansible-core, the install_dev_env and install_image_deps
playbooks stop at parse time with "couldn't resolve module/action
'ansible.posix.sysctl'".

With the dependency declared, ansible-galaxy collection install resolves
it. The ansible bundle that install-ansible.sh, the Dockerfiles and CI
install already contains ansible.posix, so nothing is downloaded there.

Signed-off-by: Mete Fatih Cırıt <mfc@autoware.org>
@xmfcx xmfcx added the type:installation Issues or improvements related to the installation process of the software. label Sep 1, 2026
@xmfcx xmfcx self-assigned this Sep 1, 2026
@github-actions

github-actions Bot commented Sep 1, 2026

Copy link
Copy Markdown

Thank you for contributing to the Autoware project!

🚧 If your pull request is in progress, switch it to draft mode.

Please ensure:

@xmfcx xmfcx added the run:health-check Run health-check label Sep 1, 2026
@xmfcx
xmfcx marked this pull request as ready for review September 1, 2026 14:25
@xmfcx
xmfcx enabled auto-merge (squash) September 1, 2026 15:19
@xmfcx
xmfcx merged commit ef29ee6 into main Sep 1, 2026
44 of 54 checks passed
@xmfcx
xmfcx deleted the fix/ansible-posix-dependency branch September 1, 2026 15:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

run:health-check Run health-check type:installation Issues or improvements related to the installation process of the software.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants