mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-03-26 21:33:12 +00:00
ansible_galaxy_install: new param executable (#11646)
* ansible_galaxy_install: new param executable * add changelog frag
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user