ansible / ansible

Ansible is a radically simple IT automation platform that makes your applications and systems easier to deploy and maintain. Automate everything from code deployment to network configuration to cloud management, in a language that approaches plain English, using SSH, with no agents to install on remote systems. https://docs.ansible.com.
https://www.ansible.com/
GNU General Public License v3.0
62.87k stars 23.9k forks source link

ansible-galaxy silently ignores invalid parameters in requirements.yml #83699

Open gtirloni opened 3 months ago

gtirloni commented 3 months ago

Summary

When installing a collection from a git repository using ansible-galaxy, if an invalid parameter is specified in a requirements.yml, it's silently ignored and ansible-galaxy proceeds with default values, which may not have been what the user wanted.

Issue Type

Bug Report

Component Name

ansible-galaxy

Ansible Version

ansible-galaxy [core 2.17.2]
python version = 3.12.3

Configuration

N/A

OS / Environment

Ubuntu

Steps to Reproduce

This example requirements.yml will successfully install a collection from git, but not using the correct tag because the user hypothetically confused version with tag but ansible-galaxy did not complain about it and proceeded to install from the main branch:

collections:
  - name: https://github.com/theforeman/foreman-ansible-modules
    type: git
    tag: v4.1.0

Expected Results

ansible-galaxy should complain that tag is not a valid parameter and refuse to install the collection (maybe check the file against a schema).

Actual Results

# ansible-galaxy install -r ./requirements.yml
Cloning into '/root/.ansible/tmp/ansible-local-5721z5h_xyre/tmp53g5mloa/foreman-ansible-modulesbptnb1q3'...
remote: Enumerating objects: 1542, done.
remote: Counting objects: 100% (1542/1542), done.
remote: Compressing objects: 100% (767/767), done.
remote: Total 1542 (delta 1125), reused 947 (delta 732), pack-reused 0
Receiving objects: 100% (1542/1542), 2.35 MiB | 3.86 MiB/s, done.
Resolving deltas: 100% (1125/1125), done.
Your branch is up to date with 'origin/develop'.
Starting galaxy collection install process
Process install dependency map
Starting collection install process
Installing 'theforeman.foreman:4.2.0-dev' to '/root/.ansible/collections/ansible_collections/theforeman/foreman'
Created collection for theforeman.foreman:4.2.0-dev at /root/.ansible/collections/ansible_collections/theforeman/foreman
theforeman.foreman:4.2.0-dev was installed successfully

Code of Conduct

ansibot commented 3 months ago

Files identified in the description:

If these files are incorrect, please update the component name section of the description or use the component bot command.