ansible_galaxy_install: new param executable (#11646)

* ansible_galaxy_install: new param executable

* add changelog frag
This commit is contained in:
Alexei Znamensky
2026-03-23 08:21:54 +13:00
committed by GitHub
parent a09e879ff2
commit 8d403dde5b
3 changed files with 56 additions and 3 deletions

View File

@@ -141,3 +141,43 @@
that:
- upgrade_c1 is changed
- upgrade_c2 is not changed
###################################################
- name: Find ansible-galaxy executable path
ansible.builtin.command: which ansible-galaxy
register: galaxy_which
changed_when: false
- name: Make directory exec_c
ansible.builtin.file:
path: "{{ remote_tmp_dir }}/exec_c"
state: directory
- name: Install collection using explicit executable path
community.general.ansible_galaxy_install:
type: collection
name: netbox.netbox
dest: "{{ remote_tmp_dir }}/exec_c"
executable: "{{ galaxy_which.stdout }}"
register: exec_c0
- name: Assert collection was installed using explicit executable
assert:
that:
- exec_c0 is changed
- '"netbox.netbox" in exec_c0.new_collections'
- exec_c0.executable == galaxy_which.stdout
- name: Fail to install collection using bad executable path
community.general.ansible_galaxy_install:
type: collection
name: netbox.netbox
dest: "{{ remote_tmp_dir }}/exec_c"
executable: /nonexistent/ansible-galaxy
register: exec_c_fail
ignore_errors: true
- name: Assert bad executable caused failure
assert:
that:
- exec_c_fail is failed