fix(ansible): declare ansible.posix as a collection dependency - #7298
Merged
Conversation
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>
|
Thank you for contributing to the Autoware project! 🚧 If your pull request is in progress, switch it to draft mode. Please ensure:
|
xmfcx
marked this pull request as ready for review
September 1, 2026 14:25
xmfcx
requested review from
isamu-takagi,
mitsudome-r,
oguzkaganozt and
youtalk
as code owners
September 1, 2026 14:25
mitsudome-r
approved these changes
Sep 1, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
The
autoware.dev_envcollection uses two modules from theansible.posixcollection. Theagnocastrole usesansible.posix.sysctl, and theqt5ct_setuprole usesansible.posix.synchronize. Thegalaxy.ymlfile declared no dependencies. This PR addsansible.posix: ">=1.0.0"todependencies.The install paths of Autoware do not show the problem.
ansible/scripts/install-ansible.sh, the Dockerfiles, and the CI workflows installansible==10.*. That package bundlesansible.posix1.6.2, so the modules resolve. A host with onlyansible-corehas noansible.posix. On such a host,ansible-playbook autoware.dev_env.install_dev_envstops at parse time withcouldn't resolve module/action 'ansible.posix.sysctl'. The--tagsoption does not help, because Ansible resolves every task of every role before it filters by tag.install_image_depsstops the same way onansible.posix.synchronize.With the dependency in
galaxy.yml,ansible-galaxy collection install -f -r ansible-galaxy-requirements.yamlresolves it. Ifansible.posixis already installed, for example from theansiblebundle, the resolver uses that copy and downloads nothing. If it is absent, the resolver downloads it from Galaxy.The dependency goes in
galaxy.ymland not inansible-galaxy-requirements.yaml. An entry in the requirements file is an explicit request, and-freinstalls an explicit request on every run. That adds a Galaxy download to every Docker build and every CI job. A dependency ingalaxy.ymlis only resolved when it is missing.The lower bound is
>=1.0.0because both modules exist inansible.posixsince 1.0.0. On a host without the bundle, the resolver picks the newest release on Galaxy, 2.2.2 today.How to verify
ansible-corewithout theansiblebundle, for example withpipx install ansible-core.ansible-galaxy collection install -f -r ansible-galaxy-requirements.yaml. The output must listansible.posix.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-coreonly, the collection install now pullsansible.posix2.2.2 and all five playbooks pass--syntax-check. With theansible==10.*bundle that Docker and CI use, the install output is unchanged andansible-lintpasses, but no Docker image was built.Collection install with
ansible-core2.21.3Two copies of
ansible/, one with thegalaxy.ymlfrommainand one with this change. Each install ran withANSIBLE_COLLECTIONS_PATHset to an empty directory.autoware.dev_env:0.1.0 was installed successfully, nothing elseDownloading https://galaxy.ansible.com/.../ansible-posix-2.2.2.tar.gzandansible.posix:2.2.2 was installed successfullyPlaybook syntax check with
ansible-core2.21.3ansible-playbook --syntax-check autoware.dev_env.<playbook>against each copy.install_dev_envexit 4 withcouldn't resolve module/action 'ansible.posix.sysctl'.install_image_depsexit 4 withcouldn't resolve module/action 'ansible.posix.synchronize'.install_docker,install_nvidia,install_rmwexit 0install_dev_env --tags artifacts --list-tasksalso exits 4 with thesysctlerror, so--tagsis not a workaroundsudo. The check stops at module resolution, which is the error that this PR correctsCollection install with the
ansible==10.*bundleA venv with
ansible10.7.0 (ansible-core2.17.14), the version thatinstall-ansible.sh, the Dockerfiles, and the CI workflows install.ansible-galaxy collection list ansible.posixshowsansible.posix 1.6.2insite-packages.Installing 'autoware.dev_env:0.1.0'andautoware.dev_env:0.1.0 was installed successfully. NoDownloadingline, noansible.posixlineansible.posixas a second entry in the requirements file:Downloading .../ansible-posix-2.2.2.tar.gzon every run, also with the bundle. This is why the dependency sits ingalaxy.ymlansible-galaxycommand and theansibleversion are the same as indocker/*.Dockerfileansible-lintThe
pre-commit-ansiblehook pinslanguage_version: python3.14, which this machine does not have. A venv withansible-lint==26.6.0andansible14.3.1 (ansible.posix2.2.2 bundled) reproduced the hook. The CI install step ran first, against an empty collections path.ansible-lint -v ansible/loggedProvisioning collection ansible.posix:>=1.0.0 from galaxy.yml, thenPassed: 0 failure(s), 0 warning(s) in 89 files processed of 164 encounteredANSIBLE_GALAXY_SERVER=http://127.0.0.1:9and a fresh cache also passed, so the job does not depend on Galaxyansible-lint26.8.0 withansible-core2.21.3 also passed with the same countspre-commit-ansibleworkflow itself, on Python 3.14Module history
gh api repos/ansible-collections/ansible.posix/contents/plugins/modules?ref=1.0.0listssysctl.pyandsynchronize.pyansible-doc -l ansible.posixon 2.2.2 lists both modules